mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-27 23:14:31 +00:00
Use a random number for WebUI cache busting
Also fetch qbt version info via WebAPI properly.
This commit is contained in:
parent
d022457e0c
commit
49b57904f9
@ -117,6 +117,7 @@ namespace
|
||||
|
||||
WebApplication::WebApplication(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_cacheID {QString::number(Utils::Random::rand(), 36)}
|
||||
{
|
||||
registerAPIController(QLatin1String("app"), new AppController(this, this));
|
||||
registerAPIController(QLatin1String("auth"), new AuthController(this, this));
|
||||
@ -225,7 +226,7 @@ void WebApplication::translateDocument(QString &data)
|
||||
}
|
||||
|
||||
data.replace(QLatin1String("${LANG}"), m_currentLocale.left(2));
|
||||
data.replace(QLatin1String("${VERSION}"), QBT_VERSION);
|
||||
data.replace(QLatin1String("${CACHEID}"), m_cacheID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,6 +127,7 @@ private:
|
||||
Http::Request m_request;
|
||||
Http::Environment m_env;
|
||||
QMap<QString, QString> m_params;
|
||||
const QString m_cacheID;
|
||||
|
||||
const QRegularExpression m_apiPathPattern {(QLatin1String("^/api/v2/(?<scope>[A-Za-z_][A-Za-z_0-9]*)/(?<action>[A-Za-z_][A-Za-z_0-9]*)$"))};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div id="aboutAboutContent" class="aboutTabContent">
|
||||
<img src="images/skin/mascot.png" style="float: right;" alt="qBittorrent Mascot" />
|
||||
<h3 id="qbittorrentVersion">qBittorrent ${VERSION} QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]</h3>
|
||||
<h3 id="qbittorrentVersion"></h3>
|
||||
<p>QBT_TR(An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar.)QBT_TR[CONTEXT=AboutDialog]</p>
|
||||
<p>Copyright (c) 2011-2019 The qBittorrent project</p>
|
||||
<p>QBT_TR(Home Page:)QBT_TR[CONTEXT=AboutDialog] <a target="_blank" href="https://www.qbittorrent.org"> https://www.qbittorrent.org</a></p>
|
||||
@ -676,6 +676,10 @@
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
$('qbittorrentVersion').innerText = ("qBittorrent " + qbtVersion()
|
||||
+ " QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]");
|
||||
|
||||
new Request.JSON({
|
||||
url: 'api/v2/app/buildInfo',
|
||||
method: 'get',
|
||||
|
@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDialog]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(Deletion confirmation - qBittorrent)QBT_TR[CONTEXT=confirmDeletionDlg]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script>
|
||||
|
@ -4,12 +4,12 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(Add Torrent Links)QBT_TR[CONTEXT=downloadFromURL]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/Window.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/Window.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script src="scripts/download.js?v=${VERSION}"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${VERSION}"></script>
|
||||
<script src="scripts/download.js?v=${CACHEID}"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -4,11 +4,11 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(Torrent Download Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script src="scripts/lib/mocha-0.9.6-yc.js"></script>
|
||||
<script src="scripts/speedslider.js?v=${VERSION}"></script>
|
||||
<script src="scripts/speedslider.js?v=${CACHEID}"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(Tracker editing)QBT_TR[CONTEXT=TrackerListWidget]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script>
|
||||
|
@ -4,28 +4,28 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=10" />
|
||||
<title>qBittorrent ${VERSION} QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]</title>
|
||||
<title>qBittorrent Web UI</title>
|
||||
<link rel="icon" type="image/png" href="images/skin/qbittorrent32.png" />
|
||||
<link rel="stylesheet" type="text/css" href="css/dynamicTable.css?v=${VERSION}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css?v=${VERSION}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/dynamicTable.css?v=${CACHEID}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css?v=${CACHEID}" />
|
||||
<!--<link rel="stylesheet" type="text/css" href="css/Content.css" />-->
|
||||
<link rel="stylesheet" type="text/css" href="css/Core.css?v=${VERSION}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/Layout.css?v=${VERSION}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/Window.css?v=${VERSION}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/Tabs.css?v=${VERSION}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/Core.css?v=${CACHEID}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/Layout.css?v=${CACHEID}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/Window.css?v=${CACHEID}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/Tabs.css?v=${CACHEID}" />
|
||||
<noscript>
|
||||
<link rel="stylesheet" type="text/css" href="css/noscript.css?v=${VERSION}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/noscript.css?v=${CACHEID}" />
|
||||
</noscript>
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script src="scripts/lib/mocha-0.9.6-yc.js"></script>
|
||||
<script src="scripts/mocha-init.js?locale=${LANG}&v=${VERSION}"></script>
|
||||
<script src="scripts/mocha-init.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||
<script src="scripts/lib/clipboard-2.0.0.min.js"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${VERSION}"></script>
|
||||
<script src="scripts/progressbar.js?v=${VERSION}"></script>
|
||||
<script src="scripts/dynamicTable.js?locale=${LANG}&v=${VERSION}"></script>
|
||||
<script src="scripts/client.js?locale=${LANG}&v=${VERSION}"></script>
|
||||
<script src="scripts/contextmenu.js?locale=${LANG}&v=${VERSION}"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||
<script src="scripts/progressbar.js?v=${CACHEID}"></script>
|
||||
<script src="scripts/dynamicTable.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||
<script src="scripts/client.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||
<script src="scripts/contextmenu.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -4,10 +4,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${VERSION}"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(Download from URLs)QBT_TR[CONTEXT=downloadFromURL]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/Tabs.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/Tabs.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script src="scripts/lib/mocha-0.9.6-yc.js"></script>
|
||||
|
@ -4,10 +4,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(Rename)QBT_TR[CONTEXT=TransferListWidget]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${VERSION}"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
|
@ -77,6 +77,25 @@ function getSyncMainDataInterval() {
|
||||
return customSyncMainDataInterval ? customSyncMainDataInterval : serverSyncMainDataInterval;
|
||||
}
|
||||
|
||||
const fetchQbtVersion = function() {
|
||||
new Request({
|
||||
url: 'api/v2/app/version',
|
||||
method: 'get',
|
||||
onSuccess: function(info) {
|
||||
if (!info) return;
|
||||
sessionStorage.setItem('qbtVersion', info);
|
||||
}
|
||||
}).send();
|
||||
};
|
||||
fetchQbtVersion();
|
||||
|
||||
const qbtVersion = function() {
|
||||
const version = sessionStorage.getItem('qbtVersion');
|
||||
if (!version)
|
||||
return '';
|
||||
return version;
|
||||
};
|
||||
|
||||
window.addEvent('load', function() {
|
||||
|
||||
var saveColumnSizes = function() {
|
||||
@ -454,11 +473,11 @@ window.addEvent('load', function() {
|
||||
transfer_info += " (" + friendlyUnit(serverState.up_info_data, false) + ")";
|
||||
$("UpInfos").set('html', transfer_info);
|
||||
if (speedInTitle) {
|
||||
document.title = "QBT_TR([D: %1, U: %2] qBittorrent %3)QBT_TR[CONTEXT=MainWindow]".replace("%1", friendlyUnit(serverState.dl_info_speed, true)).replace("%2", friendlyUnit(serverState.up_info_speed, true)).replace("%3", "${VERSION}");
|
||||
document.title = "QBT_TR([D: %1, U: %2] qBittorrent %3)QBT_TR[CONTEXT=MainWindow]".replace("%1", friendlyUnit(serverState.dl_info_speed, true)).replace("%2", friendlyUnit(serverState.up_info_speed, true)).replace("%3", qbtVersion());
|
||||
document.title += " QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]";
|
||||
}
|
||||
else
|
||||
document.title = "qBittorrent ${VERSION} QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]";
|
||||
document.title = ("qBittorrent " + qbtVersion() + " QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]");
|
||||
$('freeSpaceOnDisk').set('html', 'QBT_TR(Free space: %1)QBT_TR[CONTEXT=HttpServer]'.replace("%1", friendlyUnit(serverState.free_space_on_disk)));
|
||||
$('DHTNodes').set('html', 'QBT_TR(DHT: %1 nodes)QBT_TR[CONTEXT=StatusBar]'.replace("%1", serverState.dht_nodes));
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(Set location)QBT_TR[CONTEXT=HttpServer]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${VERSION}"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDialog]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${VERSION}"></script>
|
||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(Upload local torrent)QBT_TR[CONTEXT=HttpServer]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/Window.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/Window.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/download.js?v=${VERSION}"></script>
|
||||
<script src="scripts/download.js?v=${CACHEID}"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -4,11 +4,11 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>QBT_TR(Torrent Upload Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]</title>
|
||||
<link rel="stylesheet" href="css/style.css?v=${VERSION}" type="text/css" />
|
||||
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
|
||||
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
|
||||
<script src="scripts/lib/mootools-1.2-more.js"></script>
|
||||
<script src="scripts/lib/mocha-0.9.6-yc.js"></script>
|
||||
<script src="scripts/speedslider.js?v=${VERSION}"></script>
|
||||
<script src="scripts/speedslider.js?v=${CACHEID}"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -5,11 +5,11 @@
|
||||
<meta charset="UTF-8" />
|
||||
<title>qBittorrent QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]</title>
|
||||
<link rel="icon" type="image/png" href="images/skin/qbittorrent32.png" />
|
||||
<link rel="stylesheet" type="text/css" href="css/login.css?v=${VERSION}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/login.css?v=${CACHEID}" />
|
||||
<noscript>
|
||||
<link rel="stylesheet" type="text/css" href="css/noscript.css?v=${VERSION}" />
|
||||
<link rel="stylesheet" type="text/css" href="css/noscript.css?v=${CACHEID}" />
|
||||
</noscript>
|
||||
<script src="scripts/login.js?locale=${LANG}&v=${VERSION}"></script>
|
||||
<script src="scripts/login.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
Loading…
x
Reference in New Issue
Block a user