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

Function createAuthFileLink

public/js/fileLink.js:84–105  ·  view source on GitHub ↗
(folder, file, sourceId = '')

Source from the content-addressed store, hash-verified

82}
83
84async function createAuthFileLink(folder, file, sourceId = '') {
85 const resp = await fetch(withBase('/api/file/createAuthFileLink.php'), {
86 method: 'POST',
87 credentials: 'include',
88 headers: {
89 'Content-Type': 'application/json',
90 'X-CSRF-Token': window.csrfToken || '',
91 'Accept': 'application/json',
92 },
93 body: JSON.stringify({
94 folder,
95 file,
96 sourceId: String(sourceId || '').trim(),
97 }),
98 });
99
100 const data = await resp.json().catch(() => ({}));
101 if (!resp.ok || !data || data.ok !== true) {
102 throw new Error((data && (data.error || data.message)) || `HTTP ${resp.status}`);
103 }
104 return data;
105}
106
107export async function openFileLinkModal(fileObj, folder) {
108 const fileName = String(fileObj?.name || '').trim();

Callers 1

openFileLinkModalFunction · 0.85

Calls 1

withBaseFunction · 0.85

Tested by

no test coverage detected