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

Function fetchOnlyOfficeCapsOnce

public/js/fileEditor.js:79–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77let __ooCaps = { enabled: false, exts: new Set(), fetched: false, docsOrigin: null };
78
79async function fetchOnlyOfficeCapsOnce() {
80 if (__ooCaps.fetched) return __ooCaps;
81 try {
82 const r = await fetch('/api/onlyoffice/status.php', { credentials: 'include' });
83 if (r.ok) {
84 const j = await r.json();
85 __ooCaps.enabled = !!j.enabled;
86 __ooCaps.exts = new Set(Array.isArray(j.exts) ? j.exts : []);
87 __ooCaps.docsOrigin = j.docsOrigin || null; // harmless if server doesn't send it
88 }
89 } catch (e) { /* ignore; keep defaults */ }
90 __ooCaps.fetched = true;
91 return __ooCaps;
92}
93
94async function shouldUseOnlyOffice(fileName) {
95 const { enabled, exts } = await fetchOnlyOfficeCapsOnce();

Callers 1

shouldUseOnlyOfficeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected