fix: XHR + cache-busting ?_=Date.now() чтобы исключить connection reuse
Deploy drhider / validate (push) Waiting to run
Deploy drhider / validate (push) Waiting to run
This commit is contained in:
Executable
+1800
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -20,7 +20,7 @@ if _sys_path_root not in sys.path:
|
||||
sys.path.insert(0, _sys_path_root)
|
||||
|
||||
# Версия приложения (меняется при изменениях)
|
||||
VERSION = "0.0.19"
|
||||
VERSION = "0.0.20"
|
||||
|
||||
|
||||
def create_app():
|
||||
|
||||
@@ -170,9 +170,13 @@ async function uploadFiles() {
|
||||
try {
|
||||
const t0 = performance.now();
|
||||
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();
|
||||
xhr.open('POST', '/api/upload');
|
||||
xhr.timeout = 30000; // 30 сек — не висеть бесконечно
|
||||
xhr.open('POST', url);
|
||||
xhr.timeout = 30000;
|
||||
xhr.upload.onprogress = function(e) {
|
||||
if (e.lengthComputable) {
|
||||
const pct = Math.round(e.loaded / e.total * 100);
|
||||
@@ -197,9 +201,6 @@ async function uploadFiles() {
|
||||
};
|
||||
xhr.onerror = function() { reject(new Error('Сеть')); };
|
||||
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);
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user