mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 13:53:37 -07:00
Restore ability to use server-side translation by custom WebUI
PR #20711.
This commit is contained in:
parent
694661d751
commit
769de08463
1 changed files with 7 additions and 10 deletions
|
@ -114,7 +114,7 @@ namespace
|
||||||
|
|
||||||
if ((contentType == Http::CONTENT_TYPE_CSS)
|
if ((contentType == Http::CONTENT_TYPE_CSS)
|
||||||
|| (contentType == Http::CONTENT_TYPE_JS))
|
|| (contentType == Http::CONTENT_TYPE_JS))
|
||||||
{
|
{
|
||||||
// short interval in case of program update
|
// short interval in case of program update
|
||||||
return u"private, max-age=43200"_s; // 12 hrs
|
return u"private, max-age=43200"_s; // 12 hrs
|
||||||
}
|
}
|
||||||
|
@ -520,15 +520,12 @@ void WebApplication::sendFile(const Path &path)
|
||||||
const QDateTime lastModified = Utils::Fs::lastModified(path);
|
const QDateTime lastModified = Utils::Fs::lastModified(path);
|
||||||
|
|
||||||
// find translated file in cache
|
// find translated file in cache
|
||||||
if (!m_isAltUIUsed)
|
if (const auto it = m_translatedFiles.constFind(path);
|
||||||
|
(it != m_translatedFiles.constEnd()) && (lastModified <= it->lastModified))
|
||||||
{
|
{
|
||||||
if (const auto it = m_translatedFiles.constFind(path);
|
print(it->data, it->mimeType);
|
||||||
(it != m_translatedFiles.constEnd()) && (lastModified <= it->lastModified))
|
setHeader({Http::HEADER_CACHE_CONTROL, getCachingInterval(it->mimeType)});
|
||||||
{
|
return;
|
||||||
print(it->data, it->mimeType);
|
|
||||||
setHeader({Http::HEADER_CACHE_CONTROL, getCachingInterval(it->mimeType)});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto readResult = Utils::IO::readFile(path, MAX_ALLOWED_FILESIZE);
|
const auto readResult = Utils::IO::readFile(path, MAX_ALLOWED_FILESIZE);
|
||||||
|
@ -559,7 +556,7 @@ void WebApplication::sendFile(const Path &path)
|
||||||
|
|
||||||
QByteArray data = readResult.value();
|
QByteArray data = readResult.value();
|
||||||
const QMimeType mimeType = QMimeDatabase().mimeTypeForFileNameAndData(path.data(), data);
|
const QMimeType mimeType = QMimeDatabase().mimeTypeForFileNameAndData(path.data(), data);
|
||||||
const bool isTranslatable = !m_isAltUIUsed && mimeType.inherits(u"text/plain"_s);
|
const bool isTranslatable = mimeType.inherits(u"text/plain"_s);
|
||||||
|
|
||||||
if (isTranslatable)
|
if (isTranslatable)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue