Files
Kelx/views/status.ejs
T
antonn 78193254ad Security: fix ws-upgrade crash, per-user TOFU eviction, token log leaks; rebuild sshterm
Panel (index.js, client, views):
- upgrade handler: error guard on every upgraded socket (any path) plus a 3s
  zero-byte orphan reaper; engine.io destroyUpgrade disabled — closes the
  unauthenticated ECONNRESET crash of the whole panel and stops engine.io's
  1s timer from killing slow ssh-terminal handshakes
- /api/ssh-terminal/session: per-session token reuse cache in front of the
  rate limiter — floating-terminal auto-restore no longer burns the 10/min
  mint budget (tokens are re-served only to the same panel session + IP)
- global error middleware redacts credential-bearing query params via
  utils/url-sanitize.js — ssh-terminal ?token= values no longer reach logs
- floating-terminal restore consumes the persisted live flag: after the
  frame reported the SSH session dead, restore drops the stored session id
  and starts a clean connect; script cache busters bumped

sshterm (cmd/sshterm/main.go, rebuilt and deployed):
- TOFU store eviction is per-user and offender-pays (per-user caps: 64 pins
  and 256 contributed advisory hosts; total caps remain as backstops that
  evict the largest contributor first) — one user flooding first-use pins
  to hosts they control can no longer evict another user's pinned key or
  suppress their divergence warning
- the store file is reloaded on mtime/size change: admin edits to
  data/ssh_known_hosts.json now take effect on the next connection without
  a restart; corrupt files keep the last good state, deleted files clear
  the store, other read errors fail closed
- regression tests for flood/eviction/reload/healing + negative controls
- also lands the previously uncommitted IP-binding, trusted-proxy,
  allowed-hosts and metadata-blocking hardening; binary rebuilt through
  initialize.sh --repair-sshterm and verified live at
  /usr/local/bin/adpanel-sshterm (sha256 6bc0363479b91e6c49af9b153c8e552fd4ad8f9a5f787d73bbdc238ce0f7579e)
2026-09-23 17:50:40 +00:00

1271 lines
54 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="dashboard.css?v=<%= typeof themeVersion !== 'undefined' ? themeVersion : Date.now() %>">
<title><%= (branding && branding.appName) ? branding.appName : 'ADPanel' %></title>
<link id="favicon" rel="icon" type="image/webp"
href="<%= (branding && branding.faviconUrl) ? branding.faviconUrl : '/auth-assets/favicon' %>" />
<link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin>
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css"
integrity="sha384-nRgPTkuX86pH8yjPJUAFuASXQSSl2/bBUiNV47vSYpKFxHJhbcrGnmlYpYJMeD7a"
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="/css/dashboard.css?v=<%= typeof themeVersion !== 'undefined' ? themeVersion : Date.now() %>">
<link rel="stylesheet" href="/css/ssh-terminal-window.css?v=20260509-floating-terminal-5">
<link rel="stylesheet" href="/css/status-monitor.css?v=<%= typeof themeVersion !== 'undefined' ? themeVersion : Date.now() %>">
<style nonce="<%= cspNonce %>">
*,
*::before,
*::after {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
img,
video,
canvas {
-webkit-user-drag: none;
-khtml-user-drag: none;
-moz-user-drag: none;
-o-user-drag: none;
user-drag: none;
pointer-events: auto;
}
</style>
<style nonce="<%= cspNonce %>">
.top-bar.nav-shell {
--nav-option: clamp(40px, 5.8vh, 52px);
--nav-gap: clamp(6px, 0.7vw, 12px);
--nav-radius: 999px;
--nav-ease: cubic-bezier(0.65, 0, 0.35, 1);
--nav-idle: rgba(255, 255, 255, 0.06);
--nav-active: radial-gradient(50% 50% at 50% 50%, #009BDE 0%, #006D9C 100%);
display: flex;
flex-wrap: nowrap;
flex-direction: row;
align-items: center;
justify-content: space-between;
gap: clamp(12px, 2vw, 32px);
width: auto;
max-width: calc(100% - 40px);
min-height: 0;
padding: clamp(14px, 5vh, 20px) clamp(14px, 1.8vw, 26px);
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: var(--nav-radius);
-webkit-backdrop-filter: blur(14px) saturate(160%);
backdrop-filter: blur(14px) saturate(160%);
box-shadow: var(--shadow-md);
overflow: hidden;
}
.nav-brand {
display: flex;
flex-direction: row;
align-items: center;
gap: clamp(6px, 0.5vw, 8px);
flex: 0 0 auto;
min-width: 0;
cursor: pointer;
border-radius: 12px;
padding: 4px 8px;
margin: -4px -8px;
transition: background 0.18s ease, transform 0.18s ease;
}
.nav-brand:hover,
.nav-brand:focus-visible {
background: rgba(255, 255, 255, 0.06);
transform: translateY(-1px);
outline: none;
}
.nav-brand:active {
transform: translateY(0);
}
.nav-brand__logo {
width: clamp(42px, 6vh, 58px);
height: clamp(42px, 6vh, 58px);
object-fit: contain;
filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));
}
.nav-brand__wordmark {
font-family: 'Gilroy', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
font-weight: 500;
font-size: clamp(1.5rem, 3.4vh, 2.1rem);
line-height: 1;
letter-spacing: 0.01em;
color: #FFFFFF;
white-space: nowrap;
}
.nav-alert {
display: flex;
align-items: center;
gap: 8px;
flex: 0 1 auto;
min-width: 0;
padding: 6px 14px;
border-radius: 999px;
background: rgba(255, 100, 100, 0.1);
color: #ffcccc;
pointer-events: none;
}
.nav-alert span {
font-size: 14px;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.top-bar.nav-shell .toolbar {
flex: 0 1 auto;
min-width: 0;
gap: 0;
}
.nav-options {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
gap: var(--nav-gap);
min-width: 0;
}
.nav-options .nav-option-wrap {
display: flex;
align-items: center;
flex: none;
}
.nav-option {
order: 5;
position: relative;
flex: none;
height: var(--nav-option);
min-height: var(--nav-option);
display: inline-flex;
flex-direction: row-reverse;
align-items: center;
justify-content: center;
padding: 0;
border: none !important;
outline: none !important;
border-radius: var(--nav-radius);
background: var(--nav-idle);
color: #FFFFFF;
cursor: pointer;
overflow: hidden;
isolation: isolate;
transition:
background 0.4s var(--nav-ease),
box-shadow 0.4s var(--nav-ease),
transform 0.4s var(--nav-ease);
}
.nav-option::before {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
background: var(--nav-active);
opacity: 0;
z-index: -1;
transition: opacity 0.4s var(--nav-ease);
}
.nav-option__icon {
flex: none;
width: var(--nav-option);
height: var(--nav-option);
display: grid;
place-items: center;
}
.nav-option__icon i {
font-size: clamp(0.85rem, 1.7vh, 1.1rem);
line-height: 1;
color: #FFFFFF;
}
.nav-option__label {
display: grid;
grid-template-columns: 0fr;
min-width: 0;
overflow: hidden;
font-family: 'Gilroy', 'Manrope', system-ui, sans-serif;
font-weight: 500;
font-size: clamp(0.8rem, 1.6vh, 0.95rem);
line-height: 1;
color: #FFFFFF;
white-space: nowrap;
padding-left: 0;
transition:
grid-template-columns 0.4s var(--nav-ease),
padding-left 0.4s var(--nav-ease);
}
.nav-option__label > * {
min-width: 0;
overflow: hidden;
}
.nav-option:not(:disabled):hover,
.nav-option:not(:disabled):focus-visible {
box-shadow: 0 10px 30px rgba(0, 155, 222, 0.28);
transform: translateY(-1px);
}
.nav-option:not(:disabled):hover::before,
.nav-option:not(:disabled):focus-visible::before {
opacity: 1;
}
.nav-option:not(:disabled):hover .nav-option__label,
.nav-option:not(:disabled):focus-visible .nav-option__label {
grid-template-columns: 1fr;
padding-left: 10px;
}
.nav-option:not(:disabled):active {
transform: scale(0.97);
}
.nav-option:disabled {
cursor: not-allowed;
opacity: 0.6;
}
.nav-option--create { order: 0; }
.nav-option--account { order: 1; }
.nav-option[data-href="/settings"],
.nav-option[title="You are not admin"] { order: 2; }
#openSshTerminalBtn.nav-option { order: 3; }
.nav-option--back { order: 4; }
.top-bar.nav-shell .account-avatar-btn .nav-option__icon {
overflow: hidden;
border-radius: 50%;
}
.top-bar.nav-shell .account-avatar-btn .account-btn-avatar {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 50%;
}
.nav-option--back {
background: rgba(255, 0, 0, 0.2);
}
.nav-option--back::before {
background: radial-gradient(50% 50% at 50% 50%, #ff4d4d 0%, #b30000 100%);
}
@media (max-width: 720px) {
.nav-brand__wordmark {
display: none;
}
}
@media (max-width: 520px) {
.nav-option__label {
display: none;
}
}
</style>
<script nonce="<%= cspNonce %>">
window.__dashboardSplashImage = '/images/hello.webp';
try {
const splashKey = `dashboard-splash-cache:${window.location.origin}:${window.__dashboardSplashImage}`;
window.__dashboardSplashKey = splashKey;
if (localStorage.getItem(splashKey) === '1') {
document.documentElement.classList.add('skip-dashboard-splash');
}
} catch (_) { }
document.addEventListener('contextmenu', e => {
if (e.target && e.target.tagName === 'INPUT') return;
if (e.target && e.target.tagName === 'TEXTAREA') return;
e.preventDefault();
});
document.addEventListener('dragstart', e => e.preventDefault());
document.addEventListener('selectstart', e => {
if (e.target && e.target.tagName === 'INPUT') return;
if (e.target && e.target.tagName === 'TEXTAREA') return;
e.preventDefault();
});
document.addEventListener('copy', e => {
if (e.target && e.target.tagName === 'INPUT') return;
if (e.target && e.target.tagName === 'TEXTAREA') return;
e.preventDefault();
});
document.addEventListener('cut', e => {
if (e.target && e.target.tagName === 'INPUT') return;
if (e.target && e.target.tagName === 'TEXTAREA') return;
e.preventDefault();
});
document.addEventListener('keydown', e => {
if (e.target && e.target.tagName === 'INPUT') return;
if (e.target && e.target.tagName === 'TEXTAREA') return;
if ((e.ctrlKey || e.metaKey) && (e.key === 'c' || e.key === 'C' || e.key === 'a' || e.key === 'A' || e.key === 's' || e.key === 'S' || e.key === 'u' || e.key === 'U')) {
e.preventDefault();
}
});
</script>
</head>
<body data-server-start-time="<%= serverStartTime %>" class="skip-dashboard-splash">
<svg xmlns="http://www.w3.org/2000/svg" class="mysvg">
<defs>
<filter id="glass-distortion" x="0%" y="0%" width="100%" height="100%">
<feTurbulence type="fractalNoise" baseFrequency="0.008 0.008" numOctaves="2" seed="92" result="noise" />
<feGaussianBlur in="noise" stdDeviation="2" result="blurred" />
<feDisplacementMap in="SourceGraphic" in2="blurred" scale="77" xChannelSelector="R" yChannelSelector="G" />
</filter>
</defs>
</svg>
<header class="top-bar nav-shell" id="topBar">
<div class="nav-brand" data-href="/" role="link" tabindex="0" aria-label="Go to dashboard">
<img src="https://cdn.jsdelivr.net/gh/antonndev/ADCDn/adpanel-dark.webp" alt="ADPanel logo"
class="nav-brand__logo" />
<span class="nav-brand__wordmark">Panel</span>
</div>
<% if (typeof globalAlert !=='undefined' && globalAlert && globalAlert.message) { %>
<div class="nav-alert">
<img src="https://cdn.jsdelivr.net/gh/antonndev/ADCDn/alert.webp" width="25" height="20" alt="">
<span>
<%= globalAlert.message %>
</span>
</div>
<% } %>
<div class="toolbar">
<div class="toolbar-actions nav-options">
<button class="nav-option nav-option--back" title="Back" data-href="/">
<span class="nav-option__icon"><i class="fa-solid fa-right-from-bracket"></i></span>
<span class="nav-option__label"><span>Back</span></span>
</button>
<button class="nav-option nav-option--account account-avatar-btn"
title="Account" data-href="/#account">
<span class="nav-option__icon">
<img src="<%= avatarUrl %>" alt="Avatar" class="account-btn-avatar" draggable="false">
</span>
<span class="nav-option__label"><span>Account</span></span>
</button>
<% if (isAdmin) { %>
<button class="nav-option" title="Settings" data-href="/settings">
<span class="nav-option__icon"><i class="fa-solid fa-gear"></i></span>
<span class="nav-option__label"><span>Settings</span></span>
</button>
<% } else { %>
<button class="nav-option" title="You are not admin" disabled>
<span class="nav-option__icon"><i class="fa-solid fa-lock"></i></span>
<span class="nav-option__label"><span>Locked</span></span>
</button>
<% } %>
<button id="openSshTerminalBtn" class="nav-option ssh-terminal-btn"
title="Open SSH Terminal">
<span class="nav-option__icon"><i class="fa-solid fa-terminal"></i></span>
<span class="nav-option__label"><span>Terminal</span></span>
</button>
<% if (isAdmin) { %>
<button id="createBtn" class="nav-option nav-option--create" title="Create">
<span class="nav-option__icon"><i class="fa-solid fa-plus"></i></span>
<span class="nav-option__label"><span>Create</span></span>
</button>
<% } %>
</div>
</div>
</header>
<div id="topbar-spacer" aria-hidden="true"></div>
<main class="dashboard" id="mainContent">
<section class="monitor">
<div class="monitor-head">
<div>
<h2>System Status</h2>
<p>Real-time metrics and performance insights</p>
</div>
<div class="monitor-head__meta">
<span class="monitor-chip"><i class="fa-solid fa-server"></i><%= bots.length %></span>
<span class="monitor-chip"><i class="fa-solid fa-code-branch"></i><span id="svcVersion"><%= (typeof panelVersion !== 'undefined' && panelVersion) ? panelVersion : '—' %></span></span>
</div>
</div>
<!-- Metrics Grid -->
<div class="metrics-hero">
<div class="metric-card" data-metric="cpu">
<div class="metric-card__ring">
<svg viewBox="0 0 36 36">
<defs>
<linearGradient id="gradCpu" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#0EA5E9;stop-opacity:1"/>
<stop offset="100%" style="stop-color:#06B6D4;stop-opacity:1"/>
</linearGradient>
</defs>
<path d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="rgba(255,255,255,0.08)" stroke-width="3" transform="rotate(90 18 18)"/>
<path class="metric-card__ring-fill" data-bar-fill="cpu" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="url(#gradCpu)" stroke-width="3" stroke-dasharray="0, 100" transform="rotate(90 18 18)" stroke-linecap="round"/>
</svg>
</div>
<div class="metric-card__icon"><i class="fa-solid fa-microchip"></i></div>
<div class="metric-card__label">Processor</div>
<div class="metric-card__value" data-bar-pct="cpu">0%</div>
<div class="metric-card__detail" data-bar-value="cpu">—</div>
</div>
<div class="metric-card" data-metric="mem">
<div class="metric-card__ring">
<svg viewBox="0 0 36 36">
<defs>
<linearGradient id="gradMem" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#8B5CF6;stop-opacity:1"/>
<stop offset="100%" style="stop-color:#A78BFA;stop-opacity:1"/>
</linearGradient>
</defs>
<path d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="rgba(255,255,255,0.08)" stroke-width="3" transform="rotate(90 18 18)"/>
<path class="metric-card__ring-fill" data-bar-fill="mem" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="url(#gradMem)" stroke-width="3" stroke-dasharray="0, 100" transform="rotate(90 18 18)" stroke-linecap="round"/>
</svg>
</div>
<div class="metric-card__icon"><i class="fa-solid fa-memory"></i></div>
<div class="metric-card__label">Memory</div>
<div class="metric-card__value" data-bar-pct="mem">0%</div>
<div class="metric-card__detail" data-bar-value="mem">—</div>
</div>
<div class="metric-card" data-metric="disk">
<div class="metric-card__ring">
<svg viewBox="0 0 36 36">
<defs>
<linearGradient id="gradDisk" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#EC4899;stop-opacity:1"/>
<stop offset="100%" style="stop-color:#F472B6;stop-opacity:1"/>
</linearGradient>
</defs>
<path d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="rgba(255,255,255,0.08)" stroke-width="3" transform="rotate(90 18 18)"/>
<path class="metric-card__ring-fill" data-bar-fill="disk" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="url(#gradDisk)" stroke-width="3" stroke-dasharray="0, 100" transform="rotate(90 18 18)" stroke-linecap="round"/>
</svg>
</div>
<div class="metric-card__icon"><i class="fa-solid fa-hard-drive"></i></div>
<div class="metric-card__label">Storage</div>
<div class="metric-card__value" data-bar-pct="disk">0%</div>
<div class="metric-card__detail" data-bar-value="disk">—</div>
</div>
<div class="metric-card" data-metric="net">
<div class="metric-card__ring">
<svg viewBox="0 0 36 36">
<defs>
<linearGradient id="gradNet" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#F59E0B;stop-opacity:1"/>
<stop offset="100%" style="stop-color:#FBBF24;stop-opacity:1"/>
</linearGradient>
</defs>
<path d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="rgba(255,255,255,0.08)" stroke-width="3" transform="rotate(90 18 18)"/>
<path class="metric-card__ring-fill" data-bar-fill="netrx" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" fill="none" stroke="url(#gradNet)" stroke-width="3" stroke-dasharray="0, 100" transform="rotate(90 18 18)" stroke-linecap="round"/>
</svg>
</div>
<div class="metric-card__icon"><i class="fa-solid fa-network-wired"></i></div>
<div class="metric-card__label">Network</div>
<div class="metric-card__value" data-bar-pct="netrx">0%</div>
<div class="metric-card__detail">
<span data-bar-value="netrx">—</span>
<span style="opacity:0.5;margin:0 4px">↓</span>
<span data-bar-value="nettx">—</span>
<span style="opacity:0.5;margin-left:4px">↑</span>
</div>
</div>
</div>
<!-- Live Stats -->
<div class="stats-row">
<div class="stat-pill">
<div class="stat-pill__icon"><i class="fa-solid fa-bolt"></i></div>
<div class="stat-pill__body">
<div class="stat-pill__label">Requests</div>
<div class="stat-pill__value"><span id="metricRps">0</span>/s</div>
</div>
</div>
<div class="stat-pill">
<div class="stat-pill__icon"><i class="fa-solid fa-clock"></i></div>
<div class="stat-pill__body">
<div class="stat-pill__label">Uptime</div>
<div class="stat-pill__value" id="metricUptime">0s</div>
</div>
</div>
</div>
<!-- Services -->
<div class="monitor-card">
<div class="monitor-card__title">Services</div>
<div class="svc-grid">
<div class="svc-row" data-svc-row id="svcDatabase">
<span class="svc-row__dot"></span>
<div class="svc-row__body">
<div class="svc-row__name">Database</div>
<div class="svc-row__val" id="svcDatabaseVal">checking…</div>
</div>
</div>
<div class="svc-row" data-svc-row>
<span class="svc-row__dot"></span>
<div class="svc-row__body">
<div class="svc-row__name">Nodes</div>
<div class="svc-row__val" id="svcNodes">checking…</div>
</div>
</div>
<div class="svc-row" data-svc-row>
<span class="svc-row__dot"></span>
<div class="svc-row__body">
<div class="svc-row__name">Containers</div>
<div class="svc-row__val" id="svcContainers">checking…</div>
</div>
</div>
<div class="svc-row" data-svc-row>
<span class="svc-row__dot"></span>
<div class="svc-row__body">
<div class="svc-row__name">Terminal</div>
<div class="svc-row__val" id="svcSsh">checking…</div>
</div>
</div>
<div class="svc-row" data-svc-row>
<span class="svc-row__dot"></span>
<div class="svc-row__body">
<div class="svc-row__name">Connections</div>
<div class="svc-row__val" id="svcSockets">checking…</div>
</div>
</div>
</div>
</div>
<!-- Graph + calendar -->
<div class="monitor-card">
<div class="monitor-card__title">Performance History</div>
<div class="graph-wrap">
<div class="graph-head">
<div class="graph-legend">
<span><i style="background:#0EA5E9"></i>Processor</span>
<span><i style="background:#8B5CF6"></i>Memory</span>
</div>
<div id="graphLabel"></div>
</div>
<canvas id="metricsGraph"></canvas>
</div>
<div class="calendar">
<div class="calendar-head">
<div class="calendar-nav">
<button class="calendar-nav-btn" type="button" disabled aria-label="Previous month">
<i class="fa-solid fa-chevron-left"></i>
</button>
<div class="calendar-head__month" id="calendarMonth">—</div>
<button class="calendar-nav-btn" type="button" disabled aria-label="Next month">
<i class="fa-solid fa-chevron-right"></i>
</button>
</div>
<div class="calendar-head__hint">Select a day to view details</div>
</div>
<div class="cal-grid" id="calendarGrid"></div>
</div>
</div>
</section>
</main>
<% if (isAdmin) { %>
<footer class="footer" id="upload">
<div class="footer-inner">
<div class="footer-copy">
<h3>Spin up a new server</h3>
<p>Pick a template and a name, ADPanel will do the rest.</p>
</div>
<button class="btn-primary" id="createBtnFooter">
<i class="fa-solid fa-plus"></i>
<span>Create</span>
</button>
</div>
</footer>
<% } %>
<% if (isAdmin) { %>
<div id="createModal" class="enterprise-modal-overlay" aria-hidden="true">
<div class="enterprise-modal" role="dialog" aria-modal="true" aria-labelledby="createTitle">
<div class="enterprise-modal-header">
<div class="enterprise-modal-icon icon-rocket">
<Img src="/images/server.webp" alt="Create Server" width="67px" height="67px">
</div>
<div class="enterprise-modal-titles">
<h3 class="enterprise-modal-title" id="createTitle">Create server</h3>
<p class="enterprise-modal-subtitle">Setup your new server instance in just a few steps.</p>
</div>
<button id="createClose" class="enterprise-modal-close" title="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="enterprise-modal-body enterprise-modal-body--split">
<div class="enterprise-modal-main">
<div class="enterprise-field">
<label for="serverName">Server name</label>
<input id="serverName" type="text" placeholder="e.g. MY Discord Bot" maxlength="40" />
<div class="enterprise-hint">
Letters, numbers, spaces, dashes, and underscores. Maximum 40 characters.
</div>
</div>
<div class="enterprise-field">
<label>Template</label>
<div id="templateGrid" class="enterprise-template-grid" role="listbox" aria-label="Templates"></div>
</div>
<div class="enterprise-field">
<label>Specific Node</label>
<div id="nodeGrid" class="enterprise-node-grid" role="listbox" aria-label="Nodes"></div>
</div>
</div>
<aside class="enterprise-modal-aside">
<div class="enterprise-summary">
<div class="enterprise-summary-header">
<div class="enterprise-summary-title">Summary</div>
<span class="enterprise-summary-badge"><i class="fa-solid fa-bolt"></i>&nbsp;Live preview</span>
</div>
<div class="enterprise-summary-row">
<span class="enterprise-summary-label">Name</span>
<span class="enterprise-summary-value" id="summaryServerName">—</span>
</div>
<div class="enterprise-summary-row">
<span class="enterprise-summary-label">Template</span>
<span class="enterprise-summary-value" id="summaryTemplateName">—</span>
</div>
<div class="enterprise-summary-row">
<span class="enterprise-summary-label">Node</span>
<span class="enterprise-summary-value" id="summaryNodeName">—</span>
</div>
<div class="enterprise-summary-footer">
ADPanel helps you choose the best
</div>
</div>
<div id="templateInfo2" class="enterprise-hint"></div>
</aside>
</div>
<div class="enterprise-modal-footer">
<span class="enterprise-spinner" id="createSpinner"></span>
<button id="createCancel" class="enterprise-btn-secondary">Cancel</button>
<button id="createConfirm" class="enterprise-btn-primary">
<i class="fa-solid fa-arrow-right"></i><span>Continue</span>
</button>
</div>
</div>
</div>
<div id="forkModal" class="enterprise-modal-overlay" aria-hidden="true">
<div class="enterprise-modal" role="dialog" aria-modal="true" aria-labelledby="forkTitle">
<div class="enterprise-modal-header">
<div class="enterprise-modal-icon icon-cube">
<i class="fa-solid fa-cube"></i>
</div>
<div class="enterprise-modal-titles">
<div class="enterprise-modal-eyebrow">Minecraft</div>
<h3 class="enterprise-modal-title" id="forkTitle">Choose Minecraft fork</h3>
<p class="enterprise-modal-subtitle">Select a server type.</p>
</div>
<button id="forkClose" class="enterprise-modal-close" title="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="enterprise-modal-body">
<div id="forkGrid" class="enterprise-fork-grid enterprise-fork-grid--spacious" role="listbox" aria-label="Minecraft forks"></div>
<div id="forkInfo" class="enterprise-hint enterprise-hint--spacious"></div>
</div>
<div class="enterprise-modal-footer">
<span class="enterprise-spinner" id="forkSpinner"></span>
<button id="forkBack" class="enterprise-btn-secondary">Back</button>
<button id="forkConfirm" class="enterprise-btn-primary">
<i class="fa-solid fa-arrow-right"></i><span>Continue</span>
</button>
</div>
</div>
</div>
<div id="portModal" class="enterprise-modal-overlay" aria-hidden="true">
<div class="enterprise-modal" role="dialog" aria-modal="true" aria-labelledby="portTitle">
<div class="enterprise-modal-header">
<div class="enterprise-modal-icon icon-ethernet">
<i class="fa-solid fa-ethernet"></i>
</div>
<div class="enterprise-modal-titles">
<div class="enterprise-modal-eyebrow">Networking</div>
<h3 class="enterprise-modal-title" id="portTitle">
<span id="portTitleText">Expose public port</span>
</h3>
<p class="enterprise-modal-subtitle" id="portSubtitle">Choose which public port to expose for this
server.</p>
</div>
<button id="portClose" class="enterprise-modal-close" title="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="enterprise-modal-body">
<div class="enterprise-port-layout">
<div class="enterprise-field">
<label>Public endpoint</label>
<div class="enterprise-connection-chip">
<i class="fa-solid fa-plug"></i>
<span>
<code id="serverIp">detecting…</code>
<span class="enterprise-connection-chip__divider">:</span>
<code id="serverPortPreview">25565</code>
</span>
</div>
<div class="enterprise-hint">
This is the address your users will use to connect.
</div>
</div>
<div class="enterprise-field">
<label for="serverPort">Public port</label>
<input id="serverPort" type="number" min="1" max="65535" step="1" inputmode="numeric" pattern="[0-9]*" placeholder="25565" />
<div class="enterprise-hint">
Default <span id="portDefaultValue">25565</span>. Available range is 1 to 35650.
</div>
</div>
</div>
</div>
<div class="enterprise-modal-footer">
<span class="enterprise-spinner" id="portSpinner"></span>
<button id="portBack" class="enterprise-btn-secondary">Back</button>
<button id="portConfirm" class="enterprise-btn-primary">
<i class="fa-solid fa-arrow-right"></i><span>Next</span>
</button>
</div>
</div>
</div>
<div id="startupModal" class="enterprise-modal-overlay" aria-hidden="true">
<div class="enterprise-modal" role="dialog" aria-modal="true" aria-labelledby="startupTitle">
<div class="enterprise-modal-header">
<div class="enterprise-modal-icon icon-terminal">
<i class="fa-solid fa-terminal"></i>
</div>
<div class="enterprise-modal-titles">
<div class="enterprise-modal-eyebrow">Startup</div>
<h3 class="enterprise-modal-title" id="startupTitle">Startup Command</h3>
<p class="enterprise-modal-subtitle">Set the process command for your server.</p>
</div>
<button id="startupClose" class="enterprise-modal-close" title="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="enterprise-modal-body enterprise-modal-body--spacious">
<div class="enterprise-field">
<label for="startupCommand">Process Command</label>
<textarea id="startupCommand" rows="3" aria-describedby="startupCommandError"
placeholder="java -Xms128M -Xmx{RAM_MB}M -jar /data/server.jar nogui"></textarea>
<div id="startupCommandError" class="enterprise-hint enterprise-hint-error" role="alert" hidden></div>
<div id="startupCommandSource" class="enterprise-hint">Auto-detecting from template and Docker image.</div>
</div>
<div class="enterprise-field">
<label>Available Variables</label>
<div class="enterprise-variables-grid enterprise-variables-grid--spacious">
<div class="enterprise-variable-chip"><code>{PORT}</code> – Port</div>
<div class="enterprise-variable-chip"><code>{DATA_DIR}</code> – Data path</div>
<div class="enterprise-variable-chip"><code>{START_FILE}</code> – Entry file</div>
<div class="enterprise-variable-chip"><code>{RAM_MB}</code> – RAM (MB)</div>
<div class="enterprise-variable-chip"><code>{CPU_CORES}</code> – CPU cores</div>
</div>
</div>
</div>
<div class="enterprise-modal-footer">
<span class="enterprise-spinner" id="startupSpinner"></span>
<button id="startupBack" class="enterprise-btn-secondary">Back</button>
<button id="startupConfirm" class="enterprise-btn-primary">
<i class="fa-solid fa-arrow-right"></i><span>Next</span>
</button>
</div>
</div>
</div>
<div id="importModal" class="enterprise-modal-overlay" aria-hidden="true">
<div class="enterprise-modal" role="dialog" aria-modal="true" aria-labelledby="importTitle">
<div class="enterprise-modal-header">
<div class="enterprise-modal-icon icon-download">
<i class="fa-solid fa-cloud-arrow-down"></i>
</div>
<div class="enterprise-modal-titles">
<div class="enterprise-modal-eyebrow">Optional</div>
<h3 class="enterprise-modal-title" id="importTitle">Import Files</h3>
<p class="enterprise-modal-subtitle">Download files from a URL to your server folder.</p>
</div>
<button id="importClose" class="enterprise-modal-close" title="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="enterprise-modal-body enterprise-modal-body--spacious">
<div class="enterprise-field">
<label for="importUrl">Archive URL</label>
<input id="importUrl" type="url" placeholder="https://example.com/files.zip" />
<div class="enterprise-hint">
Supported: <code>.zip</code>, <code>.tar.gz</code>
</div>
</div>
<div id="importProgressContainer" class="enterprise-import-progress" style="display: none;">
<div class="enterprise-import-progress-header">
<span class="enterprise-import-progress-label">Downloading...</span>
<span class="enterprise-import-progress-percent" id="importPercent">0%</span>
</div>
<div class="enterprise-import-progress-bar">
<div class="enterprise-import-progress-fill" id="importProgressFill" style="width: 0%;"></div>
</div>
<div class="enterprise-import-progress-info">
<span id="importDownloaded">0 MB</span> / <span id="importTotal">0 MB</span>
</div>
</div>
</div>
<div class="enterprise-modal-footer">
<span class="enterprise-spinner" id="importSpinner"></span>
<button id="importBack" class="enterprise-btn-secondary">Back</button>
<button id="importSkip" class="enterprise-btn-secondary">Skip</button>
<button id="importConfirm" class="enterprise-btn-primary">
<i class="fa-solid fa-download"></i><span>Download & Continue</span>
</button>
</div>
</div>
</div>
<div id="resourcesModal" class="enterprise-modal-overlay" aria-hidden="true">
<div class="enterprise-modal" role="dialog" aria-modal="true" aria-labelledby="resourcesTitle">
<div class="enterprise-modal-header">
<div class="enterprise-modal-icon icon-chip">
<i class="fa-solid fa-microchip"></i>
</div>
<div class="enterprise-modal-titles">
<div class="enterprise-modal-eyebrow">Resources</div>
<h3 class="enterprise-modal-title" id="resourcesTitle">Configure Resources</h3>
<p class="enterprise-modal-subtitle">Set limits for this server. Leave empty to use node maximum.</p>
</div>
<button id="resourcesClose" class="enterprise-modal-close" title="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="enterprise-modal-body enterprise-modal-body--spacious">
<div class="enterprise-resources-layout">
<div class="enterprise-resources-info">
<div class="enterprise-resources-info__header">
<i class="fa-solid fa-server"></i>
<span>Node Resources</span>
</div>
<div class="enterprise-resources-info__grid">
<div class="enterprise-resources-info__item">
<span class="enterprise-resources-info__label">Total RAM</span>
<span class="enterprise-resources-info__value" id="nodeRamLimit">—</span>
</div>
<div class="enterprise-resources-info__item">
<span class="enterprise-resources-info__label">CPU Cores</span>
<span class="enterprise-resources-info__value" id="nodeCpuLimit">—</span>
</div>
<div class="enterprise-resources-info__item">
<span class="enterprise-resources-info__label">Total Storage</span>
<span class="enterprise-resources-info__value" id="nodeStorageLimit">—</span>
</div>
</div>
</div>
<div class="enterprise-resources-fields enterprise-resources-fields--spacious">
<div class="enterprise-resources-section-title">
<i class="fa-solid fa-microchip"></i>
<span>Hardware Limit</span>
</div>
<div class="enterprise-field">
<label for="resourceRam">RAM Limit (MB)</label>
<input id="resourceRam" type="number" min="0" step="128" placeholder="e.g. 2048" />
</div>
<div class="enterprise-field">
<label for="resourceCpuCores">
CPU Cores
<span class="enterprise-field-tooltip">
<i class="fa-solid fa-circle-question"></i>
<span class="enterprise-field-tooltip-card">
<p>The number of processing units dedicated to your server; use 2 or more for modern applications.</p>
</span>
</span>
</label>
<input id="resourceCpuCores" type="number" min="0" step="0.5" placeholder="e.g. 2" />
</div>
<div class="enterprise-field">
<label for="resourceSwap">
Swap Memory (MB)
<span class="enterprise-field-tooltip">
<i class="fa-solid fa-circle-question"></i>
<span class="enterprise-field-tooltip-card">
<p>Extra virtual RAM used when physical memory is full; set to 512 or 1024 to prevent the server from crashing from OOM Killer if your node have low memory, ensure you have SWAP activated on your machine.</p>
</span>
</span>
</label>
<input id="resourceSwap" type="number" min="-1" step="128" placeholder="e.g. 512" />
</div>
<div class="enterprise-field">
<label for="resourceStorage">Storage (MB)</label>
<input id="resourceStorage" type="number" min="0" step="1" placeholder="e.g. 500" />
</div>
<div class="enterprise-resources-section-title enterprise-resources-section-title--spaced">
<i class="fa-solid fa-gauge-high"></i>
<span>Software Limit</span>
</div>
<div class="enterprise-field">
<label for="resourceBackups">Max Backups</label>
<input id="resourceBackups" type="number" min="0" step="1" placeholder="e.g. 5" />
</div>
<div class="enterprise-field">
<label for="resourceMaxSchedules">Max Schedules</label>
<input id="resourceMaxSchedules" type="number" min="0" step="1" placeholder="e.g. 10" />
</div>
<div class="enterprise-field">
<label for="resourceIoWeight">
I/O Priority
<span class="enterprise-field-tooltip">
<i class="fa-solid fa-circle-question"></i>
<span class="enterprise-field-tooltip-card">
<p>I/O Priority determines how fast your server reads or writes data; set it to 1000 for having highest priority.</p>
</span>
</span>
</label>
<input id="resourceIoWeight" type="number" min="10" max="1000" step="10" placeholder="e.g. 500" />
<div class="enterprise-hint">Maximum is 1000.</div>
</div>
<div class="enterprise-field">
<label for="resourceCpuWeight">
CPU Priority
<span class="enterprise-field-tooltip">
<i class="fa-solid fa-circle-question"></i>
<span class="enterprise-field-tooltip-card">
<p>CPU Priority controls how much processing power your server gets during high-load periods; to ensure maximum performance, set it to 1000.</p>
</span>
</span>
</label>
<input id="resourceCpuWeight" type="number" min="1" max="1000" step="10" placeholder="e.g. 500" />
<div class="enterprise-hint">Maximum is 1000.</div>
</div>
<div class="enterprise-field">
<label for="resourcePidsLimit">
Process Limit
<span class="enterprise-field-tooltip">
<i class="fa-solid fa-circle-question"></i>
<span class="enterprise-field-tooltip-card">
<p>Process Limit restricts the maximum number of simultaneous tasks your server can run; to ensure maximum performance, set it to 512 or higher.</p>
</span>
</span>
</label>
<input id="resourcePidsLimit" type="number" min="64" max="4096" step="64" placeholder="e.g. 512" />
<div class="enterprise-hint">Maximum is 4096.</div>
</div>
<div class="enterprise-field">
<label for="resourceFileLimit">
File Limit
<span class="enterprise-field-tooltip">
<i class="fa-solid fa-circle-question"></i>
<span class="enterprise-field-tooltip-card">
<p>File Limit sets the maximum number of files your server can keep open at once; set it to 32768 or higher to prevent crashes.</p>
</span>
</span>
</label>
<input id="resourceFileLimit" type="number" min="1024" max="1048576" step="1024" placeholder="e.g. 65535" />
<div class="enterprise-hint">Maximum is 1048576.</div>
</div>
<div class="enterprise-resources-section-title enterprise-resources-section-title--spaced">
<i class="fa-solid fa-shield-halved"></i>
<span>Anti-Abuse</span>
<span class="enterprise-field-tooltip">
<i class="fa-solid fa-circle-question"></i>
<span class="enterprise-field-tooltip-card">
<p>Set bandwidth rules to prevent abuses; when limit is reached the server will stop.</p>
</span>
</span>
</div>
<div class="enterprise-field">
<label for="resourceNetworkInboundLimit">
Inbound Limit
<span class="enterprise-field-tooltip">
<i class="fa-solid fa-circle-question"></i>
<span class="enterprise-field-tooltip-card">
<p>Limit the number of packets the server can receive.</p>
</span>
</span>
</label>
<div class="enterprise-input-with-suffix">
<input id="resourceNetworkInboundLimit" type="number" min="1" step="1" placeholder="e.g. 10240" />
<span>MB</span>
</div>
</div>
<div class="enterprise-field">
<label for="resourceNetworkOutboundLimit">
Outbound Limit
<span class="enterprise-field-tooltip">
<i class="fa-solid fa-circle-question"></i>
<span class="enterprise-field-tooltip-card">
<p>Limit the number of packets the server can send.</p>
</span>
</span>
</label>
<div class="enterprise-input-with-suffix">
<input id="resourceNetworkOutboundLimit" type="number" min="1" step="1" placeholder="e.g. 10240" />
<span>MB</span>
</div>
</div>
<div class="enterprise-field">
<label for="resourceNetworkResetMinutes">
Reset Time
<span class="enterprise-field-tooltip">
<i class="fa-solid fa-circle-question"></i>
<span class="enterprise-field-tooltip-card">
<p>When is the limit reset.</p>
</span>
</span>
</label>
<div class="enterprise-input-with-suffix">
<input id="resourceNetworkResetMinutes" type="number" min="1" step="1" placeholder="e.g. 1440" />
<span>min</span>
</div>
<div class="enterprise-hint">Leave empty to reset every 1440 minutes.</div>
</div>
<div class="enterprise-resources-section-title enterprise-resources-section-title--spaced">
<i class="fa-solid fa-hard-drive"></i>
<span>Storage Disk</span>
</div>
<div class="enterprise-field">
<label for="resourceDisk">
Target Disk
<span class="enterprise-field-tooltip">
<i class="fa-solid fa-circle-question"></i>
<span class="enterprise-field-tooltip-card">
<p>Choose which physical disk on the node stores this server's files. The primary disk is used by default.</p>
</span>
</span>
</label>
<select id="resourceDisk">
<option value="primary">Primary (/var/lib/node)</option>
</select>
<div class="enterprise-hint" id="resourceDiskHint">Server files are stored on the selected disk.</div>
</div>
</div>
</div>
</div>
<div class="enterprise-modal-footer">
<span class="enterprise-spinner" id="resourcesSpinner"></span>
<button id="resourcesBack" class="enterprise-btn-secondary">Back</button>
<button id="resourcesConfirm" class="enterprise-btn-primary">
<i class="fa-solid fa-check"></i><span>Create</span>
</button>
</div>
</div>
</div>
<% } %>
<script nonce="<%= cspNonce %>" data-cfasync="false" src="/socket.io/socket.io.min.js" defer></script>
<script nonce="<%= cspNonce %>" data-cfasync="false" src="/js/ssh-terminal-window.js?v=20260923-ssh-terminal-restore-7" defer></script>
<script nonce="<%= cspNonce %>" data-cfasync="false" src="/js/dashboard.js?v=20260512-dashboard-timeout-1" defer></script>
<script nonce="<%= cspNonce %>" data-cfasync="false" src="/js/status-monitor.js?v=<%= typeof themeVersion !== 'undefined' ? themeVersion : Date.now() %>" defer></script>
<div style="text-align: center; margin: 40px 0 20px 0; color: rgba(255, 255, 255, 0.4); font-size: 13px; font-weight: 500;">
&copy; 2026-<%= new Date().getFullYear() %> ADPanel Dashboard
</div>
<script nonce="<%= cspNonce %>">
(function () {
if (window.matchMedia('(hover: none) and (pointer: coarse)').matches) return;
var canPF = false;
try {
var _o = Object.defineProperty({}, 'passive', { get: function(){ canPF = true; }});
window.addEventListener('_', null, _o); window.removeEventListener('_', null, _o);
} catch(_){}
var PF = canPF ? { passive: false } : false;
var PT = canPF ? { passive: true } : false;
var y = window.scrollY || window.pageYOffset;
var dest = y;
var raf = null;
var prevT = null;
var COAST_MS = 200;
var coastT = null;
var coasting = false;
var LERP_ACTIVE = 0.22;
var LERP_COAST = 0.10;
function clamp(v) {
return Math.max(0, Math.min(document.body.scrollHeight - window.innerHeight, v));
}
function loop(now) {
if (prevT === null) prevT = now;
var dt = Math.min(now - prevT, 50) / 16.667;
prevT = now;
var lerp = coasting ? LERP_COAST : LERP_ACTIVE;
var f = 1 - Math.pow(1 - lerp, dt);
var diff = dest - y;
if (Math.abs(diff) < 0.25) {
y = dest;
window.scrollTo(0, y);
raf = null; prevT = null; coasting = false;
return;
}
y += diff * f;
window.scrollTo(0, y);
raf = requestAnimationFrame(loop);
}
function go() {
if (!raf) { prevT = null; raf = requestAnimationFrame(loop); }
}
function scrollableAncestor(el) {
while (el && el !== document.body) {
var ov = getComputedStyle(el).overflowY;
if ((ov === 'auto' || ov === 'scroll') && el.scrollHeight > el.clientHeight) return true;
el = el.parentElement;
}
return false;
}
function interactive(el) {
var TAGS = { BUTTON:1, A:1, INPUT:1, TEXTAREA:1, SELECT:1, LABEL:1 };
while (el && el !== document.body) {
if (TAGS[el.tagName]) return true;
var role = el.getAttribute && el.getAttribute('role');
if (role === 'button' || role === 'link') return true;
el = el.parentElement;
}
return false;
}
window.addEventListener('wheel', function(e) {
if (e.ctrlKey || e.metaKey) return;
if (Math.abs(e.deltaX) > Math.abs(e.deltaY)) return;
if (scrollableAncestor(e.target)) return;
e.preventDefault();
var d = e.deltaY;
if (e.deltaMode === 1) d *= 32;
else if (e.deltaMode === 2) d *= window.innerHeight;
dest = clamp(dest + d);
coasting = false;
clearTimeout(coastT);
coastT = setTimeout(function() {
coasting = true;
}, COAST_MS);
go();
}, PF);
var drag = null;
document.addEventListener('mousedown', function(e) {
if (e.button !== 0) return;
if (interactive(e.target)) return;
if (scrollableAncestor(e.target)) return;
dest = y;
drag = { startY: e.clientY, startScroll: y, lastY: e.clientY, lastT: performance.now(), vel: 0 };
clearTimeout(coastT); coasting = false;
document.body.style.userSelect = 'none';
document.body.style.cursor = 'grabbing';
e.preventDefault();
}, PF);
document.addEventListener('mousemove', function(e) {
if (!drag) return;
var now = performance.now();
var dt = now - drag.lastT || 1;
drag.vel = (e.clientY - drag.lastY) / dt;
drag.lastY = e.clientY;
drag.lastT = now;
y = clamp(drag.startScroll + (drag.startY - e.clientY));
dest = y;
window.scrollTo(0, y);
}, PT);
function endDrag() {
if (!drag) return;
document.body.style.userSelect = '';
document.body.style.cursor = '';
var throw_ = -drag.vel * 16.667 * 1.2;
dest = clamp(y + throw_);
coasting = true;
drag = null;
if (Math.abs(throw_) > 1) go();
}
document.addEventListener('mouseup', endDrag);
document.addEventListener('mouseleave', endDrag);
window.addEventListener('scroll', function() {
if (!raf && !drag) {
y = window.scrollY || window.pageYOffset;
dest = y;
}
}, PT);
})();
</script>
</body>
</html>