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

Function isFolderEncrypted

public/js/fileEditor.js:187–209  ·  view source on GitHub ↗
(folder, sourceId = '')

Source from the content-addressed store, hash-verified

185// Folder encryption check (used to bypass ONLYOFFICE in encrypted folders)
186const __folderEncryptedCache = new Map(); // folder -> Promise<bool>
187async function isFolderEncrypted(folder, sourceId = '') {
188 const f = (!folder || folder === '') ? 'root' : String(folder);
189 const sid = normalizeSourceId(sourceId);
190 const key = sid ? `${sid}::${f}` : f;
191 if (__folderEncryptedCache.has(key)) return __folderEncryptedCache.get(key);
192 const p = (async () => {
193 try {
194 const params = new URLSearchParams({
195 folder: f,
196 t: String(Date.now())
197 });
198 if (sid) params.set('sourceId', sid);
199 const r = await fetch(withBase(`/api/folder/capabilities.php?${params.toString()}`), { credentials: 'include' });
200 if (!r.ok) return false;
201 const j = await r.json().catch(() => null);
202 return !!(j && j.encryption && j.encryption.encrypted);
203 } catch (e) {
204 return false;
205 }
206 })();
207 __folderEncryptedCache.set(key, p);
208 return p;
209}
210
211// ---- script/css single-load with timeout guards ----
212const _loadedScripts = new Set();

Callers 1

editFileFunction · 0.85

Calls 4

withBaseFunction · 0.85
setMethod · 0.80
normalizeSourceIdFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected