fix: XHR + cache-busting ?_=Date.now() чтобы исключить connection reuse
Deploy drhider / validate (push) Waiting to run

This commit is contained in:
2026-07-14 10:31:26 +04:00
parent b6dac6f2bd
commit 0ceaee1089
3 changed files with 1807 additions and 6 deletions
+1800
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -20,7 +20,7 @@ if _sys_path_root not in sys.path:
sys.path.insert(0, _sys_path_root) sys.path.insert(0, _sys_path_root)
# Версия приложения (меняется при изменениях) # Версия приложения (меняется при изменениях)
VERSION = "0.0.19" VERSION = "0.0.20"
def create_app(): def create_app():
+6 -5
View File
@@ -170,9 +170,13 @@ async function uploadFiles() {
try { try {
const t0 = performance.now(); const t0 = performance.now();
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
const fd = new FormData();
fd.append('files', f, f.name);
if (currentSid) fd.append('session', currentSid);
const url = '/api/upload?_=' + Date.now();
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
xhr.open('POST', '/api/upload'); xhr.open('POST', url);
xhr.timeout = 30000; // 30 сек — не висеть бесконечно xhr.timeout = 30000;
xhr.upload.onprogress = function(e) { xhr.upload.onprogress = function(e) {
if (e.lengthComputable) { if (e.lengthComputable) {
const pct = Math.round(e.loaded / e.total * 100); const pct = Math.round(e.loaded / e.total * 100);
@@ -197,9 +201,6 @@ async function uploadFiles() {
}; };
xhr.onerror = function() { reject(new Error('Сеть')); }; xhr.onerror = function() { reject(new Error('Сеть')); };
xhr.ontimeout = function() { reject(new Error('Таймаут 30с')); }; xhr.ontimeout = function() { reject(new Error('Таймаут 30с')); };
const fd = new FormData();
fd.append('files', f, f.name);
if (currentSid) fd.append('session', currentSid);
xhr.send(fd); xhr.send(fd);
}); });
} catch (err) { } catch (err) {