Deleted incoming host logic

This commit is contained in:
2026-07-19 23:17:51 +09:00
parent f093d41f60
commit 9bd3272846
8 changed files with 3 additions and 105 deletions
+2 -38
View File
@@ -28,10 +28,6 @@ async function request(path, options = {}) {
return data;
}
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
export function getHealth() {
return request("/api/health");
}
@@ -51,25 +47,6 @@ export function createJob(formData) {
});
}
/** Try to stage a file that already exists on the server incoming mount. */
export async function resolveUpload(mailbox, filename, sizeBytes) {
const form = new FormData();
form.append("mailbox", mailbox);
form.append("filename", filename);
form.append("size_bytes", String(sizeBytes));
const response = await fetch(`${API_BASE}/api/uploads/resolve`, {
method: "POST",
body: form,
});
if (response.status === 404) return null;
const text = await response.text();
const data = text ? JSON.parse(text) : {};
if (!response.ok) {
throw new Error(data.detail || "resolve_failed");
}
return data;
}
/** Upload zip with progress via XHR. */
export function uploadZip(file, mailbox, onProgress) {
return new Promise((resolve, reject) => {
@@ -109,21 +86,8 @@ export function uploadZip(file, mailbox, onProgress) {
});
}
/**
* Stage a mailbox zip:
* 1) resolve against server incoming mount (no re-upload)
* 2) otherwise upload with real progress
*/
export async function stageMailboxZip(file, mailbox, onProgress) {
onProgress?.(2);
const resolved = await resolveUpload(mailbox, file.name, file.size);
if (resolved) {
for (const pct of [25, 55, 80, 100]) {
onProgress?.(pct);
await sleep(70);
}
return resolved;
}
/** Stage a mailbox zip by uploading it to the server. */
export function stageMailboxZip(file, mailbox, onProgress) {
return uploadZip(file, mailbox, onProgress);
}