Perk-a-cola redesign + surface RCON map/gametype/roster/health
Themes the fleet manager around the Electric Cherry perk-a-cola from Mob of the Dead — cherry-red art-deco label with electric cyan discharge. New design tokens (Alfa Slab One + Inter + JetBrains Mono, self-hosted), full redesign of layout/dashboard/cards/detail page, tokens pass on deployments/betas/pipeline/beta/diff, cherry+lightning favicon. Lights up server data that RCON was already fetching but the UI dropped. parsePlayerRoster() extracts num/score/ping/guid/name from both status dialects. Worker persists last_map/last_gametype/last_roster/last_seen_at/ last_error (new columns with idempotent boot-time ALTERs) and emits them over SSE. Fleet cards now show health dot, map · gametype, top-3 roster preview, and last-seen. Detail page adds a sortable full roster with distinct empty-lobby vs offline states. New health classifier (online/stale/offline) drives the visual state. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Generated
+30
@@ -8,6 +8,9 @@
|
||||
"name": "electric-cherry",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@fontsource/alfa-slab-one": "^5.3.0",
|
||||
"@fontsource/inter": "^5.3.0",
|
||||
"@fontsource/jetbrains-mono": "^5.3.0",
|
||||
"better-sqlite3": "^11.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -466,6 +469,33 @@
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource/alfa-slab-one": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource/alfa-slab-one/-/alfa-slab-one-5.3.0.tgz",
|
||||
"integrity": "sha512-J/ANFZ7S9CbZClr/QhMjmBtpFmmKipVkEXHj20aurR5uqJPCBChVPJn1/kx6vtrwnfnDY0kQaYSTYasSt4GruA==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource/inter": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource/inter/-/inter-5.3.0.tgz",
|
||||
"integrity": "sha512-RofMylZmjlJEfELXeNHFWBRcSs75rGU/6bV2S2jfnvv/3rPXPGe0LgUJTklcHZ9lM4OZmAVFhcJPnACfb91A3g==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource/jetbrains-mono": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource/jetbrains-mono/-/jetbrains-mono-5.3.0.tgz",
|
||||
"integrity": "sha512-fqDfB5I9f1p1TV486aUgB9t8zP84P0O1FtQR5Ol9vjwPy+S+EIGlVYm1cvj2W5shcZMTg2nZFdVMoH5wFu8a1A==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.13",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
"seed:fixture": "tsx scripts/seed-fixture.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fontsource/alfa-slab-one": "^5.3.0",
|
||||
"@fontsource/inter": "^5.3.0",
|
||||
"@fontsource/jetbrains-mono": "^5.3.0",
|
||||
"better-sqlite3": "^11.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<link rel="icon" type="image/svg+xml" href="%sveltekit.assets%/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="color-scheme" content="dark light" />
|
||||
<title>Electric Cherry</title>
|
||||
|
||||
@@ -6,6 +6,28 @@ import schemaSql from './schema.sql?raw';
|
||||
|
||||
let _db: Database.Database | null = null;
|
||||
|
||||
// Columns that were added to `servers` after v0.1 shipped. Applied on every
|
||||
// boot; better-sqlite3 has no `ADD COLUMN IF NOT EXISTS`, so we run each and
|
||||
// swallow the "duplicate column" error.
|
||||
const SERVERS_MIGRATIONS: Array<{ column: string; ddl: string }> = [
|
||||
{ column: 'last_map', ddl: 'ALTER TABLE servers ADD COLUMN last_map TEXT' },
|
||||
{ column: 'last_gametype', ddl: 'ALTER TABLE servers ADD COLUMN last_gametype TEXT' },
|
||||
{ column: 'last_roster', ddl: 'ALTER TABLE servers ADD COLUMN last_roster TEXT' },
|
||||
{ column: 'last_seen_at', ddl: 'ALTER TABLE servers ADD COLUMN last_seen_at TEXT' },
|
||||
{ column: 'last_error', ddl: 'ALTER TABLE servers ADD COLUMN last_error TEXT' }
|
||||
];
|
||||
|
||||
function migrateServers(handle: Database.Database): void {
|
||||
for (const m of SERVERS_MIGRATIONS) {
|
||||
try {
|
||||
handle.exec(m.ddl);
|
||||
} catch (err) {
|
||||
const msg = (err as Error).message ?? '';
|
||||
if (!/duplicate column name/i.test(msg)) throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function db(): Database.Database {
|
||||
if (_db) return _db;
|
||||
|
||||
@@ -14,6 +36,7 @@ export function db(): Database.Database {
|
||||
_db.pragma('journal_mode = WAL');
|
||||
_db.pragma('foreign_keys = ON');
|
||||
_db.exec(schemaSql);
|
||||
migrateServers(_db);
|
||||
|
||||
return _db;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,11 @@ CREATE TABLE IF NOT EXISTS servers (
|
||||
rcon_host TEXT, -- optional per-server override of RCON_HOST
|
||||
last_players INTEGER,
|
||||
last_checked_at TEXT,
|
||||
last_map TEXT, -- from RCON getstatus mapname
|
||||
last_gametype TEXT, -- from RCON getstatus g_gametype
|
||||
last_roster TEXT, -- JSON array of RconPlayer
|
||||
last_seen_at TEXT, -- ISO ts of last successful RCON reply
|
||||
last_error TEXT, -- last RCON failure reason (cleared on success)
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
export type Health = 'online' | 'stale' | 'offline';
|
||||
|
||||
const ONLINE_MAX_MS = 30_000;
|
||||
const STALE_MAX_MS = 120_000;
|
||||
|
||||
/**
|
||||
* Classify server health from its last successful RCON timestamp.
|
||||
* `offline` if we've never seen it, or if RCON just failed, or if the last
|
||||
* successful reply is >120s old. `stale` if the last reply is 30-120s old
|
||||
* (RCON glitchy). `online` if fresh.
|
||||
*/
|
||||
export function classifyHealth(lastSeenAt: string | null, lastError: string | null): Health {
|
||||
if (!lastSeenAt) return 'offline';
|
||||
const age = Date.now() - new Date(lastSeenAt).getTime();
|
||||
if (!Number.isFinite(age) || age < 0) return 'offline';
|
||||
if (age <= ONLINE_MAX_MS) {
|
||||
// Even with a fresh last_seen, a very recent error demotes to stale
|
||||
return lastError ? 'stale' : 'online';
|
||||
}
|
||||
if (age <= STALE_MAX_MS) return 'stale';
|
||||
return 'offline';
|
||||
}
|
||||
@@ -71,6 +71,11 @@ export interface ServerRow {
|
||||
rcon_host: string | null;
|
||||
last_players: number | null;
|
||||
last_checked_at: string | null;
|
||||
last_map: string | null;
|
||||
last_gametype: string | null;
|
||||
last_roster: string | null; // JSON array of RconPlayer, or null
|
||||
last_seen_at: string | null; // last successful RCON reply
|
||||
last_error: string | null; // cleared on success
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
@@ -116,7 +121,12 @@ export function setServerField(
|
||||
'game_port',
|
||||
'rcon_host',
|
||||
'last_players',
|
||||
'last_checked_at'
|
||||
'last_checked_at',
|
||||
'last_map',
|
||||
'last_gametype',
|
||||
'last_roster',
|
||||
'last_seen_at',
|
||||
'last_error'
|
||||
];
|
||||
if (!allowed.includes(field)) throw new Error(`refusing to set ${field}`);
|
||||
db().prepare(`UPDATE servers SET ${field} = ? WHERE name = ?`).run(value, name);
|
||||
|
||||
@@ -131,6 +131,61 @@ export function parseInfoLine(text: string): Record<string, string> {
|
||||
return out;
|
||||
}
|
||||
|
||||
export interface RconPlayer {
|
||||
num: number | null; // client slot — print dialect only
|
||||
score: number;
|
||||
ping: number;
|
||||
guid: string | null; // 32-hex — print dialect only
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract every player row from a `status` (print) or `getstatus`
|
||||
* (statusResponse) response. Returns [] when the payload has none.
|
||||
* Two dialects, same output shape:
|
||||
*
|
||||
* print: num score ping <32-hex-guid> <name-with-spaces>
|
||||
* statusResponse: score ping "<name>"
|
||||
*/
|
||||
export function parsePlayerRoster(text: string): RconPlayer[] {
|
||||
const lines = text.split(/\r?\n/);
|
||||
const sep = lines.findIndex((l) => /^-+\s+-+/.test(l.trim()));
|
||||
if (sep !== -1) {
|
||||
const out: RconPlayer[] = [];
|
||||
// Match: num score ping guid(32-hex) name-rest
|
||||
const re = /^\s*(\d+)\s+(-?\d+)\s+(\d+)\s+([0-9a-fA-F]{16,})\s+(.+?)\s*$/;
|
||||
for (let i = sep + 1; i < lines.length; i++) {
|
||||
const m = re.exec(lines[i]);
|
||||
if (!m) continue;
|
||||
out.push({
|
||||
num: Number(m[1]),
|
||||
score: Number(m[2]),
|
||||
ping: Number(m[3]),
|
||||
guid: m[4],
|
||||
name: m[5]
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
// statusResponse dialect: rows after the info line, format: score ping "name"
|
||||
const info = lines.findIndex((l) => l.startsWith('\\'));
|
||||
if (info === -1) return [];
|
||||
const out: RconPlayer[] = [];
|
||||
const re = /^\s*(-?\d+)\s+(\d+)\s+"(.*)"\s*$/;
|
||||
for (let i = info + 1; i < lines.length; i++) {
|
||||
const m = re.exec(lines[i]);
|
||||
if (!m) continue;
|
||||
out.push({
|
||||
num: null,
|
||||
score: Number(m[1]),
|
||||
ping: Number(m[2]),
|
||||
guid: null,
|
||||
name: m[3]
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export async function rconGetPlayerCount(server: string): Promise<number | null> {
|
||||
const ep = await endpointFor(server);
|
||||
if (!ep) return null;
|
||||
@@ -145,6 +200,7 @@ export interface RconStatus {
|
||||
players: number;
|
||||
map: string | null;
|
||||
gametype: string | null;
|
||||
roster: RconPlayer[];
|
||||
}
|
||||
|
||||
export async function rconGetStatus(server: string): Promise<RconStatus | null> {
|
||||
@@ -162,6 +218,7 @@ export async function rconGetStatus(server: string): Promise<RconStatus | null>
|
||||
return {
|
||||
players,
|
||||
map: info.mapname ?? info.sv_mapname ?? null,
|
||||
gametype: info.g_gametype ?? null
|
||||
gametype: info.g_gametype ?? null,
|
||||
roster: parsePlayerRoster(text)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
import { EventEmitter } from 'node:events';
|
||||
import type { RconPlayer } from '../integrations/rcon.js';
|
||||
import type { Health } from '../fleet/health.js';
|
||||
|
||||
// One in-process event bus, multiplexed by the SSE endpoints. Kept separate
|
||||
// from any specific subscriber so push/beta/sweep can emit without pulling
|
||||
// the whole worker module in.
|
||||
|
||||
export interface ServerStatusEntry {
|
||||
server: string;
|
||||
players: number | null;
|
||||
map: string | null;
|
||||
gametype: string | null;
|
||||
roster: RconPlayer[] | null;
|
||||
health: Health;
|
||||
lastSeenAt: string | null;
|
||||
lastError: string | null;
|
||||
}
|
||||
|
||||
export type PipelineEvent =
|
||||
| { type: 'deployment-opened'; deploymentId: string; action: string; servers: string[] }
|
||||
| { type: 'server-changed'; deploymentId: string; server: string; files: number }
|
||||
@@ -16,7 +29,7 @@ export type PipelineEvent =
|
||||
error: string | null;
|
||||
}
|
||||
| { type: 'sweep-tick'; frozen: boolean; reason?: string }
|
||||
| { type: 'server-status'; entries: Array<{ server: string; players: number | null; name?: string }> };
|
||||
| { type: 'server-status'; entries: ServerStatusEntry[] };
|
||||
|
||||
class Bus extends EventEmitter {
|
||||
constructor() {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { sweep } from './sweep.js';
|
||||
import { emit } from './bus.js';
|
||||
import type { ServerStatusEntry } from './bus.js';
|
||||
import { rconGetStatus } from '../integrations/rcon.js';
|
||||
import { listServers, seedServerRegistry } from '../fleet/servers.js';
|
||||
import { listServers, seedServerRegistry, setServerField } from '../fleet/servers.js';
|
||||
import { classifyHealth } from '../fleet/health.js';
|
||||
|
||||
const TICK_MS = 15_000;
|
||||
const STATUS_REFRESH_MS = 30_000;
|
||||
@@ -25,7 +27,7 @@ async function fanoutStatus(): Promise<void> {
|
||||
const servers = listServers();
|
||||
if (servers.length === 0) return;
|
||||
|
||||
const entries: Array<{ server: string; players: number | null; name?: string }> = new Array(servers.length);
|
||||
const entries: ServerStatusEntry[] = new Array(servers.length);
|
||||
let cursor = 0;
|
||||
|
||||
async function pump(): Promise<void> {
|
||||
@@ -34,11 +36,44 @@ async function fanoutStatus(): Promise<void> {
|
||||
if (i >= servers.length) return;
|
||||
const srv = servers[i];
|
||||
const status = await rconGetStatus(srv.name).catch(() => null);
|
||||
entries[i] = {
|
||||
server: srv.name,
|
||||
players: status?.players ?? null,
|
||||
name: status?.map ?? undefined
|
||||
};
|
||||
const now = new Date().toISOString();
|
||||
|
||||
if (status) {
|
||||
// Persist last-observed state. last_seen_at is the health anchor.
|
||||
setServerField(srv.name, 'last_players', status.players);
|
||||
setServerField(srv.name, 'last_map', status.map);
|
||||
setServerField(srv.name, 'last_gametype', status.gametype);
|
||||
setServerField(srv.name, 'last_roster', JSON.stringify(status.roster));
|
||||
setServerField(srv.name, 'last_seen_at', now);
|
||||
setServerField(srv.name, 'last_checked_at', now);
|
||||
setServerField(srv.name, 'last_error', null);
|
||||
entries[i] = {
|
||||
server: srv.name,
|
||||
players: status.players,
|
||||
map: status.map,
|
||||
gametype: status.gametype,
|
||||
roster: status.roster,
|
||||
health: classifyHealth(now, null),
|
||||
lastSeenAt: now,
|
||||
lastError: null
|
||||
};
|
||||
} else {
|
||||
// RCON unreachable — leave last_seen_at alone (health decays
|
||||
// to offline naturally), record the failure reason.
|
||||
const error = 'rcon unreachable';
|
||||
setServerField(srv.name, 'last_checked_at', now);
|
||||
setServerField(srv.name, 'last_error', error);
|
||||
entries[i] = {
|
||||
server: srv.name,
|
||||
players: srv.last_players,
|
||||
map: srv.last_map,
|
||||
gametype: srv.last_gametype,
|
||||
roster: srv.last_roster ? safeJson(srv.last_roster) : null,
|
||||
health: classifyHealth(srv.last_seen_at, error),
|
||||
lastSeenAt: srv.last_seen_at,
|
||||
lastError: error
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
await Promise.all(Array.from({ length: STATUS_CONCURRENCY }, pump));
|
||||
@@ -46,6 +81,14 @@ async function fanoutStatus(): Promise<void> {
|
||||
emit({ type: 'server-status', entries });
|
||||
}
|
||||
|
||||
function safeJson<T>(raw: string): T | null {
|
||||
try {
|
||||
return JSON.parse(raw) as T;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function startWorker(): void {
|
||||
if (started) return;
|
||||
started = true;
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
<div class="row"><span class="k">servers</span> {b.servers.join(', ')}</div>
|
||||
<div class="actions">
|
||||
<button onclick={() => act(b.slug, 'update')}>update</button>
|
||||
<button onclick={() => act(b.slug, 'promote')}>promote</button>
|
||||
<button class="primary" onclick={() => act(b.slug, 'promote')}>promote</button>
|
||||
<button class="danger" onclick={() => act(b.slug, 'rollback')}>rollback</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,77 +125,147 @@
|
||||
|
||||
<style>
|
||||
.panel {
|
||||
background: #141414;
|
||||
border: 1px solid #333;
|
||||
border-radius: 6px;
|
||||
padding: 16px;
|
||||
background: var(--cherry-925);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-md);
|
||||
padding: 20px 22px;
|
||||
}
|
||||
h3 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 13px;
|
||||
margin: 0 0 10px;
|
||||
font-family: var(--font-body);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: #aaa;
|
||||
letter-spacing: 1.5px;
|
||||
color: var(--ink-300);
|
||||
}
|
||||
h3:not(:first-of-type) { margin-top: 20px; }
|
||||
.empty { color: #666; font-size: 13px; margin: 0; }
|
||||
.staged { list-style: none; padding: 0; margin: 0 0 12px; }
|
||||
h3:not(:first-of-type) { margin-top: 24px; }
|
||||
.empty {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
}
|
||||
.staged { list-style: none; padding: 0; margin: 0 0 14px; }
|
||||
.staged li {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px solid #222;
|
||||
align-items: center;
|
||||
padding: 6px 0;
|
||||
border-bottom: 1px solid var(--cherry-700);
|
||||
}
|
||||
.staged code {
|
||||
color: var(--cream);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
}
|
||||
.staged code { color: #ddd; font-family: ui-monospace, monospace; font-size: 13px; }
|
||||
.tag {
|
||||
font-size: 11px;
|
||||
padding: 1px 6px;
|
||||
border-radius: 3px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10px;
|
||||
padding: 2px 7px;
|
||||
border-radius: var(--r-sm);
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.tag.new {
|
||||
background: rgba(34, 224, 255, 0.1);
|
||||
border-color: rgba(34, 224, 255, 0.3);
|
||||
color: var(--spark-500);
|
||||
}
|
||||
.tag.replaces {
|
||||
background: rgba(242, 230, 200, 0.08);
|
||||
border-color: rgba(242, 230, 200, 0.25);
|
||||
color: var(--cream);
|
||||
}
|
||||
.tag.ambig {
|
||||
background: rgba(255, 48, 80, 0.1);
|
||||
border-color: rgba(255, 48, 80, 0.3);
|
||||
color: var(--danger-500);
|
||||
}
|
||||
.tag.new { background: #2d4a2d; color: #a8e6a8; }
|
||||
.tag.replaces { background: #2d3a4a; color: #a8c8e6; }
|
||||
.tag.ambig { background: #4a2d2d; color: #ff8080; }
|
||||
form {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
gap: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
form input {
|
||||
flex: 1;
|
||||
background: #000;
|
||||
color: #ddd;
|
||||
border: 1px solid #444;
|
||||
border-radius: 3px;
|
||||
padding: 6px 8px;
|
||||
font-family: ui-monospace, monospace;
|
||||
background: var(--cherry-975);
|
||||
color: var(--ink-100);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 8px 10px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
}
|
||||
form input:focus {
|
||||
outline: none;
|
||||
border-color: var(--spark-500);
|
||||
box-shadow: var(--spark-glow);
|
||||
}
|
||||
button {
|
||||
background: #ff3030;
|
||||
color: #fff;
|
||||
border: 0;
|
||||
border-radius: 3px;
|
||||
padding: 6px 12px;
|
||||
background: var(--cherry-875);
|
||||
color: var(--ink-100);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 8px 14px;
|
||||
font-family: var(--font-body);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
}
|
||||
button:hover:not(:disabled) {
|
||||
border-color: var(--spark-500);
|
||||
box-shadow: var(--spark-glow);
|
||||
}
|
||||
button:disabled { opacity: 0.4; cursor: default; }
|
||||
button.primary {
|
||||
background: linear-gradient(180deg, var(--cherry-500), var(--cherry-600));
|
||||
border-color: var(--cherry-400);
|
||||
color: var(--cream);
|
||||
font-weight: 600;
|
||||
}
|
||||
button.danger {
|
||||
background: var(--cherry-925);
|
||||
border-color: rgba(255, 48, 80, 0.4);
|
||||
color: var(--danger-500);
|
||||
}
|
||||
button:disabled { opacity: 0.5; cursor: default; }
|
||||
button.danger { background: #7a2020; }
|
||||
.beta {
|
||||
padding: 8px 10px;
|
||||
margin: 6px 0;
|
||||
background: #1a1a1a;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #2a2a2a;
|
||||
padding: 12px 14px;
|
||||
margin: 8px 0;
|
||||
background: var(--cherry-875);
|
||||
border-radius: var(--r-sm);
|
||||
border: 1px solid var(--cherry-700);
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 4px;
|
||||
align-items: baseline;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.head strong { color: var(--cream); font-weight: 600; }
|
||||
.rev {
|
||||
color: var(--ink-500);
|
||||
font-size: 11px;
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
.row {
|
||||
font-size: 12px;
|
||||
color: var(--ink-300);
|
||||
margin: 3px 0;
|
||||
}
|
||||
.k {
|
||||
color: var(--ink-500);
|
||||
margin-right: 8px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.8px;
|
||||
}
|
||||
.actions { display: flex; gap: 6px; margin-top: 10px; }
|
||||
.flash {
|
||||
color: var(--danger-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
margin: 14px 0 0;
|
||||
}
|
||||
.rev { color: #666; font-size: 11px; }
|
||||
.row { font-size: 12px; color: #bbb; margin: 2px 0; }
|
||||
.k { color: #666; margin-right: 6px; font-family: ui-monospace, monospace; }
|
||||
.actions { display: flex; gap: 4px; margin-top: 8px; }
|
||||
.flash { color: #ff6060; font-size: 12px; margin: 12px 0 0; }
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
}
|
||||
let { size = 'md' }: Props = $props();
|
||||
</script>
|
||||
|
||||
<span class="mark mark-{size}">
|
||||
<svg class="bolt" viewBox="0 0 12 20" aria-hidden="true">
|
||||
<path d="M7 0 L1 11 L5 11 L4 20 L11 8 L7 8 Z" />
|
||||
</svg>
|
||||
<span class="word">ELECTRIC CHERRY</span>
|
||||
</span>
|
||||
|
||||
<style>
|
||||
.mark {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-family: var(--font-display);
|
||||
color: var(--cream);
|
||||
letter-spacing: 2px;
|
||||
line-height: 1;
|
||||
animation: cherry-fizz 6s ease-in-out infinite;
|
||||
}
|
||||
.mark-sm .word { font-size: 12px; letter-spacing: 1.5px; }
|
||||
.mark-md .word { font-size: 16px; }
|
||||
.mark-lg .word { font-size: 26px; letter-spacing: 3px; }
|
||||
|
||||
.bolt {
|
||||
fill: var(--spark-500);
|
||||
filter: drop-shadow(0 0 4px rgba(34, 224, 255, 0.7));
|
||||
}
|
||||
.mark-sm .bolt { width: 10px; height: 16px; }
|
||||
.mark-md .bolt { width: 12px; height: 20px; }
|
||||
.mark-lg .bolt { width: 18px; height: 30px; }
|
||||
</style>
|
||||
@@ -7,9 +7,6 @@
|
||||
}
|
||||
let { before, after, verb, relPath }: Props = $props();
|
||||
|
||||
// A tiny line-by-line diff. Not LCS — just presence-based. For GSC scripts
|
||||
// this reads fine; if we want proper Myers diff later, swap in `diff` npm
|
||||
// package and render the same rows.
|
||||
interface Row {
|
||||
kind: 'ctx' | 'add' | 'del';
|
||||
text: string;
|
||||
@@ -24,7 +21,6 @@
|
||||
const bsetBase: Row[] = blines.map((t) => ({ kind: 'add' as const, text: t }));
|
||||
if (a === null) return bsetBase;
|
||||
if (b === null) return asetBase;
|
||||
// interleave shared-prefix / shared-suffix trimming for readability
|
||||
let i = 0;
|
||||
while (i < alines.length && i < blines.length && alines[i] === blines[i]) i++;
|
||||
let j = 0;
|
||||
@@ -55,41 +51,62 @@
|
||||
|
||||
<style>
|
||||
.diff {
|
||||
background: #0f0f0f;
|
||||
border: 1px solid #333;
|
||||
border-radius: 4px;
|
||||
background: var(--cherry-975);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
margin: 8px 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
header {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 6px 10px;
|
||||
background: #1a1a1a;
|
||||
border-bottom: 1px solid #333;
|
||||
gap: 10px;
|
||||
padding: 8px 12px;
|
||||
background: var(--cherry-925);
|
||||
border-bottom: 1px solid var(--cherry-700);
|
||||
font-size: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
.verb {
|
||||
padding: 1px 6px;
|
||||
border-radius: 3px;
|
||||
font-family: ui-monospace, monospace;
|
||||
padding: 2px 8px;
|
||||
border-radius: var(--r-sm);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.8px;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.verb-added { background: #2d4a2d; color: #a8e6a8; }
|
||||
.verb-updated { background: #2d3a4a; color: #a8c8e6; }
|
||||
.verb-removed { background: #4a2d2d; color: #ff8080; }
|
||||
.verb-held { background: #3a2f00; color: #ffcc55; }
|
||||
.path { color: #ccc; font-family: ui-monospace, monospace; }
|
||||
.verb-added {
|
||||
background: rgba(34, 224, 255, 0.1);
|
||||
border-color: rgba(34, 224, 255, 0.3);
|
||||
color: var(--spark-500);
|
||||
}
|
||||
.verb-updated {
|
||||
background: rgba(242, 230, 200, 0.08);
|
||||
border-color: rgba(242, 230, 200, 0.25);
|
||||
color: var(--cream);
|
||||
}
|
||||
.verb-removed {
|
||||
background: rgba(255, 48, 80, 0.1);
|
||||
border-color: rgba(255, 48, 80, 0.3);
|
||||
color: var(--danger-500);
|
||||
}
|
||||
.verb-held {
|
||||
background: rgba(255, 176, 32, 0.1);
|
||||
border-color: rgba(255, 176, 32, 0.3);
|
||||
color: var(--amber-500);
|
||||
}
|
||||
.path { color: var(--ink-100); font-family: var(--font-mono); font-size: 12px; }
|
||||
pre {
|
||||
margin: 0;
|
||||
padding: 8px 10px;
|
||||
font-family: ui-monospace, monospace;
|
||||
padding: 10px 12px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
color: #ccc;
|
||||
line-height: 1.55;
|
||||
color: var(--ink-300);
|
||||
max-height: 500px;
|
||||
overflow: auto;
|
||||
}
|
||||
.ln { display: block; }
|
||||
.ln-add { background: rgba(45, 74, 45, 0.4); color: #a8e6a8; }
|
||||
.ln-del { background: rgba(74, 45, 45, 0.4); color: #ff8080; }
|
||||
.ln-add { background: rgba(34, 224, 255, 0.08); color: var(--spark-400); }
|
||||
.ln-del { background: rgba(255, 48, 80, 0.08); color: #ff8a9a; }
|
||||
</style>
|
||||
|
||||
@@ -8,24 +8,8 @@
|
||||
.slice(0, 8)
|
||||
);
|
||||
|
||||
function stateColor(state: string): string {
|
||||
switch (state) {
|
||||
case 'done': return '#2d4a2d';
|
||||
case 'failed': return '#4a2d2d';
|
||||
case 'pending': return '#3a2f00';
|
||||
case 'manual': return '#333';
|
||||
default: return '#222';
|
||||
}
|
||||
}
|
||||
|
||||
function stateFg(state: string): string {
|
||||
switch (state) {
|
||||
case 'done': return '#a8e6a8';
|
||||
case 'failed': return '#ff8080';
|
||||
case 'pending': return '#ffcc55';
|
||||
case 'manual': return '#aaa';
|
||||
default: return '#888';
|
||||
}
|
||||
function stateClass(state: string): string {
|
||||
return `chip chip-${state}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -46,8 +30,7 @@
|
||||
<div class="chips">
|
||||
{#each [...dep.servers.entries()] as [srv, meta] (srv)}
|
||||
<span
|
||||
class="chip"
|
||||
style="background:{stateColor(meta.state)};color:{stateFg(meta.state)}"
|
||||
class={stateClass(meta.state)}
|
||||
title={meta.error ?? (meta.players !== null ? `${meta.players}p` : meta.state)}
|
||||
>
|
||||
{srv}{meta.players !== null && meta.players > 0 ? ` ${meta.players}p` : ''}
|
||||
@@ -62,43 +45,84 @@
|
||||
|
||||
<style>
|
||||
.wrapper {
|
||||
background: #141414;
|
||||
border: 1px solid #333;
|
||||
border-radius: 6px;
|
||||
padding: 12px;
|
||||
background: var(--cherry-925);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-md);
|
||||
padding: 14px 16px;
|
||||
}
|
||||
header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-family: var(--font-body);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1.5px;
|
||||
color: var(--ink-300);
|
||||
}
|
||||
.empty {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
padding: 12px 0;
|
||||
}
|
||||
h3 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: #aaa; }
|
||||
.empty { color: #666; font-size: 13px; margin: 0; }
|
||||
.rows { display: grid; gap: 8px; }
|
||||
.row {
|
||||
display: block;
|
||||
color: #ddd;
|
||||
color: var(--ink-100);
|
||||
text-decoration: none;
|
||||
padding: 8px;
|
||||
background: #1a1a1a;
|
||||
border-radius: 4px;
|
||||
border: 1px solid transparent;
|
||||
padding: 10px 12px;
|
||||
background: var(--cherry-875);
|
||||
border-radius: var(--r-sm);
|
||||
border: 1px solid var(--cherry-700);
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
.row:hover { border-color: #444; }
|
||||
.row:hover { border-color: var(--spark-500); }
|
||||
.row-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.action { font-family: ui-monospace, monospace; font-size: 13px; }
|
||||
.count { color: #666; font-size: 12px; }
|
||||
.action { font-family: var(--font-mono); font-size: 12px; color: var(--cream); }
|
||||
.count { color: var(--ink-500); font-size: 11px; font-family: var(--font-mono); }
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
|
||||
.chip {
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
padding: 2px 7px;
|
||||
border-radius: var(--r-sm);
|
||||
font-size: 11px;
|
||||
font-family: ui-monospace, monospace;
|
||||
font-family: var(--font-mono);
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.chip-done {
|
||||
background: rgba(34, 224, 255, 0.1);
|
||||
border-color: rgba(34, 224, 255, 0.3);
|
||||
color: var(--spark-500);
|
||||
}
|
||||
.chip-failed {
|
||||
background: rgba(255, 48, 80, 0.1);
|
||||
border-color: rgba(255, 48, 80, 0.3);
|
||||
color: var(--danger-500);
|
||||
}
|
||||
.chip-pending {
|
||||
background: rgba(255, 176, 32, 0.1);
|
||||
border-color: rgba(255, 176, 32, 0.3);
|
||||
color: var(--amber-500);
|
||||
}
|
||||
.chip-held {
|
||||
background: rgba(242, 230, 200, 0.08);
|
||||
border-color: rgba(242, 230, 200, 0.25);
|
||||
color: var(--cream);
|
||||
}
|
||||
.chip-manual {
|
||||
background: var(--cherry-925);
|
||||
border-color: var(--cherry-700);
|
||||
color: var(--ink-500);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<script lang="ts">
|
||||
import type { RosterPlayer, Health } from '$ui/stores/servers.js';
|
||||
|
||||
interface Props {
|
||||
roster: RosterPlayer[] | null;
|
||||
health: Health;
|
||||
compact?: boolean; // hide guid column, cap rows
|
||||
limit?: number;
|
||||
}
|
||||
let { roster, health, compact = false, limit }: Props = $props();
|
||||
|
||||
let sorted = $derived(
|
||||
(roster ?? [])
|
||||
.slice()
|
||||
.sort((a, b) => b.score - a.score)
|
||||
.slice(0, limit ?? Infinity)
|
||||
);
|
||||
|
||||
function pingClass(ping: number): string {
|
||||
if (ping < 60) return 'ping-good';
|
||||
if (ping < 150) return 'ping-ok';
|
||||
return 'ping-bad';
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if health === 'offline'}
|
||||
<div class="state offline">server unreachable</div>
|
||||
{:else if !roster || roster.length === 0}
|
||||
<div class="state empty">lobby is empty</div>
|
||||
{:else}
|
||||
<table class="roster" class:compact>
|
||||
<thead>
|
||||
<tr>
|
||||
{#if !compact}<th class="col-num">#</th>{/if}
|
||||
<th class="col-name">player</th>
|
||||
<th class="col-score">score</th>
|
||||
<th class="col-ping">ping</th>
|
||||
{#if !compact}<th class="col-guid">guid</th>{/if}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each sorted as p (p.guid ?? p.name + '-' + p.num)}
|
||||
<tr>
|
||||
{#if !compact}<td class="col-num mono">{p.num ?? ''}</td>{/if}
|
||||
<td class="col-name">{p.name || '—'}</td>
|
||||
<td class="col-score mono">{p.score}</td>
|
||||
<td class="col-ping mono {pingClass(p.ping)}">{p.ping}</td>
|
||||
{#if !compact}<td class="col-guid mono">{p.guid ? p.guid.slice(0, 8) + '…' : '—'}</td>{/if}
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.state {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
padding: 10px 12px;
|
||||
border-radius: var(--r-sm);
|
||||
}
|
||||
.state.offline {
|
||||
color: var(--danger-500);
|
||||
background: rgba(255, 48, 80, 0.08);
|
||||
border: 1px solid rgba(255, 48, 80, 0.25);
|
||||
}
|
||||
.state.empty {
|
||||
color: var(--ink-500);
|
||||
background: var(--cherry-925);
|
||||
border: 1px dashed var(--cherry-700);
|
||||
}
|
||||
|
||||
.roster {
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
font-family: var(--font-body);
|
||||
font-size: 13px;
|
||||
color: var(--ink-100);
|
||||
}
|
||||
.roster thead th {
|
||||
text-align: left;
|
||||
font-family: var(--font-body);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1.2px;
|
||||
color: var(--ink-500);
|
||||
padding: 6px 10px;
|
||||
border-bottom: 1px solid var(--cherry-700);
|
||||
}
|
||||
.roster tbody td {
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid rgba(74, 15, 30, 0.4);
|
||||
}
|
||||
.roster tbody tr:hover td {
|
||||
background: rgba(34, 224, 255, 0.04);
|
||||
}
|
||||
.roster.compact tbody td { padding: 4px 8px; font-size: 12px; }
|
||||
|
||||
.mono { font-family: var(--font-mono); }
|
||||
.col-num { width: 40px; color: var(--ink-500); }
|
||||
.col-name { color: var(--cream); font-weight: 500; }
|
||||
.col-score { width: 90px; color: var(--spark-500); }
|
||||
.col-ping { width: 80px; }
|
||||
.col-guid { width: 110px; color: var(--ink-500); }
|
||||
|
||||
.ping-good { color: var(--spark-400); }
|
||||
.ping-ok { color: var(--cream-dim); }
|
||||
.ping-bad { color: var(--amber-500); }
|
||||
</style>
|
||||
@@ -1,4 +1,8 @@
|
||||
<script lang="ts">
|
||||
import StatusDot from './StatusDot.svelte';
|
||||
import type { RosterPlayer, Health } from '$ui/stores/servers.js';
|
||||
import { gametypeLabel } from '$ui/gametype.js';
|
||||
|
||||
interface Held {
|
||||
target: string;
|
||||
slug: string;
|
||||
@@ -6,32 +10,89 @@
|
||||
interface Props {
|
||||
name: string;
|
||||
players?: number | null;
|
||||
map?: string | null;
|
||||
gametype?: string | null;
|
||||
roster?: RosterPlayer[] | null;
|
||||
health?: Health;
|
||||
lastSeenAt?: string | null;
|
||||
lastError?: string | null;
|
||||
held?: Held[];
|
||||
lastRestartedAt?: string | null;
|
||||
restarting?: boolean;
|
||||
}
|
||||
let { name, players = null, held = [], lastRestartedAt = null, restarting = false }: Props = $props();
|
||||
let {
|
||||
name,
|
||||
players = null,
|
||||
map = null,
|
||||
gametype = null,
|
||||
roster = null,
|
||||
health = 'offline',
|
||||
lastSeenAt = null,
|
||||
lastError = null,
|
||||
held = [],
|
||||
lastRestartedAt = null,
|
||||
restarting = false
|
||||
}: Props = $props();
|
||||
|
||||
function ago(iso: string | null): string {
|
||||
if (!iso) return 'never';
|
||||
const d = Date.now() - new Date(iso).getTime();
|
||||
if (d < 60_000) return 'just now';
|
||||
if (d < 60_000) return `${Math.max(1, Math.floor(d / 1000))}s ago`;
|
||||
if (d < 3_600_000) return `${Math.floor(d / 60_000)}m ago`;
|
||||
if (d < 86_400_000) return `${Math.floor(d / 3_600_000)}h ago`;
|
||||
return `${Math.floor(d / 86_400_000)}d ago`;
|
||||
}
|
||||
|
||||
let topRoster = $derived(
|
||||
(roster ?? [])
|
||||
.slice()
|
||||
.sort((a, b) => b.score - a.score)
|
||||
.slice(0, 3)
|
||||
);
|
||||
let showRoster = $derived(health !== 'offline');
|
||||
let mapLabel = $derived(map ?? '—');
|
||||
let gtLabel = $derived(gametypeLabel(gametype));
|
||||
</script>
|
||||
|
||||
<a class="card" href="/servers/{name}" class:restarting>
|
||||
<a class="card" href="/servers/{name}" class:restarting class:offline={health === 'offline'}>
|
||||
<div class="head">
|
||||
<strong>{name}</strong>
|
||||
<span class="players" class:has-players={players !== null && players > 0}>
|
||||
{players ?? '—'}
|
||||
</span>
|
||||
<div class="name-row">
|
||||
<StatusDot {health} />
|
||||
<strong class="name">{name}</strong>
|
||||
</div>
|
||||
{#if health !== 'offline'}
|
||||
<span class="players" class:has-players={players !== null && players > 0}>
|
||||
{players ?? '—'}
|
||||
</span>
|
||||
{:else}
|
||||
<span class="players offline-badge">offline</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="meta">
|
||||
restart: {ago(lastRestartedAt)}
|
||||
<span class="map">{mapLabel}</span>
|
||||
{#if gtLabel}
|
||||
<span class="dot-sep">·</span>
|
||||
<span class="gt">{gtLabel}</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if showRoster}
|
||||
{#if topRoster.length > 0}
|
||||
<ul class="roster">
|
||||
{#each topRoster as p (p.guid ?? p.name)}
|
||||
<li>
|
||||
<span class="pname">{p.name || '—'}</span>
|
||||
<span class="pscore">{p.score}</span>
|
||||
<span class="pping">{p.ping}ms</span>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{:else if health !== 'offline'}
|
||||
<div class="lobby-empty">lobby is empty</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if held.length > 0}
|
||||
<div class="held">
|
||||
{#each held as h (h.target)}
|
||||
@@ -39,6 +100,19 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="foot">
|
||||
{#if health === 'offline' && lastError}
|
||||
<span class="err">{lastError}</span>
|
||||
{:else if lastSeenAt}
|
||||
<span>last seen {ago(lastSeenAt)}</span>
|
||||
{:else if lastRestartedAt}
|
||||
<span>restart {ago(lastRestartedAt)}</span>
|
||||
{:else}
|
||||
<span class="dim">no data</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if restarting}
|
||||
<div class="restarting-bar" aria-label="restarting"></div>
|
||||
{/if}
|
||||
@@ -46,50 +120,165 @@
|
||||
|
||||
<style>
|
||||
.card {
|
||||
display: block;
|
||||
background: #1a1a1a;
|
||||
border: 1px solid #333;
|
||||
border-radius: 6px;
|
||||
padding: 12px;
|
||||
color: #ddd;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
background:
|
||||
linear-gradient(180deg, var(--cherry-875) 0%, var(--cherry-925) 100%);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-md);
|
||||
padding: 14px 16px 12px;
|
||||
color: var(--ink-100);
|
||||
text-decoration: none;
|
||||
transition: border-color 0.15s;
|
||||
transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
|
||||
box-shadow: var(--shadow-card);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.card:hover { border-color: #555; }
|
||||
.card.restarting { border-color: #ffab00; }
|
||||
.card::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0 0 auto 0;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, transparent, var(--cherry-500), transparent);
|
||||
opacity: 0.5;
|
||||
}
|
||||
.card:hover {
|
||||
border-color: var(--spark-500);
|
||||
box-shadow: var(--spark-glow), var(--shadow-card);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.card.restarting { border-color: var(--amber-500); box-shadow: var(--amber-glow); }
|
||||
.card.offline { opacity: 0.75; }
|
||||
|
||||
.head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
||||
.name {
|
||||
font-family: var(--font-body);
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.3px;
|
||||
color: var(--cream);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.players {
|
||||
background: #222;
|
||||
padding: 2px 8px;
|
||||
background: var(--cherry-925);
|
||||
border: 1px solid var(--cherry-700);
|
||||
padding: 3px 10px;
|
||||
border-radius: 999px;
|
||||
font-family: ui-monospace, monospace;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
font-weight: 500;
|
||||
color: var(--ink-500);
|
||||
min-width: 34px;
|
||||
text-align: center;
|
||||
}
|
||||
.players.has-players { background: #2d4a2d; color: #a8e6a8; }
|
||||
.meta { color: #666; font-size: 12px; margin-top: 4px; }
|
||||
.held { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
|
||||
.players.has-players {
|
||||
color: var(--spark-500);
|
||||
border-color: var(--spark-500);
|
||||
box-shadow: var(--spark-glow);
|
||||
}
|
||||
.players.offline-badge {
|
||||
color: var(--danger-500);
|
||||
border-color: rgba(255, 48, 80, 0.4);
|
||||
font-family: var(--font-body);
|
||||
font-size: 10px;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
color: var(--ink-300);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.map { color: var(--cream-dim); }
|
||||
.gt { color: var(--ink-300); }
|
||||
.dot-sep { color: var(--ink-500); }
|
||||
|
||||
.roster {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.roster li {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto auto;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
padding: 2px 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
.pname {
|
||||
color: var(--cream);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.pscore {
|
||||
font-family: var(--font-mono);
|
||||
color: var(--spark-500);
|
||||
font-size: 11px;
|
||||
}
|
||||
.pping {
|
||||
font-family: var(--font-mono);
|
||||
color: var(--ink-300);
|
||||
font-size: 11px;
|
||||
min-width: 44px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.lobby-empty {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 11px;
|
||||
color: var(--ink-500);
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.held { display: flex; flex-wrap: wrap; gap: 4px; }
|
||||
.chip {
|
||||
background: #3a2f00;
|
||||
color: #ffcc55;
|
||||
border: 1px solid #665500;
|
||||
border-radius: 3px;
|
||||
background: rgba(242, 230, 200, 0.08);
|
||||
color: var(--cream);
|
||||
border: 1px solid rgba(242, 230, 200, 0.25);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 1px 6px;
|
||||
font-size: 11px;
|
||||
font-family: ui-monospace, monospace;
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
|
||||
.foot {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10.5px;
|
||||
color: var(--ink-500);
|
||||
letter-spacing: 0.3px;
|
||||
margin-top: auto;
|
||||
padding-top: 4px;
|
||||
}
|
||||
.err { color: var(--danger-500); }
|
||||
.dim { color: var(--ink-700); }
|
||||
|
||||
.restarting-bar {
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, transparent, #ffab00, transparent);
|
||||
margin-top: 8px;
|
||||
animation: slide 1.2s infinite linear;
|
||||
}
|
||||
@keyframes slide {
|
||||
from { background-position: -100% 0; }
|
||||
to { background-position: 200% 0; }
|
||||
background: linear-gradient(90deg, transparent, var(--amber-500), var(--spark-500), transparent);
|
||||
background-size: 200% 100%;
|
||||
animation: spark-slide 1.2s infinite linear;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<script lang="ts">
|
||||
import type { Health } from '$ui/stores/servers.js';
|
||||
interface Props {
|
||||
health: Health;
|
||||
size?: number;
|
||||
label?: string | null;
|
||||
}
|
||||
let { health, size = 8, label = null }: Props = $props();
|
||||
</script>
|
||||
|
||||
<span
|
||||
class="dot dot-{health}"
|
||||
style="width:{size}px;height:{size}px"
|
||||
aria-label={label ?? `server ${health}`}
|
||||
title={label ?? health}
|
||||
></span>
|
||||
|
||||
<style>
|
||||
.dot {
|
||||
display: inline-block;
|
||||
border-radius: 999px;
|
||||
vertical-align: middle;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.dot-online {
|
||||
background: var(--spark-500);
|
||||
animation: electric-pulse 1.6s ease-in-out infinite;
|
||||
}
|
||||
.dot-stale {
|
||||
background: var(--amber-500);
|
||||
box-shadow: var(--amber-glow);
|
||||
}
|
||||
.dot-offline {
|
||||
background: var(--danger-500);
|
||||
opacity: 0.6;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,21 @@
|
||||
// Friendly names for CoD gametype codes reported over RCON.
|
||||
const NAMES: Record<string, string> = {
|
||||
zclassic: 'Zombies Classic',
|
||||
zstandard: 'Zombies Standard',
|
||||
zgrief: 'Grief',
|
||||
zcleansed: 'Cleansed',
|
||||
ztag: 'Tag der Toten',
|
||||
dm: 'Deathmatch',
|
||||
tdm: 'Team Deathmatch',
|
||||
sd: 'Search & Destroy',
|
||||
dom: 'Domination',
|
||||
war: 'War',
|
||||
hq: 'Headquarters',
|
||||
ctf: 'Capture the Flag'
|
||||
};
|
||||
|
||||
export function gametypeLabel(code: string | null | undefined): string {
|
||||
if (!code) return '';
|
||||
const key = code.toLowerCase();
|
||||
return NAMES[key] ?? code;
|
||||
}
|
||||
@@ -1,10 +1,25 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
export interface RosterPlayer {
|
||||
num: number | null;
|
||||
score: number;
|
||||
ping: number;
|
||||
guid: string | null;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type Health = 'online' | 'stale' | 'offline';
|
||||
|
||||
export interface ServerStatus {
|
||||
server: string;
|
||||
players: number | null;
|
||||
name?: string;
|
||||
map: string | null;
|
||||
gametype: string | null;
|
||||
roster: RosterPlayer[] | null;
|
||||
health: Health;
|
||||
lastSeenAt: string | null;
|
||||
lastError: string | null;
|
||||
}
|
||||
|
||||
export const statusByServer = writable<Map<string, ServerStatus>>(new Map());
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/* Electric Cherry — design tokens.
|
||||
Named after the perk-a-cola from Mob of the Dead (CoD Zombies):
|
||||
deep cherry-red art-deco label + electric cyan discharge. */
|
||||
|
||||
@import '@fontsource/alfa-slab-one/400.css';
|
||||
@import '@fontsource/inter/400.css';
|
||||
@import '@fontsource/inter/500.css';
|
||||
@import '@fontsource/inter/600.css';
|
||||
@import '@fontsource/inter/700.css';
|
||||
@import '@fontsource/jetbrains-mono/400.css';
|
||||
@import '@fontsource/jetbrains-mono/500.css';
|
||||
|
||||
:root {
|
||||
/* Cherry — surfaces + primary */
|
||||
--cherry-975: #0b0407;
|
||||
--cherry-925: #170a0f;
|
||||
--cherry-875: #22101a;
|
||||
--cherry-825: #2c1420;
|
||||
--cherry-700: #4a0f1e;
|
||||
--cherry-600: #7a0f22;
|
||||
--cherry-500: #c8102e;
|
||||
--cherry-400: #e93656;
|
||||
--cherry-300: #ff7a92;
|
||||
|
||||
/* Spark — electric cyan */
|
||||
--spark-600: #14b8d0;
|
||||
--spark-500: #22e0ff;
|
||||
--spark-400: #7ef1ff;
|
||||
--spark-glow: 0 0 8px rgba(34, 224, 255, 0.55);
|
||||
--spark-glow-lg: 0 0 14px rgba(34, 224, 255, 0.45);
|
||||
|
||||
/* Neutrals + label */
|
||||
--cream: #f2e6c8;
|
||||
--cream-dim: #c9b98f;
|
||||
--ink-100: #f5eaec;
|
||||
--ink-300: #c8a4ac;
|
||||
--ink-500: #7a5560;
|
||||
--ink-700: #4a2f36;
|
||||
|
||||
/* State colors */
|
||||
--amber-500: #ffb020;
|
||||
--amber-glow: 0 0 8px rgba(255, 176, 32, 0.4);
|
||||
--danger-500: #ff3050;
|
||||
--success-500: var(--spark-500);
|
||||
|
||||
/* Typography */
|
||||
--font-display: 'Alfa Slab One', 'Georgia', serif;
|
||||
--font-body: 'Inter', system-ui, -apple-system, sans-serif;
|
||||
--font-mono: 'JetBrains Mono', ui-monospace, monospace;
|
||||
|
||||
/* Radii */
|
||||
--r-sm: 3px;
|
||||
--r-md: 6px;
|
||||
--r-lg: 10px;
|
||||
|
||||
/* Shadows */
|
||||
--shadow-card: 0 2px 12px rgba(0, 0, 0, 0.5);
|
||||
--shadow-panel: 0 4px 24px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
@keyframes electric-pulse {
|
||||
0%, 100% {
|
||||
box-shadow: 0 0 0 0 rgba(34, 224, 255, 0.55), var(--spark-glow);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 0 6px rgba(34, 224, 255, 0), var(--spark-glow-lg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes cherry-fizz {
|
||||
0%, 100% { transform: translateY(0); }
|
||||
50% { transform: translateY(-1px); }
|
||||
}
|
||||
|
||||
@keyframes spark-slide {
|
||||
from { background-position: -100% 0; }
|
||||
to { background-position: 200% 0; }
|
||||
}
|
||||
+70
-24
@@ -3,6 +3,7 @@
|
||||
import { startPipelineStream } from '$ui/stores/pipeline.js';
|
||||
import { startServerStream } from '$ui/stores/servers.js';
|
||||
import { page } from '$app/stores';
|
||||
import BrandMark from '$ui/components/BrandMark.svelte';
|
||||
|
||||
interface Props { children: import('svelte').Snippet }
|
||||
let { children }: Props = $props();
|
||||
@@ -15,10 +16,15 @@
|
||||
|
||||
<div class="shell">
|
||||
<nav>
|
||||
<a href="/" class:on={$page.url.pathname === '/'}>Fleet</a>
|
||||
<a href="/deployments" class:on={$page.url.pathname.startsWith('/deployments')}>Deployments</a>
|
||||
<a href="/betas" class:on={$page.url.pathname.startsWith('/betas')}>Betas</a>
|
||||
<span class="brand">electric-cherry</span>
|
||||
<a class="brand-link" href="/" aria-label="Electric Cherry home">
|
||||
<BrandMark size="md" />
|
||||
</a>
|
||||
<div class="tabs">
|
||||
<a href="/" class:on={$page.url.pathname === '/'}>Fleet</a>
|
||||
<a href="/deployments" class:on={$page.url.pathname.startsWith('/deployments')}>Deployments</a>
|
||||
<a href="/betas" class:on={$page.url.pathname.startsWith('/betas')}>Betas</a>
|
||||
</div>
|
||||
<div class="strut" aria-hidden="true"></div>
|
||||
</nav>
|
||||
<main>
|
||||
{@render children()}
|
||||
@@ -26,38 +32,78 @@
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@import '$ui/styles/tokens.css';
|
||||
|
||||
:global(html, body) {
|
||||
margin: 0;
|
||||
background: #0a0a0a;
|
||||
color: #ddd;
|
||||
font-family: system-ui, -apple-system, sans-serif;
|
||||
background: var(--cherry-975);
|
||||
color: var(--ink-100);
|
||||
font-family: var(--font-body);
|
||||
min-height: 100vh;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
:global(*) { box-sizing: border-box; }
|
||||
:global(a) { color: var(--spark-400); }
|
||||
:global(::selection) {
|
||||
background: var(--cherry-500);
|
||||
color: var(--cream);
|
||||
}
|
||||
|
||||
.shell { min-height: 100vh; }
|
||||
|
||||
nav {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding: 10px 20px;
|
||||
border-bottom: 1px solid #222;
|
||||
background: #0f0f0f;
|
||||
gap: 24px;
|
||||
padding: 14px 24px;
|
||||
align-items: center;
|
||||
background:
|
||||
linear-gradient(180deg, rgba(200, 16, 46, 0.18) 0%, transparent 100%),
|
||||
var(--cherry-925);
|
||||
border-bottom: 1px solid var(--cherry-700);
|
||||
box-shadow: 0 1px 0 0 rgba(200, 16, 46, 0.25);
|
||||
}
|
||||
nav a {
|
||||
color: #999;
|
||||
.brand-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-decoration: none;
|
||||
padding: 6px 10px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
margin-left: 12px;
|
||||
}
|
||||
.tabs a {
|
||||
color: var(--ink-300);
|
||||
text-decoration: none;
|
||||
padding: 8px 14px;
|
||||
border-radius: var(--r-sm);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.4px;
|
||||
position: relative;
|
||||
transition: color 0.15s;
|
||||
}
|
||||
nav a:hover { color: #ddd; background: #1a1a1a; }
|
||||
nav a.on { color: #ff6060; background: #1a1a1a; }
|
||||
.brand {
|
||||
margin-left: auto;
|
||||
font-family: ui-monospace, monospace;
|
||||
color: #444;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
.tabs a:hover { color: var(--ink-100); }
|
||||
.tabs a.on {
|
||||
color: var(--cream);
|
||||
}
|
||||
.tabs a.on::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 12px;
|
||||
right: 12px;
|
||||
bottom: -2px;
|
||||
height: 2px;
|
||||
background: var(--spark-500);
|
||||
box-shadow: var(--spark-glow);
|
||||
border-radius: 2px;
|
||||
}
|
||||
.strut { margin-left: auto; }
|
||||
|
||||
main {
|
||||
padding: 28px 24px 48px;
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
|
||||
</style>
|
||||
|
||||
+103
-21
@@ -3,6 +3,7 @@
|
||||
import ServerCard from '$ui/components/ServerCard.svelte';
|
||||
import PipelineTimeline from '$ui/components/PipelineTimeline.svelte';
|
||||
import { statusByServer } from '$ui/stores/servers.js';
|
||||
import type { RosterPlayer, Health } from '$ui/stores/servers.js';
|
||||
|
||||
interface HeldRow { target: string; slug: string; }
|
||||
interface ServerRow {
|
||||
@@ -12,6 +13,12 @@
|
||||
game_port: number | null;
|
||||
rcon_host: string | null;
|
||||
last_players: number | null;
|
||||
last_map: string | null;
|
||||
last_gametype: string | null;
|
||||
last_seen_at: string | null;
|
||||
last_error: string | null;
|
||||
roster: RosterPlayer[] | null;
|
||||
health: Health;
|
||||
held: HeldRow[];
|
||||
}
|
||||
|
||||
@@ -44,16 +51,39 @@
|
||||
: `pushed to ${body.totalChangedServers ?? 0} servers · ${body.totalFiles ?? 0} files`;
|
||||
}
|
||||
|
||||
function playersFor(name: string): number | null {
|
||||
const s = $statusByServer.get(name);
|
||||
return s?.players ?? null;
|
||||
// Live server view — merge SSE data over the initial GET
|
||||
function liveFor(name: string, fallback: ServerRow) {
|
||||
const live = $statusByServer.get(name);
|
||||
if (!live) {
|
||||
return {
|
||||
players: fallback.last_players,
|
||||
map: fallback.last_map,
|
||||
gametype: fallback.last_gametype,
|
||||
roster: fallback.roster,
|
||||
health: fallback.health,
|
||||
lastSeenAt: fallback.last_seen_at,
|
||||
lastError: fallback.last_error
|
||||
};
|
||||
}
|
||||
return {
|
||||
players: live.players,
|
||||
map: live.map,
|
||||
gametype: live.gametype,
|
||||
roster: live.roster,
|
||||
health: live.health,
|
||||
lastSeenAt: live.lastSeenAt,
|
||||
lastError: live.lastError
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="grid">
|
||||
<section class="left">
|
||||
<header class="hdr">
|
||||
<h1>Fleet</h1>
|
||||
<div class="title-block">
|
||||
<h1>Fleet</h1>
|
||||
<span class="count">{servers.length} server{servers.length === 1 ? '' : 's'}</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button onclick={() => push(true)} disabled={pushing}>dry run</button>
|
||||
<button class="primary" onclick={() => push(false)} disabled={pushing}>push all</button>
|
||||
@@ -65,9 +95,16 @@
|
||||
{:else}
|
||||
<div class="cards">
|
||||
{#each servers as s (s.name)}
|
||||
{@const live = liveFor(s.name, s)}
|
||||
<ServerCard
|
||||
name={s.name}
|
||||
players={playersFor(s.name) ?? s.last_players}
|
||||
players={live.players}
|
||||
map={live.map}
|
||||
gametype={live.gametype}
|
||||
roster={live.roster}
|
||||
health={live.health}
|
||||
lastSeenAt={live.lastSeenAt}
|
||||
lastError={live.lastError}
|
||||
held={s.held}
|
||||
/>
|
||||
{/each}
|
||||
@@ -84,7 +121,7 @@
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 380px;
|
||||
gap: 20px;
|
||||
gap: 24px;
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.grid { grid-template-columns: 1fr; }
|
||||
@@ -92,32 +129,77 @@
|
||||
.hdr {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
margin-bottom: 16px;
|
||||
align-items: flex-end;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 14px;
|
||||
border-bottom: 1px solid var(--cherry-700);
|
||||
}
|
||||
.title-block { display: flex; align-items: baseline; gap: 14px; }
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
color: #ff6060;
|
||||
font-family: var(--font-display);
|
||||
font-size: 32px;
|
||||
color: var(--cream);
|
||||
letter-spacing: 2px;
|
||||
line-height: 1;
|
||||
}
|
||||
.count {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
color: var(--ink-500);
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
.actions { display: flex; gap: 8px; }
|
||||
button {
|
||||
background: #222;
|
||||
color: #ddd;
|
||||
border: 1px solid #444;
|
||||
border-radius: 4px;
|
||||
padding: 8px 14px;
|
||||
background: var(--cherry-875);
|
||||
color: var(--ink-100);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 8px 16px;
|
||||
cursor: pointer;
|
||||
font-family: var(--font-body);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.3px;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
}
|
||||
button.primary { background: #ff3030; color: #fff; border-color: #ff3030; font-weight: 600; }
|
||||
button:disabled { opacity: 0.5; cursor: default; }
|
||||
button:hover:not(:disabled) {
|
||||
border-color: var(--spark-500);
|
||||
box-shadow: var(--spark-glow);
|
||||
}
|
||||
button.primary {
|
||||
background: linear-gradient(180deg, var(--cherry-500), var(--cherry-600));
|
||||
color: var(--cream);
|
||||
border-color: var(--cherry-400);
|
||||
font-weight: 600;
|
||||
}
|
||||
button.primary:hover:not(:disabled) {
|
||||
border-color: var(--spark-500);
|
||||
box-shadow: var(--spark-glow), 0 0 20px rgba(200, 16, 46, 0.4);
|
||||
}
|
||||
button:disabled { opacity: 0.4; cursor: default; }
|
||||
.cards {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||
gap: 14px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
}
|
||||
.empty {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 13px;
|
||||
padding: 40px;
|
||||
text-align: center;
|
||||
border: 1px dashed var(--cherry-700);
|
||||
border-radius: var(--r-md);
|
||||
}
|
||||
.flash {
|
||||
color: var(--spark-400);
|
||||
margin: 0 0 16px;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
padding: 10px 14px;
|
||||
background: rgba(34, 224, 255, 0.06);
|
||||
border: 1px solid rgba(34, 224, 255, 0.25);
|
||||
border-radius: var(--r-sm);
|
||||
}
|
||||
.empty { color: #666; }
|
||||
.flash { color: #aaa; margin: 0 0 12px; font-family: ui-monospace, monospace; font-size: 12px; }
|
||||
</style>
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { listServers, heldByBeta } from '$lib/server/fleet/servers.js';
|
||||
import { classifyHealth } from '$lib/server/fleet/health.js';
|
||||
import type { RconPlayer } from '$lib/server/integrations/rcon.js';
|
||||
|
||||
function safeJson<T>(raw: string | null): T | null {
|
||||
if (!raw) return null;
|
||||
try {
|
||||
return JSON.parse(raw) as T;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function GET() {
|
||||
const servers = listServers().map((s) => ({
|
||||
...s,
|
||||
roster: safeJson<RconPlayer[]>(s.last_roster),
|
||||
health: classifyHealth(s.last_seen_at, s.last_error),
|
||||
held: [...heldByBeta(s.name).entries()].map(([target, slug]) => ({ target, slug }))
|
||||
}));
|
||||
return json({ servers });
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
h1 { color: #ff6060; margin: 0 0 20px; }
|
||||
.empty { color: #666; }
|
||||
h1 {
|
||||
color: var(--cream);
|
||||
font-family: var(--font-display);
|
||||
font-size: 32px;
|
||||
letter-spacing: 2px;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
.empty {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -31,14 +31,8 @@
|
||||
return d.servers.some((s) => s.restart_state === 'pending' || s.restart_state === 'failed');
|
||||
}
|
||||
|
||||
function chipColor(state: string): { bg: string; fg: string } {
|
||||
switch (state) {
|
||||
case 'done': return { bg: '#2d4a2d', fg: '#a8e6a8' };
|
||||
case 'failed': return { bg: '#4a2d2d', fg: '#ff8080' };
|
||||
case 'pending': return { bg: '#3a2f00', fg: '#ffcc55' };
|
||||
case 'manual': return { bg: '#333', fg: '#aaa' };
|
||||
default: return { bg: '#222', fg: '#888' };
|
||||
}
|
||||
function chipClass(state: string): string {
|
||||
return `chip chip-${state}`;
|
||||
}
|
||||
|
||||
function ago(iso: string): string {
|
||||
@@ -89,8 +83,7 @@
|
||||
</div>
|
||||
<div class="chips">
|
||||
{#each d.servers as s (s.server)}
|
||||
{@const c = chipColor(s.restart_state)}
|
||||
<span class="chip" style="background:{c.bg};color:{c.fg}" title={s.error ?? ''}>
|
||||
<span class={chipClass(s.restart_state)} title={s.error ?? ''}>
|
||||
{s.server}{s.players !== null && s.players > 0 ? ` (${s.players}p)` : ''}
|
||||
</span>
|
||||
{/each}
|
||||
@@ -100,35 +93,78 @@
|
||||
{/snippet}
|
||||
|
||||
<style>
|
||||
h1 { color: #ff6060; margin: 0 0 20px; }
|
||||
h1 {
|
||||
color: var(--cream);
|
||||
font-family: var(--font-display);
|
||||
font-size: 32px;
|
||||
letter-spacing: 2px;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
h2 {
|
||||
margin: 30px 0 10px;
|
||||
font-size: 13px;
|
||||
margin: 28px 0 12px;
|
||||
font-family: var(--font-body);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: #888;
|
||||
letter-spacing: 1.5px;
|
||||
color: var(--ink-300);
|
||||
}
|
||||
.row {
|
||||
display: block;
|
||||
background: #141414;
|
||||
border: 1px solid #333;
|
||||
border-radius: 6px;
|
||||
padding: 12px;
|
||||
margin-bottom: 8px;
|
||||
color: #ddd;
|
||||
background: var(--cherry-925);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-md);
|
||||
padding: 14px 16px;
|
||||
margin-bottom: 10px;
|
||||
color: var(--ink-100);
|
||||
text-decoration: none;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
}
|
||||
.row:hover { border-color: #555; }
|
||||
.head { display: flex; justify-content: space-between; margin-bottom: 8px; }
|
||||
.action { font-family: ui-monospace, monospace; font-size: 13px; }
|
||||
.when { color: #666; font-size: 12px; }
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
|
||||
.row:hover { border-color: var(--spark-500); box-shadow: var(--spark-glow); }
|
||||
.head { display: flex; justify-content: space-between; margin-bottom: 8px; align-items: baseline; }
|
||||
.action { font-family: var(--font-mono); font-size: 13px; color: var(--cream); }
|
||||
.when { color: var(--ink-500); font-size: 12px; font-family: var(--font-mono); }
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
|
||||
.chip {
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
padding: 2px 7px;
|
||||
border-radius: var(--r-sm);
|
||||
font-size: 11px;
|
||||
font-family: ui-monospace, monospace;
|
||||
font-family: var(--font-mono);
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.chip-done {
|
||||
background: rgba(34, 224, 255, 0.1);
|
||||
border-color: rgba(34, 224, 255, 0.3);
|
||||
color: var(--spark-500);
|
||||
}
|
||||
.chip-failed {
|
||||
background: rgba(255, 48, 80, 0.1);
|
||||
border-color: rgba(255, 48, 80, 0.3);
|
||||
color: var(--danger-500);
|
||||
}
|
||||
.chip-pending {
|
||||
background: rgba(255, 176, 32, 0.1);
|
||||
border-color: rgba(255, 176, 32, 0.3);
|
||||
color: var(--amber-500);
|
||||
}
|
||||
.chip-held {
|
||||
background: rgba(242, 230, 200, 0.08);
|
||||
border-color: rgba(242, 230, 200, 0.25);
|
||||
color: var(--cream);
|
||||
}
|
||||
.chip-manual {
|
||||
background: var(--cherry-925);
|
||||
border-color: var(--cherry-700);
|
||||
color: var(--ink-500);
|
||||
}
|
||||
.id {
|
||||
color: var(--ink-700);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 11px;
|
||||
}
|
||||
.empty {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 13px;
|
||||
}
|
||||
.id { color: #444; font-family: ui-monospace, monospace; font-size: 11px; }
|
||||
.empty { color: #666; font-size: 13px; }
|
||||
</style>
|
||||
|
||||
@@ -116,88 +116,146 @@
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
h1 { color: #ff6060; margin: 0 0 4px; font-family: ui-monospace, monospace; font-size: 18px; }
|
||||
h2 {
|
||||
margin: 24px 0 8px;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: #888;
|
||||
h1 {
|
||||
color: var(--cream);
|
||||
font-family: var(--font-display);
|
||||
font-size: 24px;
|
||||
letter-spacing: 1.5px;
|
||||
margin: 0 0 6px;
|
||||
}
|
||||
h2 {
|
||||
margin: 26px 0 10px;
|
||||
font-family: var(--font-body);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1.5px;
|
||||
color: var(--ink-300);
|
||||
}
|
||||
h3 {
|
||||
margin: 14px 0 6px;
|
||||
font-size: 13px;
|
||||
color: var(--cream);
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
.meta {
|
||||
color: var(--ink-500);
|
||||
font-size: 12px;
|
||||
margin: 0 0 22px;
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
h3 { margin: 12px 0 4px; font-size: 13px; color: #ddd; font-family: ui-monospace, monospace; }
|
||||
.meta { color: #666; font-size: 12px; margin: 0 0 20px; font-family: ui-monospace, monospace; }
|
||||
.server-grid {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
gap: 10px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
||||
}
|
||||
.srv {
|
||||
background: #141414;
|
||||
border: 1px solid #333;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
background: var(--cherry-925);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 12px;
|
||||
}
|
||||
.srv-done { border-color: #2d4a2d; }
|
||||
.srv-failed { border-color: #4a2d2d; }
|
||||
.srv-pending { border-color: #3a2f00; }
|
||||
.name { font-weight: 600; margin-bottom: 4px; }
|
||||
.line { font-size: 12px; color: #bbb; }
|
||||
.line.dim { color: #666; }
|
||||
.line.err { color: #ff6060; }
|
||||
.file-group { margin-bottom: 12px; }
|
||||
.srv-done { border-color: rgba(34, 224, 255, 0.35); }
|
||||
.srv-failed { border-color: rgba(255, 48, 80, 0.35); }
|
||||
.srv-pending { border-color: rgba(255, 176, 32, 0.35); }
|
||||
.srv-held { border-color: rgba(242, 230, 200, 0.3); }
|
||||
.srv-manual { border-color: var(--ink-500); }
|
||||
.name {
|
||||
font-weight: 600;
|
||||
margin-bottom: 6px;
|
||||
color: var(--cream);
|
||||
}
|
||||
.line { font-size: 12px; color: var(--ink-300); font-family: var(--font-mono); }
|
||||
.line.dim { color: var(--ink-500); }
|
||||
.line.err { color: var(--danger-500); }
|
||||
.file-group { margin-bottom: 16px; }
|
||||
.file-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
background: #141414;
|
||||
border: 1px solid #2a2a2a;
|
||||
border-radius: 3px;
|
||||
padding: 4px 8px;
|
||||
margin: 2px 0;
|
||||
color: #ddd;
|
||||
background: var(--cherry-925);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 6px 10px;
|
||||
margin: 3px 0;
|
||||
color: var(--ink-100);
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
.file-row:hover { border-color: #444; }
|
||||
.file-row:hover { border-color: var(--spark-500); }
|
||||
.verb {
|
||||
padding: 1px 6px;
|
||||
border-radius: 3px;
|
||||
font-size: 11px;
|
||||
font-family: ui-monospace, monospace;
|
||||
padding: 2px 7px;
|
||||
border-radius: var(--r-sm);
|
||||
font-size: 10px;
|
||||
font-family: var(--font-mono);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.8px;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.verb-added {
|
||||
background: rgba(34, 224, 255, 0.1);
|
||||
border-color: rgba(34, 224, 255, 0.3);
|
||||
color: var(--spark-500);
|
||||
}
|
||||
.verb-updated {
|
||||
background: rgba(242, 230, 200, 0.08);
|
||||
border-color: rgba(242, 230, 200, 0.25);
|
||||
color: var(--cream);
|
||||
}
|
||||
.verb-removed {
|
||||
background: rgba(255, 48, 80, 0.1);
|
||||
border-color: rgba(255, 48, 80, 0.3);
|
||||
color: var(--danger-500);
|
||||
}
|
||||
.verb-held {
|
||||
background: rgba(255, 176, 32, 0.1);
|
||||
border-color: rgba(255, 176, 32, 0.3);
|
||||
color: var(--amber-500);
|
||||
}
|
||||
.sizes {
|
||||
margin-left: auto;
|
||||
color: var(--ink-500);
|
||||
font-size: 11px;
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
code { font-family: var(--font-mono); color: var(--ink-100); }
|
||||
.empty {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 13px;
|
||||
}
|
||||
.verb-added { background: #2d4a2d; color: #a8e6a8; }
|
||||
.verb-updated { background: #2d3a4a; color: #a8c8e6; }
|
||||
.verb-removed { background: #4a2d2d; color: #ff8080; }
|
||||
.verb-held { background: #3a2f00; color: #ffcc55; }
|
||||
.sizes { margin-left: auto; color: #666; font-size: 11px; font-family: ui-monospace, monospace; }
|
||||
code { font-family: ui-monospace, monospace; color: #ddd; }
|
||||
.empty { color: #666; }
|
||||
.diff-scrim {
|
||||
position: fixed; inset: 0;
|
||||
background: rgba(0, 0, 0, 0.75);
|
||||
background: rgba(4, 2, 3, 0.85);
|
||||
z-index: 100;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
.diff-modal {
|
||||
max-width: 1000px;
|
||||
width: 92%;
|
||||
max-height: 92vh;
|
||||
overflow: auto;
|
||||
background: #0a0a0a;
|
||||
border: 1px solid #444;
|
||||
border-radius: 6px;
|
||||
padding: 16px;
|
||||
background: var(--cherry-925);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-md);
|
||||
padding: 20px;
|
||||
box-shadow: var(--shadow-panel);
|
||||
}
|
||||
.close {
|
||||
float: right;
|
||||
background: #222;
|
||||
color: #ddd;
|
||||
border: 1px solid #444;
|
||||
border-radius: 3px;
|
||||
padding: 4px 10px;
|
||||
background: var(--cherry-875);
|
||||
color: var(--ink-100);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 5px 12px;
|
||||
font-family: var(--font-body);
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.close:hover { border-color: var(--spark-500); box-shadow: var(--spark-glow); }
|
||||
</style>
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { statusByServer } from '$ui/stores/servers.js';
|
||||
import type { RosterPlayer, Health } from '$ui/stores/servers.js';
|
||||
import StatusDot from '$ui/components/StatusDot.svelte';
|
||||
import PlayerRoster from '$ui/components/PlayerRoster.svelte';
|
||||
import { gametypeLabel } from '$ui/gametype.js';
|
||||
|
||||
interface Server {
|
||||
name: string;
|
||||
@@ -12,6 +16,12 @@
|
||||
rcon_host: string | null;
|
||||
last_players: number | null;
|
||||
last_checked_at: string | null;
|
||||
last_map: string | null;
|
||||
last_gametype: string | null;
|
||||
last_seen_at: string | null;
|
||||
last_error: string | null;
|
||||
roster: RosterPlayer[] | null;
|
||||
health: Health;
|
||||
held: Array<{ target: string; slug: string }>;
|
||||
}
|
||||
interface DeploymentRow {
|
||||
@@ -34,96 +44,243 @@
|
||||
history = depBody.deployments.filter((d) => d.servers.some((s) => s.server === name));
|
||||
});
|
||||
|
||||
let live = $derived($statusByServer.get(name)?.players);
|
||||
let live = $derived($statusByServer.get(name));
|
||||
let effectivePlayers = $derived(live?.players ?? server?.last_players ?? null);
|
||||
let effectiveMap = $derived(live?.map ?? server?.last_map ?? null);
|
||||
let effectiveGametype = $derived(live?.gametype ?? server?.last_gametype ?? null);
|
||||
let effectiveRoster = $derived(live?.roster ?? server?.roster ?? null);
|
||||
let effectiveHealth = $derived<Health>(live?.health ?? server?.health ?? 'offline');
|
||||
let effectiveSeen = $derived(live?.lastSeenAt ?? server?.last_seen_at ?? null);
|
||||
let effectiveErr = $derived(live?.lastError ?? server?.last_error ?? null);
|
||||
|
||||
function ago(iso: string | null): string {
|
||||
if (!iso) return 'never';
|
||||
const d = Date.now() - new Date(iso).getTime();
|
||||
if (d < 60_000) return `${Math.max(1, Math.floor(d / 1000))}s ago`;
|
||||
if (d < 3_600_000) return `${Math.floor(d / 60_000)}m ago`;
|
||||
if (d < 86_400_000) return `${Math.floor(d / 3_600_000)}h ago`;
|
||||
return `${Math.floor(d / 86_400_000)}d ago`;
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if server}
|
||||
<h1>{server.name}</h1>
|
||||
<div class="stats">
|
||||
<div class="stat">
|
||||
<div class="k">players</div>
|
||||
<div class="v">{live ?? server.last_players ?? '—'}</div>
|
||||
<section class="hero">
|
||||
<div class="hero-top">
|
||||
<div class="name-row">
|
||||
<StatusDot health={effectiveHealth} size={12} />
|
||||
<h1>{server.name}</h1>
|
||||
</div>
|
||||
<div class="player-block">
|
||||
<div class="player-count" class:has-players={(effectivePlayers ?? 0) > 0}>
|
||||
{effectivePlayers ?? '—'}
|
||||
</div>
|
||||
<div class="player-label">players</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="k">komodo</div>
|
||||
<div class="v">{server.komodo_type} · {server.komodo_name}</div>
|
||||
<div class="hero-meta">
|
||||
<span class="pair"><span class="k">map</span> <span class="v">{effectiveMap ?? '—'}</span></span>
|
||||
<span class="pair"><span class="k">mode</span> <span class="v">{gametypeLabel(effectiveGametype) || '—'}</span></span>
|
||||
<span class="pair"><span class="k">status</span> <span class="v health-{effectiveHealth}">{effectiveHealth}</span></span>
|
||||
<span class="pair"><span class="k">last seen</span> <span class="v">{ago(effectiveSeen)}</span></span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="k">rcon</div>
|
||||
<div class="v">{server.rcon_host ?? 'default'} · port {server.game_port ?? '—'}</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="k">last check</div>
|
||||
<div class="v">{server.last_checked_at ?? '—'}</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="k">held by beta</div>
|
||||
<div class="v">{server.held.length === 0 ? '—' : server.held.map((h) => h.target).join(', ')}</div>
|
||||
</div>
|
||||
</div>
|
||||
{#if effectiveErr && effectiveHealth !== 'online'}
|
||||
<div class="hero-error">RCON: {effectiveErr}</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<h2>Deployment history</h2>
|
||||
{#if history.length === 0}
|
||||
<p class="empty">no deployments recorded on this server</p>
|
||||
{:else}
|
||||
{#each history as d (d.id)}
|
||||
{@const mine = d.servers.find((s) => s.server === name)!}
|
||||
<a class="row row-{mine.restart_state}" href="/deployments/{d.id}">
|
||||
<span class="a">{d.action}</span>
|
||||
<span class="s">{mine.restart_state}{mine.players !== null && mine.players > 0 ? ` (${mine.players}p)` : ''}</span>
|
||||
<span class="f">{mine.files_changed} file{mine.files_changed === 1 ? '' : 's'}</span>
|
||||
<span class="w">{d.started_at}</span>
|
||||
{#if mine.error}<span class="err">{mine.error}</span>{/if}
|
||||
</a>
|
||||
{/each}
|
||||
{/if}
|
||||
<section class="panel">
|
||||
<h2>Roster</h2>
|
||||
<PlayerRoster roster={effectiveRoster} health={effectiveHealth} />
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Config</h2>
|
||||
<div class="stats">
|
||||
<div class="stat">
|
||||
<div class="k">komodo</div>
|
||||
<div class="v mono">{server.komodo_type} · {server.komodo_name}</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="k">rcon</div>
|
||||
<div class="v mono">{server.rcon_host ?? 'default'} · port {server.game_port ?? '—'}</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="k">held by beta</div>
|
||||
<div class="v mono">{server.held.length === 0 ? '—' : server.held.map((h) => h.target).join(', ')}</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Deployment history</h2>
|
||||
{#if history.length === 0}
|
||||
<p class="empty">no deployments recorded on this server</p>
|
||||
{:else}
|
||||
{#each history as d (d.id)}
|
||||
{@const mine = d.servers.find((s) => s.server === name)!}
|
||||
<a class="row row-{mine.restart_state}" href="/deployments/{d.id}">
|
||||
<span class="a">{d.action}</span>
|
||||
<span class="s">{mine.restart_state}{mine.players !== null && mine.players > 0 ? ` (${mine.players}p)` : ''}</span>
|
||||
<span class="f">{mine.files_changed} file{mine.files_changed === 1 ? '' : 's'}</span>
|
||||
<span class="w">{ago(d.started_at)}</span>
|
||||
{#if mine.error}<span class="err">{mine.error}</span>{/if}
|
||||
</a>
|
||||
{/each}
|
||||
{/if}
|
||||
</section>
|
||||
{:else}
|
||||
<p class="empty">loading…</p>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
h1 { color: #ff6060; margin: 0 0 20px; }
|
||||
h2 {
|
||||
margin: 30px 0 10px;
|
||||
font-size: 13px;
|
||||
.hero {
|
||||
background:
|
||||
linear-gradient(180deg, var(--cherry-875) 0%, var(--cherry-925) 100%);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-md);
|
||||
padding: 24px 28px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: var(--shadow-panel);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.hero::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0 0 auto 0;
|
||||
height: 3px;
|
||||
background: linear-gradient(90deg, transparent, var(--cherry-500), var(--spark-500), transparent);
|
||||
}
|
||||
.hero-top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 20px;
|
||||
}
|
||||
.name-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-family: var(--font-display);
|
||||
font-size: 28px;
|
||||
letter-spacing: 1.5px;
|
||||
color: var(--cream);
|
||||
line-height: 1;
|
||||
}
|
||||
.player-block { text-align: right; }
|
||||
.player-count {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 40px;
|
||||
font-weight: 500;
|
||||
color: var(--ink-500);
|
||||
line-height: 1;
|
||||
}
|
||||
.player-count.has-players {
|
||||
color: var(--spark-500);
|
||||
text-shadow: var(--spark-glow);
|
||||
}
|
||||
.player-label {
|
||||
font-family: var(--font-body);
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: #888;
|
||||
letter-spacing: 1.5px;
|
||||
color: var(--ink-500);
|
||||
margin-top: 4px;
|
||||
}
|
||||
.hero-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px;
|
||||
margin-top: 18px;
|
||||
padding-top: 14px;
|
||||
border-top: 1px solid var(--cherry-700);
|
||||
font-size: 13px;
|
||||
}
|
||||
.pair { display: flex; align-items: baseline; gap: 6px; font-family: var(--font-mono); }
|
||||
.pair .k {
|
||||
color: var(--ink-500);
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.pair .v { color: var(--ink-100); }
|
||||
.v.health-online { color: var(--spark-500); }
|
||||
.v.health-stale { color: var(--amber-500); }
|
||||
.v.health-offline { color: var(--danger-500); }
|
||||
.hero-error {
|
||||
margin-top: 12px;
|
||||
padding: 8px 12px;
|
||||
background: rgba(255, 48, 80, 0.08);
|
||||
border: 1px solid rgba(255, 48, 80, 0.25);
|
||||
color: var(--danger-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
border-radius: var(--r-sm);
|
||||
}
|
||||
|
||||
.panel {
|
||||
background: var(--cherry-925);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-md);
|
||||
padding: 18px 20px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
h2 {
|
||||
margin: 0 0 12px;
|
||||
font-family: var(--font-body);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1.5px;
|
||||
color: var(--ink-300);
|
||||
}
|
||||
.stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
.stat {
|
||||
background: #141414;
|
||||
border: 1px solid #333;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
background: var(--cherry-875);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
padding: 10px 12px;
|
||||
}
|
||||
.k { color: #666; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
|
||||
.v { color: #ddd; font-family: ui-monospace, monospace; margin-top: 4px; }
|
||||
.stat .k {
|
||||
color: var(--ink-500);
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.stat .v { color: var(--ink-100); margin-top: 4px; font-size: 13px; }
|
||||
.mono { font-family: var(--font-mono); }
|
||||
|
||||
.row {
|
||||
display: grid;
|
||||
grid-template-columns: 200px 160px 100px 220px 1fr;
|
||||
grid-template-columns: 200px 160px 100px 120px 1fr;
|
||||
gap: 12px;
|
||||
padding: 8px 12px;
|
||||
background: #141414;
|
||||
border: 1px solid #2a2a2a;
|
||||
border-radius: 4px;
|
||||
padding: 10px 14px;
|
||||
background: var(--cherry-875);
|
||||
border: 1px solid var(--cherry-700);
|
||||
border-radius: var(--r-sm);
|
||||
margin: 4px 0;
|
||||
color: #ddd;
|
||||
color: var(--ink-100);
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
font-family: ui-monospace, monospace;
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
.row:hover { border-color: var(--spark-500); box-shadow: var(--spark-glow); }
|
||||
.row-done { border-left: 3px solid var(--spark-500); }
|
||||
.row-failed { border-left: 3px solid var(--danger-500); }
|
||||
.row-pending { border-left: 3px solid var(--amber-500); }
|
||||
.row-held { border-left: 3px solid var(--cream); }
|
||||
.row-manual { border-left: 3px solid var(--ink-500); }
|
||||
.a { color: var(--cream); }
|
||||
.s { color: var(--ink-300); }
|
||||
.f { color: var(--ink-500); }
|
||||
.w { color: var(--ink-500); }
|
||||
.err { color: var(--danger-500); }
|
||||
.empty {
|
||||
color: var(--ink-500);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 13px;
|
||||
}
|
||||
.row-done { border-left: 3px solid #2d4a2d; }
|
||||
.row-failed { border-left: 3px solid #4a2d2d; }
|
||||
.row-pending { border-left: 3px solid #3a2f00; }
|
||||
.a { color: #ddd; }
|
||||
.s { color: #aaa; }
|
||||
.f { color: #888; }
|
||||
.w { color: #666; }
|
||||
.err { color: #ff6060; }
|
||||
.empty { color: #666; }
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<!-- Cherry body -->
|
||||
<circle cx="24" cy="44" r="14" fill="#c8102e" stroke="#4a0f1e" stroke-width="2"/>
|
||||
<circle cx="45" cy="46" r="12" fill="#e93656" stroke="#4a0f1e" stroke-width="2"/>
|
||||
<!-- Highlights -->
|
||||
<ellipse cx="20" cy="38" rx="3" ry="2" fill="#ff7a92" opacity="0.7"/>
|
||||
<ellipse cx="42" cy="42" rx="2.5" ry="1.6" fill="#ff7a92" opacity="0.7"/>
|
||||
<!-- Stems -->
|
||||
<path d="M24 30 Q26 18 34 12" fill="none" stroke="#4a2f36" stroke-width="2.5" stroke-linecap="round"/>
|
||||
<path d="M45 34 Q42 22 34 12" fill="none" stroke="#4a2f36" stroke-width="2.5" stroke-linecap="round"/>
|
||||
<!-- Lightning bolt over the fruit -->
|
||||
<path d="M38 4 L30 22 L36 22 L34 34 L46 18 L40 18 L44 4 Z"
|
||||
fill="#22e0ff"
|
||||
stroke="#0b0407"
|
||||
stroke-width="1.5"
|
||||
stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 897 B |
+57
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { parseInfoLine, parsePlayerCount } from '../../src/lib/server/integrations/rcon.js';
|
||||
import { parseInfoLine, parsePlayerCount, parsePlayerRoster } from '../../src/lib/server/integrations/rcon.js';
|
||||
|
||||
describe('parsePlayerCount', () => {
|
||||
it('counts rows after --- --- separator (status dialect)', () => {
|
||||
@@ -57,3 +57,59 @@ describe('parseInfoLine', () => {
|
||||
expect(parseInfoLine('nothing here')).toEqual({});
|
||||
});
|
||||
});
|
||||
|
||||
describe('parsePlayerRoster', () => {
|
||||
it('extracts num/score/ping/guid/name from print dialect', () => {
|
||||
const body = [
|
||||
'print',
|
||||
'map: mp_kino',
|
||||
'num score ping guid name',
|
||||
'--- ----- ---- -------- ----',
|
||||
' 0 12 45 aaaaaaaabbbbbbbbccccccccdddddddd joe',
|
||||
' 1 0 72 11112222333344445555666677778888 jill h.',
|
||||
' 2 999 128 abcdef0123456789abcdef0123456789 Toaster'
|
||||
].join('\n');
|
||||
const roster = parsePlayerRoster(body);
|
||||
expect(roster).toHaveLength(3);
|
||||
expect(roster[0]).toEqual({
|
||||
num: 0,
|
||||
score: 12,
|
||||
ping: 45,
|
||||
guid: 'aaaaaaaabbbbbbbbccccccccdddddddd',
|
||||
name: 'joe'
|
||||
});
|
||||
// Names with spaces stay intact
|
||||
expect(roster[1].name).toBe('jill h.');
|
||||
expect(roster[2].ping).toBe(128);
|
||||
});
|
||||
|
||||
it('extracts score/ping/quoted-name from statusResponse dialect', () => {
|
||||
const body = [
|
||||
'statusResponse',
|
||||
'\\mapname\\mp_kino\\g_gametype\\zclassic',
|
||||
'10 45 "joe"',
|
||||
'0 72 "jill h."'
|
||||
].join('\n');
|
||||
const roster = parsePlayerRoster(body);
|
||||
expect(roster).toHaveLength(2);
|
||||
expect(roster[0]).toEqual({
|
||||
num: null,
|
||||
score: 10,
|
||||
ping: 45,
|
||||
guid: null,
|
||||
name: 'joe'
|
||||
});
|
||||
expect(roster[1].name).toBe('jill h.');
|
||||
});
|
||||
|
||||
it('returns empty array when no rows are present', () => {
|
||||
const empty = [
|
||||
'print',
|
||||
'map: mp_ascension',
|
||||
'num score ping guid name',
|
||||
'--- ----- ---- -------- ----'
|
||||
].join('\n');
|
||||
expect(parsePlayerRoster(empty)).toEqual([]);
|
||||
expect(parsePlayerRoster('nonsense')).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user