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

Function getFolderCapabilities

public/js/folderManager.js:469–498  ·  view source on GitHub ↗
(folder, sourceId = '')

Source from the content-addressed store, hash-verified

467window.__FR_CAPS_INFLIGHT = _capsInflight;
468
469async function getFolderCapabilities(folder, sourceId = '') {
470 if (!folder) return null;
471
472 if (_capsCache.has(folder)) {
473 return _capsCache.get(folder);
474 }
475 if (_capsInflight.has(folder)) {
476 return _capsInflight.get(folder);
477 }
478
479 const p = (async () => {
480 try {
481 const activeSourceId = sourceId || getActiveSourceId();
482 const sourceParam = activeSourceId ? `&sourceId=${encodeURIComponent(activeSourceId)}` : '';
483 const res = await fetch(`/api/folder/capabilities.php?folder=${encodeURIComponent(folder)}${sourceParam}`, { credentials: 'include' });
484 if (!res.ok) return null;
485 const caps = await res.json();
486 _capsCache.set(folder, caps || null);
487 return caps || null;
488 } catch (e) {
489 _capsCache.set(folder, null);
490 return null;
491 } finally {
492 _capsInflight.delete(folder);
493 }
494 })();
495
496 _capsInflight.set(folder, p);
497 return p;
498}
499async function applyFolderCapabilities(folder) {
500 try {
501 const caps = await getFolderCapabilities(folder);

Callers 3

applyFolderCapabilitiesFunction · 0.85
canViewFolderFunction · 0.85
loadFolderTreeFunction · 0.85

Calls 4

setMethod · 0.80
getActiveSourceIdFunction · 0.70
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected