refactor: extract inline CSS/JS from views into separate asset files (20+ files)

Phase A — HTML removed from PHP files:
- RateLimitMiddleware.php: heredoc moved to views/errors/429.php
- public/index.php: inline HTML replaced with View::error()
- AuthMiddleware.php: <script> redirect replaced with <meta refresh>

Phase B — Inline CSS/JS extracted from views:
- CSS: landing.css (459 lines), legal.css (shared by terms+privacy)
- JS: 17 new files extracted from ~20 view files
  - main.js (layout sidebar + notifications)
  - dashboard-chart.js, server-show.js, server-services.js
  - nginx-manager.js, database-manager.js
  - terminal.js, team-show.js, team-index.js
  - server-list.js, server-permissions.js (shared by edit+create)
  - server-ssl.js, server-processes.js, system-users.js
  - admin-users.js, audit-log.js, admin-notifications.js, admin-security.js
  - notifications.js

Total: -3264 lines from views, +288 lines in new assets
This commit is contained in:
2026-06-14 08:04:01 -04:00
parent 142fe304c9
commit 88f3c1f964
51 changed files with 3152 additions and 3269 deletions

View File

@@ -1,24 +1,4 @@
<style>
body.auth-page {
display: block;
align-items: unset;
justify-content: unset;
min-height: 100vh;
}
body.auth-page .auth-container {
max-width: none;
width: 100%;
padding: 0;
}
@media (max-width:768px) {
.legal-container .legal-card { width: 92% !important; padding: 1.5rem !important; }
}
@media (max-width:480px) {
.legal-container .legal-card { width: 96% !important; padding: 1rem !important; }
}
</style>
<?php ?><link rel="stylesheet" href="/assets/css/legal.css">
<div class="legal-page">
<div class="legal-container">
<div class="legal-card" style="width:85%;margin:3rem auto;padding:3rem 3.5rem;background:var(--card-bg);border-radius:12px;box-shadow:0 2px 16px rgba(0,0,0,0.18)">
@@ -29,24 +9,19 @@ body.auth-page .auth-container {
<?php
$lines = explode("\n", $content ?? '');
foreach ($lines as $line) {
$line = htmlspecialchars($line);
if (preg_match('/^[A-Z][A-Z\s]+$/', trim($line))) {
echo '<h2 style="color:var(--accent-primary);font-size:1.2rem;margin:2rem 0 1rem;font-weight:600">' . $line . '</h2>';
} elseif (preg_match('/^[a-z]\)\s/', trim($line))) {
echo '<p style="margin:0.4rem 0 0.4rem 2rem">' . $line . '</p>';
} elseif (preg_match('/^\d+\./', trim($line))) {
echo '<h3 style="color:var(--text-primary);font-size:1rem;margin:1.2rem 0 0.5rem;font-weight:600">' . $line . '</h3>';
} elseif (trim($line) === '') {
echo '<div style="height:0.5rem"></div>';
$trimmed = trim($line);
if ($trimmed === '') {
echo '<br>';
} elseif (str_starts_with($trimmed, '# ')) {
echo '<h2 style="margin:2rem 0 0.75rem;font-size:1.2rem;font-weight:600;color:var(--text-primary)">' . htmlspecialchars(substr($trimmed, 2)) . '</h2>';
} elseif (str_starts_with($trimmed, '## ')) {
echo '<h3 style="margin:1.5rem 0 0.5rem;font-size:1.05rem;font-weight:600;color:var(--text-primary)">' . htmlspecialchars(substr($trimmed, 3)) . '</h3>';
} else {
echo '<p style="margin:0.4rem 0">' . $line . '</p>';
echo '<p style="margin-bottom:0.75rem">' . htmlspecialchars($trimmed) . '</p>';
}
}
?>
</div>
<div class="legal-footer" style="margin-top:2.5rem;padding-top:1.5rem;border-top:1px solid var(--border-color);text-align:center">
<p><a href="/" style="color:var(--accent-primary);text-decoration:none;font-size:0.95rem">&larr; Back to ServerManager</a></p>
</div>
</div>
</div>
</div>