mfp seems like ready

This commit is contained in:
partysan
2022-11-19 21:15:33 +03:00
parent 4f46089a87
commit 8073c4bd7b
12 changed files with 550 additions and 210 deletions
+23
View File
@@ -24,6 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <QCryptographicHash>
#include <QMutex>
#include <QFile>
#include <QRandomGenerator>
#include <iostream>
namespace g {
@@ -32,6 +33,9 @@ namespace c {
const QString SOFTWARE_NAME = "3proxy-eagle";
const QString SOFTWARE_VERSION = "0.0.1a";
const QString COPYRIGHT = "GPLv3 (c) acetone, 2022";
const int LAST_AND_TOP_LIST_SIZE = 10;
const qint64 DB_DAILY_TOP_TABLE_ACTUALIZE_MINIMAL_INTERVAL_MS = 300000; // 5 min
const qint64 CACHE_ACTUALIZE_TOP_LISTS_FROM_DB_MINIMAL_INTERVAL_MS = 5000; // 5 sec
const QString HA_PAGE_TITLE = "{{PAGE_TITLE}}";
const QString HA_CUSTOM_CSS = "{{CUSTOM_CSS}}";
const QString HA_DAILY_UPLOAD = "{{DAILY_UPLOAD}}";
@@ -188,6 +192,25 @@ QString getValue(const QString &string, const QString &key, GetValueType type)
return result;
}
QString randomString(int length)
{
static const QString table
{"0123456789"
"abcdefghij"
"klmnkpqrst"
"uvwxyzABCD"
"EFGHIJKLMN"
"hPQRSTUVWX"};
static const int posLimit = table.size() - 1;
QString value;
while(value.size() < length)
{
value += table[ QRandomGenerator::system()->bounded (0, posLimit) ];
}
return value;
}
QString hash(const QByteArray &data)
{