diff --git a/src/base/http/types.h b/src/base/http/types.h index 9c8ea535e..b7d5c9586 100644 --- a/src/base/http/types.h +++ b/src/base/http/types.h @@ -37,6 +37,9 @@ namespace Http { + const char METHOD_GET[] = "GET"; + const char METHOD_POST[] = "POST"; + const char HEADER_CACHE_CONTROL[] = "cache-control"; const char HEADER_CONTENT_ENCODING[] = "content-encoding"; const char HEADER_CONTENT_LENGTH[] = "content-length"; @@ -52,13 +55,14 @@ namespace Http const char HEADER_X_FRAME_OPTIONS[] = "x-frame-options"; const char HEADER_X_XSS_PROTECTION[] = "x-xss-protection"; - const char CONTENT_TYPE_CSS[] = "text/css; charset=UTF-8"; - const char CONTENT_TYPE_GIF[] = "image/gif"; - const char CONTENT_TYPE_HTML[] = "text/html; charset=UTF-8"; - const char CONTENT_TYPE_JS[] = "application/javascript; charset=UTF-8"; + const char CONTENT_TYPE_HTML[] = "text/html"; + const char CONTENT_TYPE_JS[] = "application/javascript"; const char CONTENT_TYPE_JSON[] = "application/json"; + const char CONTENT_TYPE_BMP[] = "image/bmp"; + const char CONTENT_TYPE_GIF[] = "image/gif"; + const char CONTENT_TYPE_JPEG[] = "image/jpeg"; const char CONTENT_TYPE_PNG[] = "image/png"; - const char CONTENT_TYPE_TXT[] = "text/plain; charset=UTF-8"; + const char CONTENT_TYPE_TXT[] = "text/plain"; const char CONTENT_TYPE_SVG[] = "image/svg+xml"; // portability: "\r\n" doesn't guarantee mapping to the correct value diff --git a/src/webui/abstractwebapplication.cpp b/src/webui/abstractwebapplication.cpp index d855bab0f..1be2e73ad 100644 --- a/src/webui/abstractwebapplication.cpp +++ b/src/webui/abstractwebapplication.cpp @@ -225,9 +225,6 @@ bool AbstractWebApplication::readFile(const QString& path, QByteArray &data, QSt QString dataStr = QString::fromUtf8(data.constData()); translateDocument(dataStr); - if (path.endsWith("about.html") || path.endsWith("index.html") || path.endsWith("client.js")) - dataStr.replace("${VERSION}", QBT_VERSION); - data = dataStr.toUtf8(); translatedFiles_[path] = data; // cashing translated file } @@ -296,6 +293,9 @@ void AbstractWebApplication::translateDocument(QString& data) else { found = false; // no more translatable strings } + + data.replace(QLatin1String("${LANG}"), locale.left(2)); + data.replace(QLatin1String("${VERSION}"), QBT_VERSION); } } diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index 5741cbed4..9c8d85f32 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -1,8 +1,8 @@ - - + +
- +