mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 05:13:30 -07:00
WebUI: keep client session from expiring
This commit is contained in:
parent
50d60b9589
commit
851defd937
1 changed files with 14 additions and 4 deletions
|
@ -73,7 +73,11 @@ window.qBittorrent.Client ??= (() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSyncMainDataInterval = () => {
|
const getSyncMainDataInterval = () => {
|
||||||
return customSyncMainDataInterval ? customSyncMainDataInterval : serverSyncMainDataInterval;
|
return document.hidden
|
||||||
|
? window.qBittorrent.Cache.preferences.get().web_ui_session_timeout * 500
|
||||||
|
: customSyncMainDataInterval
|
||||||
|
? customSyncMainDataInterval
|
||||||
|
: serverSyncMainDataInterval;
|
||||||
};
|
};
|
||||||
|
|
||||||
let stopped = false;
|
let stopped = false;
|
||||||
|
@ -779,8 +783,6 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||||
let syncMainDataTimeoutID = -1;
|
let syncMainDataTimeoutID = -1;
|
||||||
let syncRequestInProgress = false;
|
let syncRequestInProgress = false;
|
||||||
const syncMainData = () => {
|
const syncMainData = () => {
|
||||||
if (document.hidden)
|
|
||||||
return;
|
|
||||||
syncRequestInProgress = true;
|
syncRequestInProgress = true;
|
||||||
const url = new URL("api/v2/sync/maindata", window.location);
|
const url = new URL("api/v2/sync/maindata", window.location);
|
||||||
url.search = new URLSearchParams({
|
url.search = new URLSearchParams({
|
||||||
|
@ -956,6 +958,10 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||||
if (fullUpdate)
|
if (fullUpdate)
|
||||||
// re-select previously selected rows
|
// re-select previously selected rows
|
||||||
torrentsTable.reselectRows(torrentsTableSelectedRows);
|
torrentsTable.reselectRows(torrentsTableSelectedRows);
|
||||||
|
} else if (response.status == 403) {
|
||||||
|
const errorDiv = document.getElementById("error_div");
|
||||||
|
if (errorDiv)
|
||||||
|
errorDiv.textContent = "QBT_TR(You've been logged out)QBT_TR[CONTEXT=HttpServer]";
|
||||||
}
|
}
|
||||||
|
|
||||||
syncRequestInProgress = false;
|
syncRequestInProgress = false;
|
||||||
|
@ -966,7 +972,11 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||||
if (errorDiv)
|
if (errorDiv)
|
||||||
errorDiv.textContent = "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]";
|
errorDiv.textContent = "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]";
|
||||||
syncRequestInProgress = false;
|
syncRequestInProgress = false;
|
||||||
syncData(2000);
|
syncData(
|
||||||
|
document.hidden
|
||||||
|
? window.qBittorrent.Cache.preferences.get().web_ui_session_timeout * 500
|
||||||
|
: 2000
|
||||||
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue