From 6e1e7a45a1080e434ad2cba17d2cac2f6b9aeb21 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 17 Apr 2019 13:34:32 +0800 Subject: [PATCH 1/3] Align WebUI login button to the right --- src/webui/www/public/css/login.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/webui/www/public/css/login.css b/src/webui/www/public/css/login.css index 384f092c6..0c9a5396e 100644 --- a/src/webui/www/public/css/login.css +++ b/src/webui/www/public/css/login.css @@ -32,6 +32,10 @@ body { color: #f00; } +#login { + float: right; +} + #logo img { height: 11em; } From d022457e0c5a2b4bf4cfdf745427d52b2af56c58 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 17 Apr 2019 13:42:52 +0800 Subject: [PATCH 2/3] Use force refresh on WebUI logout Regardless of the cache header settings, the logout action should never be allowed to load from cache. --- src/webui/www/private/scripts/mocha-init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/www/private/scripts/mocha-init.js b/src/webui/www/private/scripts/mocha-init.js index 6ebaefcd4..abd3701f7 100644 --- a/src/webui/www/private/scripts/mocha-init.js +++ b/src/webui/www/private/scripts/mocha-init.js @@ -788,7 +788,7 @@ var initializeWindows = function() { url: 'api/v2/auth/logout', method: 'post', onSuccess: function() { - window.location.reload(); + window.location.reload(true); } }).send(); }); From 49b57904f98f6cfd06f04daf49c46c714a71621a Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 17 Apr 2019 20:09:03 +0800 Subject: [PATCH 3/3] Use a random number for WebUI cache busting Also fetch qbt version info via WebAPI properly. --- src/webui/webapplication.cpp | 3 ++- src/webui/webapplication.h | 1 + src/webui/www/private/about.html | 6 ++++- src/webui/www/private/addtrackers.html | 2 +- src/webui/www/private/confirmdeletion.html | 2 +- src/webui/www/private/download.html | 8 +++---- src/webui/www/private/downloadlimit.html | 4 ++-- src/webui/www/private/edittracker.html | 2 +- src/webui/www/private/index.html | 28 +++++++++++----------- src/webui/www/private/newcategory.html | 4 ++-- src/webui/www/private/preferences.html | 4 ++-- src/webui/www/private/rename.html | 4 ++-- src/webui/www/private/scripts/client.js | 23 ++++++++++++++++-- src/webui/www/private/setlocation.html | 4 ++-- src/webui/www/private/shareratio.html | 4 ++-- src/webui/www/private/upload.html | 6 ++--- src/webui/www/private/uploadlimit.html | 4 ++-- src/webui/www/public/index.html | 6 ++--- 18 files changed, 70 insertions(+), 45 deletions(-) diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index a6f28b00b..ef2202b1b 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -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); } } diff --git a/src/webui/webapplication.h b/src/webui/webapplication.h index 2c3c78f5f..1c38d65b8 100644 --- a/src/webui/webapplication.h +++ b/src/webui/webapplication.h @@ -127,6 +127,7 @@ private: Http::Request m_request; Http::Environment m_env; QMap m_params; + const QString m_cacheID; const QRegularExpression m_apiPathPattern {(QLatin1String("^/api/v2/(?[A-Za-z_][A-Za-z_0-9]*)/(?[A-Za-z_][A-Za-z_0-9]*)$"))}; diff --git a/src/webui/www/private/about.html b/src/webui/www/private/about.html index 43f378b78..e2f783c12 100644 --- a/src/webui/www/private/about.html +++ b/src/webui/www/private/about.html @@ -1,6 +1,6 @@
qBittorrent Mascot -

qBittorrent ${VERSION} QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]

+

QBT_TR(An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar.)QBT_TR[CONTEXT=AboutDialog]

Copyright (c) 2011-2019 The qBittorrent project

QBT_TR(Home Page:)QBT_TR[CONTEXT=AboutDialog] https://www.qbittorrent.org

@@ -676,6 +676,10 @@ - - + + diff --git a/src/webui/www/private/downloadlimit.html b/src/webui/www/private/downloadlimit.html index aef12f5e2..926af0824 100644 --- a/src/webui/www/private/downloadlimit.html +++ b/src/webui/www/private/downloadlimit.html @@ -4,11 +4,11 @@ QBT_TR(Torrent Download Speed Limiting)QBT_TR[CONTEXT=TransferListWidget] - + - + diff --git a/src/webui/www/private/edittracker.html b/src/webui/www/private/edittracker.html index 10f575a5c..53cc2b861 100644 --- a/src/webui/www/private/edittracker.html +++ b/src/webui/www/private/edittracker.html @@ -4,7 +4,7 @@ QBT_TR(Tracker editing)QBT_TR[CONTEXT=TrackerListWidget] - + - + - - - - - + + + + + diff --git a/src/webui/www/private/newcategory.html b/src/webui/www/private/newcategory.html index 18e205c61..04dd6e447 100644 --- a/src/webui/www/private/newcategory.html +++ b/src/webui/www/private/newcategory.html @@ -4,10 +4,10 @@ QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget] - + - + diff --git a/src/webui/www/private/rename.html b/src/webui/www/private/rename.html index 4857e8388..ebc0ff618 100644 --- a/src/webui/www/private/rename.html +++ b/src/webui/www/private/rename.html @@ -4,10 +4,10 @@ QBT_TR(Rename)QBT_TR[CONTEXT=TransferListWidget] - + - + - + - + - + diff --git a/src/webui/www/private/uploadlimit.html b/src/webui/www/private/uploadlimit.html index 6c9e1f873..f4c147596 100644 --- a/src/webui/www/private/uploadlimit.html +++ b/src/webui/www/private/uploadlimit.html @@ -4,11 +4,11 @@ QBT_TR(Torrent Upload Speed Limiting)QBT_TR[CONTEXT=TransferListWidget] - + - + diff --git a/src/webui/www/public/index.html b/src/webui/www/public/index.html index cc9ce0226..8fcdd948f 100644 --- a/src/webui/www/public/index.html +++ b/src/webui/www/public/index.html @@ -5,11 +5,11 @@ qBittorrent QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog] - + - +