MCPcopy Create free account
hub / github.com/error311/FileRise / fetchExistingUploads

Function fetchExistingUploads

public/js/upload.js:707–731  ·  view source on GitHub ↗
(payload, retry = true)

Source from the content-addressed store, hash-verified

705}
706
707async function fetchExistingUploads(payload, retry = true) {
708 try {
709 const res = await fetch(CHECK_EXISTING_URL, {
710 method: 'POST',
711 credentials: 'include',
712 headers: {
713 'Content-Type': 'application/json',
714 'X-CSRF-Token': window.csrfToken || ''
715 },
716 body: JSON.stringify(payload)
717 });
718 const data = await res.json().catch(() => null);
719 if (data && data.csrf_expired && data.csrf_token && retry) {
720 window.csrfToken = data.csrf_token;
721 return fetchExistingUploads(payload, false);
722 }
723 if (!res.ok || !data || typeof data !== 'object' || data.error) {
724 return null;
725 }
726 return data;
727 } catch (e) {
728 console.warn('Upload existence check failed:', e);
729 return null;
730 }
731}
732
733async function filterExistingUploads(files) {
734 const result = { files, autoStart: false };

Callers 1

filterExistingUploadsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected