Browse Source

Merge pull request #10504 from Chocobo1/public

Misc improvements in WebUI
adaptive-webui-19844
Mike Tzou 6 years ago committed by GitHub
parent
commit
6435e994f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/webui/webapplication.cpp
  2. 1
      src/webui/webapplication.h
  3. 6
      src/webui/www/private/about.html
  4. 2
      src/webui/www/private/addtrackers.html
  5. 2
      src/webui/www/private/confirmdeletion.html
  6. 8
      src/webui/www/private/download.html
  7. 4
      src/webui/www/private/downloadlimit.html
  8. 2
      src/webui/www/private/edittracker.html
  9. 28
      src/webui/www/private/index.html
  10. 4
      src/webui/www/private/newcategory.html
  11. 4
      src/webui/www/private/preferences.html
  12. 4
      src/webui/www/private/rename.html
  13. 23
      src/webui/www/private/scripts/client.js
  14. 2
      src/webui/www/private/scripts/mocha-init.js
  15. 4
      src/webui/www/private/setlocation.html
  16. 4
      src/webui/www/private/shareratio.html
  17. 6
      src/webui/www/private/upload.html
  18. 4
      src/webui/www/private/uploadlimit.html
  19. 4
      src/webui/www/public/css/login.css
  20. 6
      src/webui/www/public/index.html

3
src/webui/webapplication.cpp

@ -117,6 +117,7 @@ namespace @@ -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) @@ -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);
}
}

1
src/webui/webapplication.h

@ -127,6 +127,7 @@ private: @@ -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]*)$"))};

6
src/webui/www/private/about.html

@ -1,6 +1,6 @@ @@ -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 @@ @@ -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',

2
src/webui/www/private/addtrackers.html

@ -4,7 +4,7 @@ @@ -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>

2
src/webui/www/private/confirmdeletion.html

@ -4,7 +4,7 @@ @@ -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>

8
src/webui/www/private/download.html

@ -4,12 +4,12 @@ @@ -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
src/webui/www/private/downloadlimit.html

@ -4,11 +4,11 @@ @@ -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>

2
src/webui/www/private/edittracker.html

@ -4,7 +4,7 @@ @@ -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>

28
src/webui/www/private/index.html

@ -4,28 +4,28 @@ @@ -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
src/webui/www/private/newcategory.html

@ -4,10 +4,10 @@ @@ -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
src/webui/www/private/preferences.html

@ -4,8 +4,8 @@ @@ -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
src/webui/www/private/rename.html

@ -4,10 +4,10 @@ @@ -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';

23
src/webui/www/private/scripts/client.js

@ -77,6 +77,25 @@ function getSyncMainDataInterval() { @@ -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() { @@ -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));

2
src/webui/www/private/scripts/mocha-init.js

@ -788,7 +788,7 @@ var initializeWindows = function() { @@ -788,7 +788,7 @@ var initializeWindows = function() {
url: 'api/v2/auth/logout',
method: 'post',
onSuccess: function() {
window.location.reload();
window.location.reload(true);
}
}).send();
});

4
src/webui/www/private/setlocation.html

@ -4,10 +4,10 @@ @@ -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
src/webui/www/private/shareratio.html

@ -4,10 +4,10 @@ @@ -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';

6
src/webui/www/private/upload.html

@ -4,10 +4,10 @@ @@ -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
src/webui/www/private/uploadlimit.html

@ -4,11 +4,11 @@ @@ -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>

4
src/webui/www/public/css/login.css

@ -32,6 +32,10 @@ body { @@ -32,6 +32,10 @@ body {
color: #f00;
}
#login {
float: right;
}
#logo img {
height: 11em;
}

6
src/webui/www/public/index.html

@ -5,11 +5,11 @@ @@ -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…
Cancel
Save