Remove VM upload layer; keep file picker only

This commit is contained in:
“Naeel”
2026-09-05 09:23:13 +03:00
parent c0b87880ae
commit 85605fe8c6
20 changed files with 1 additions and 405 deletions
-19
View File
@@ -1,19 +0,0 @@
export function putToVm(file, url, options = {}) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open('PUT', url);
xhr.timeout = options.timeoutMs || 300000;
xhr.upload.onprogress = (event) => {
if (event.lengthComputable && options.onProgress) {
options.onProgress(Math.round(event.loaded / event.total * 100));
}
};
xhr.onload = () => {
if (xhr.status >= 200 && xhr.status < 300) resolve();
else reject(new Error(`ВМ: HTTP ${xhr.status}`));
};
xhr.onerror = () => reject(new Error('Сеть (ВМ)'));
xhr.ontimeout = () => reject(new Error('Таймаут загрузки на ВМ'));
xhr.send(file);
});
}