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

Function openAdminPanel

public/js/adminPanel.js:6739–9698  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6737}
6738
6739export function openAdminPanel() {
6740 fetch("/api/admin/getConfig.php", { credentials: "include" })
6741 .then(r => r.json())
6742 .then(config => {
6743 const rawHeaderTitle = (typeof config.header_title === 'string') ? config.header_title : '';
6744 window.headerTitle = rawHeaderTitle;
6745 window.currentOIDCConfig = window.currentOIDCConfig || {};
6746
6747 if (config.oidc && typeof config.oidc === 'object') {
6748 Object.assign(window.currentOIDCConfig, config.oidc);
6749 }
6750
6751 if (config.globalOtpauthUrl) {
6752 window.currentOIDCConfig.globalOtpauthUrl = config.globalOtpauthUrl;
6753 }
6754
6755 const dark = document.body.classList.contains("dark-mode");
6756 const proInfo = config.pro || {};
6757 const isPro = !!proInfo.active;
6758 window.__FR_IS_PRO = isPro;
6759 const headerDisplayTitle = resolveHeaderTitle(rawHeaderTitle, isPro);
6760 const h = document.querySelector(".header-title h1");
6761 if (h) h.textContent = headerDisplayTitle;
6762 document.title = headerDisplayTitle;
6763 const proType = proInfo.type || '';
6764 const proEmail = proInfo.email || '';
6765 const proVersion = proInfo.version || 'not installed';
6766 const proApiLevel = Number(proInfo.apiLevel || 0);
6767 const proBuildEpoch = Number(proInfo.buildEpoch || 0);
6768 const proSearchApiOk = isPro && proApiLevel >= PRO_API_LEVELS.search;
6769 const proAuditApiOk = isPro && proApiLevel >= PRO_API_LEVELS.audit;
6770 const proSourcesApiOk = isPro && proApiLevel >= PRO_API_LEVELS.sources;
6771 const proSearchOptOut = !!(config.proSearch && config.proSearch.optOut);
6772 const proLicense = proInfo.license || '';
6773 // New: richer license metadata from FR_PRO_INFO / backend
6774 const proPlan = proInfo.plan || ''; // e.g. "early_supporter_1x", "personal_yearly"
6775 const proUpdatesUntil = proInfo.updatesUntil || proInfo.expiresAt || ''; // ISO timestamp string or ""
6776 const proInstanceId = proInfo.instanceId || '';
6777 const proBundleLegacy = !!proInfo.bundleLegacy;
6778 const proBundleLegacyFiles = Array.isArray(proInfo.bundleLegacyFiles)
6779 ? proInfo.bundleLegacyFiles
6780 : [];
6781 const proPrimaryAdmin = Object.prototype.hasOwnProperty.call(proInfo, 'primaryAdmin')
6782 ? !!proInfo.primaryAdmin
6783 : true;
6784 const proMaxMajor = (
6785 typeof proInfo.maxMajor === 'number'
6786 ? proInfo.maxMajor
6787 : (proInfo.maxMajor ? Number(proInfo.maxMajor) : null)
6788 );
6789 const proSearchCfg = (config.proSearch && typeof config.proSearch === 'object')
6790 ? config.proSearch
6791 : {};
6792 const updatesExpired = (() => {
6793 if (proPlan === 'early_supporter_1x' || (!proPlan && isPro)) {
6794 return false;
6795 }
6796 if (!proUpdatesUntil) {

Callers 1

updateAuthenticatedUIFunction · 0.85

Calls 15

buildSectionLabelHtmlFunction · 0.85
tFunction · 0.85
getAdminTitleFunction · 0.85
wireAdminPanelSearchFunction · 0.85
toggleSectionFunction · 0.85
initSourcesSectionFunction · 0.85
initGatewaysSectionFunction · 0.85
openAdminUserHubModalFunction · 0.85
openUserPermissionsModalFunction · 0.85
openUserGroupsModalFunction · 0.85
openClientPortalsModalFunction · 0.85
escapeHTMLFunction · 0.85

Tested by

no test coverage detected