fix: sync CSS classes with refactored layout, restore missing sidebar items, add asset versioning, fix routes and auth

This commit is contained in:
2026-06-14 08:54:37 -04:00
parent c9ab2ca98b
commit d1da560764
31 changed files with 230 additions and 245 deletions

View File

@@ -1,5 +1,4 @@
<?php
$user = $user ?? null;
$notifications = $notifications ?? [];
$unreadCount = $unreadCount ?? 0;
$teamId = $teamId ?? null;
@@ -7,6 +6,10 @@ $title = $title ?? 'ServerManager';
$content = $content ?? '';
$currentRoute = $_SERVER['REQUEST_URI'] ?? '/';
if (!isset($user) || $user === null) {
$user = auth();
}
?>
<!DOCTYPE html>
<html lang="en">
@@ -16,7 +19,7 @@ $currentRoute = $_SERVER['REQUEST_URI'] ?? '/';
<title><?= htmlspecialchars($title) ?> — ServerManager</title>
<meta name="api-token" content="<?= htmlspecialchars($user['api_token'] ?? '') ?>">
<meta name="csrf-token" content="<?= $this->csrfToken() ?>">
<link rel="stylesheet" href="/assets/css/style.css">
<link rel="stylesheet" href="/assets/css/style.css?v=<?= asset_version() ?>">
<link rel="icon" type="image/svg+xml" href="/assets/img/server.svg">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -41,6 +44,12 @@ $currentRoute = $_SERVER['REQUEST_URI'] ?? '/';
<span>Dashboard</span>
</a>
<!-- Notifications -->
<a href="/notifications" class="nav-item <?= str_starts_with($currentRoute, '/notifications') ? 'active' : '' ?>">
<i class="fas fa-bell"></i>
<span>Notifications</span>
</a>
<!-- Servers -->
<div class="nav-item-accordion <?= str_starts_with($currentRoute, '/servers') || str_starts_with($currentRoute, '/terminal') ? 'expanded' : '' ?>">
<a href="#" class="nav-item nav-item-toggle <?= str_starts_with($currentRoute, '/servers') ? 'active' : '' ?>" onclick="toggleServerList(event)">
@@ -53,41 +62,80 @@ $currentRoute = $_SERVER['REQUEST_URI'] ?? '/';
</div>
</div>
<!-- Teams -->
<!-- Administration -->
<?php if (is_super_admin()): ?>
<hr class="nav-divider">
<div class="nav-section">Administration</div>
<a href="/teams" class="nav-item <?= str_starts_with($currentRoute, '/teams') ? 'active' : '' ?>">
<i class="fas fa-users"></i>
<i class="fas fa-users-cog"></i>
<span>Teams</span>
</a>
<!-- Activity Log (admin+) -->
<?php if (is_admin() || is_super_admin()): ?>
<a href="/admin/activity" class="nav-item <?= str_starts_with($currentRoute, '/admin/activity') ? 'active' : '' ?>">
<a href="/admin/users" class="nav-item <?= str_starts_with($currentRoute, '/admin/users') ? 'active' : '' ?>">
<i class="fas fa-users"></i>
<span>Users</span>
</a>
<a href="/admin/audit" class="nav-item <?= str_starts_with($currentRoute, '/admin/audit') ? 'active' : '' ?>">
<i class="fas fa-history"></i>
<span>Activity Log</span>
<span>Audit Logs</span>
</a>
<?php endif; ?>
<!-- Admin panel (admin+) -->
<?php if (is_admin() || is_super_admin()): ?>
<a href="/admin" class="nav-item <?= str_starts_with($currentRoute, '/admin') ? 'active' : '' ?>">
<i class="fas fa-cog"></i>
<span>Administration</span>
<a href="/admin/security" class="nav-item <?= str_starts_with($currentRoute, '/admin/security') ? 'active' : '' ?>">
<i class="fas fa-shield-alt"></i>
<span>Security</span>
</a>
<?php endif; ?>
<a href="/admin/app-version" class="nav-item <?= str_starts_with($currentRoute, '/admin/app-version') ? 'active' : '' ?>">
<i class="fas fa-mobile-alt"></i>
<span>App Version</span>
</a>
<a href="/admin/notifications" class="nav-item <?= str_starts_with($currentRoute, '/admin/notifications') ? 'active' : '' ?>">
<i class="fas fa-bell"></i>
<span>Notifications</span>
</a>
<a href="/admin/policies" class="nav-item <?= str_starts_with($currentRoute, '/admin/policies') ? 'active' : '' ?>">
<i class="fas fa-file-contract"></i>
<span>Policies</span>
</a>
<?php elseif (is_admin()): ?>
<hr class="nav-divider">
<div class="nav-section">Administration</div>
<!-- Account -->
<a href="/account" class="nav-item <?= str_starts_with($currentRoute, '/account') ? 'active' : '' ?>">
<i class="fas fa-user"></i>
<span>My Account</span>
<a href="/teams" class="nav-item <?= str_starts_with($currentRoute, '/teams') ? 'active' : '' ?>">
<i class="fas fa-users-cog"></i>
<span>Teams</span>
</a>
<?php endif; ?>
<a href="/logout" class="nav-item nav-item-danger">
<i class="fas fa-sign-out-alt"></i>
<span>Log out</span>
<!-- Mobile -->
<hr class="nav-divider">
<div class="nav-section">Mobile</div>
<a href="/sysadmin.apk" class="nav-item" download>
<i class="fas fa-download"></i>
<span>Download APK</span>
</a>
</nav>
<div class="sidebar-footer">
<div class="user-info">
<div class="user-avatar"><?= strtoupper(substr($user['username'] ?? '?', 0, 2)) ?></div>
<div class="user-details">
<span class="user-name"><?= htmlspecialchars($user['username'] ?? 'Guest') ?></span>
<span class="user-role"><?= htmlspecialchars(ucfirst(str_replace('_', ' ', $user['role'] ?? 'guest'))) ?></span>
</div>
<div class="user-menu">
<a href="/profile" title="Profile"><i class="fas fa-user-cog"></i></a>
<form method="POST" action="/logout" class="logout-form" style="display:inline">
<input type="hidden" name="_csrf_token" value="<?= $this->csrfToken() ?>">
<button type="submit" title="Logout" style="background:none;border:none;color:inherit;cursor:pointer;padding:0;font:inherit;line-height:1"><i class="fas fa-sign-out-alt"></i></button>
</form>
</div>
</div>
</div>
</aside>
<!-- Main Content -->
@@ -153,12 +201,12 @@ $currentRoute = $_SERVER['REQUEST_URI'] ?? '/';
<div id="toastContainer" class="toast-container"></div>
<script src="/assets/js/app.js"></script>
<script src="/assets/js/app.js?v=<?= asset_version() ?>"></script>
<?php if (isset($scripts)): ?>
<?php foreach ($scripts as $script): ?>
<script src="<?= htmlspecialchars($script) ?>"></script>
<?php endforeach; ?>
<?php endif; ?>
<script src="/assets/js/main.js"></script>
<script src="/assets/js/main.js?v=<?= asset_version() ?>"></script>
</body>
</html>