/** * NovaCPX Admin Panel — page controllers */ (async () => { // ── Auth guard ───────────────────────────────────────────────────────────── const me = await Nova.api('auth', 'me'); if (!me?.success || me.data.role !== 'admin') { location.href = '/?redirect=/admin/'; return; } document.getElementById('auth-check').style.display = 'none'; document.getElementById('app').style.display = ''; document.getElementById('user-name').textContent = me.data.username; document.getElementById('user-avatar').textContent = me.data.username[0].toUpperCase(); // ── Logout ───────────────────────────────────────────────────────────────── document.getElementById('logout-btn').addEventListener('click', async e => { e.preventDefault(); await Nova.api('auth', 'logout', { method: 'POST' }); location.href = '/'; }); // ── Page definitions ─────────────────────────────────────────────────────── const pages = { dashboard, 'server-status': serverStatus, accounts, resellers, packages, 'create-account': createAccount, 'dns-zones': dnsZones, nameservers, 'web-server': webServer, 'php-manager': phpManager, 'mysql-manager': mysqlManager, 'mail-server': mailServer, 'ftp-server': ftpServer, 'ssl-manager': sslManager, firewall, 'audit-log': auditLog, updates, backups, settings, }; Nova.initNav(pages); await Nova.loadPage('dashboard', pages); checkUpdates(); // ── Dashboard ────────────────────────────────────────────────────────────── async function dashboard() { const [stats, version] = await Promise.all([ Nova.api('system', 'stats'), Nova.api('system', 'version'), ]); const s = stats?.data || {}; const v = version?.data || {}; document.getElementById('server-ip').textContent = ''; return `
| ${Nova.serviceDot(status)} ${svc} | ${Nova.badge(status, status === 'active' ? 'green' : 'red')} |
| Installed | ${v.installed_version || '—'} |
| Branch | ${v.git_branch || 'main'} |
| Commit | ${v.git_commit || '—'}${v.git_dirty ? ' dirty' : ''} |
| PHP | ${v.php_version || '—'} |
| OS | ${v.os || '—'} |
CPU
RAM
Disk
Load Average
${(s.cpu?.load||[]).join(' / ')}
Uptime
${s.uptime}
Installed Version
${v.installed_version}
Git Commit
${v.git_commit || '—'}Branch
${v.git_branch || 'main'}Dirty Working Tree
${v.git_dirty ? Nova.badge('Yes','yellow') : Nova.badge('No','green')}
NovaCPX is up to date.
`}| Time | User | Action | Resource | IP |
|---|---|---|---|---|
| ${Nova.relTime(r.created_at)} | ${r.username || '—'} | ${r.action} |
${r.resource || '—'} | ${r.ip_address || '—'} |
Manage installed PHP versions and global extensions.
Extensions installed across all PHP versions: mbstring, curl, gd, xml, zip, opcache, redis, imagick, pdo, pdo_mysql, pdo_pgsql
${desc}