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

Function loadPublicAiConfig

public/js/folderShareModal.js:13–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11}
12
13async function loadPublicAiConfig() {
14 if (window.__FR_IS_PRO !== true) {
15 return { enabled: false };
16 }
17 if (publicAiConfigPromise) {
18 return publicAiConfigPromise;
19 }
20 publicAiConfigPromise = fetch(withBase('/api/pro/ai/config/public.php'), {
21 method: 'GET',
22 credentials: 'include',
23 headers: {
24 Accept: 'application/json'
25 }
26 })
27 .then(async (res) => {
28 const raw = await res.text();
29 let data = {};
30 try {
31 data = JSON.parse(raw || '{}');
32 } catch (e) {
33 data = {};
34 }
35 const settings = (data && data.settings && typeof data.settings === 'object') ? data.settings : {};
36 const providers = Array.isArray(settings.providers) ? settings.providers : [];
37 return {
38 enabled: !!settings.chatEnabled && providers.length > 0
39 };
40 })
41 .catch(() => ({ enabled: false }));
42 return publicAiConfigPromise;
43}
44
45async function copyTextToClipboard(text) {
46 if (navigator.clipboard && window.isSecureContext) {

Callers 1

openFolderShareModalFunction · 0.70

Calls 1

withBaseFunction · 0.85

Tested by

no test coverage detected