feat: Phase 0 shells, design system, server skeleton, Docker and CI
- Titano.Ui: DESIGN.md tokens (dark/light), generated 16-px icon set, styles for all standard controls, custom chrome window with snap layouts, rail, job bar, Auto/manual slider, chips, toasts. - Titano desktop shell with sections, Settings (language, theme), About and a --capture screenshot mode. - Titano Server skeleton: env/server.json configuration, self-signed TLS with fingerprint, /health, /server/info, i18n endpoint and the embedded admin panel; in-process server tests. - Docker image (multi-arch, PUID/PGID, health check), compose file, Unraid template; CI, release and nightly workflows; changelog tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
122 files changed
+6838
-22
No files matched your search
@@ -0,0 +1,100 @@
|
||||
/* Titano Server admin — DESIGN.md light tokens (the web admin is light-only). */
|
||||
:root {
|
||||
--bg: #f3f3f3;
|
||||
--chrome: #ffffff;
|
||||
--surface: #ffffff;
|
||||
--card: #ffffff;
|
||||
--card-hover: #f5f5f5;
|
||||
--stroke: #e5e5e5;
|
||||
--stroke-strong: #d1d1d1;
|
||||
--text: #1a1a1a;
|
||||
--text-muted: #616161;
|
||||
--text-faint: #9e9e9e;
|
||||
--accent: #0067c0;
|
||||
--accent-hover: #1975c5;
|
||||
--on-accent: #ffffff;
|
||||
--accent-selected: #e8f1fa;
|
||||
--sun: #e08a1e;
|
||||
--success: #0f7b4f;
|
||||
--warning: #9a6700;
|
||||
--error: #c42b1c;
|
||||
--radius: 6px;
|
||||
--radius-card: 8px;
|
||||
--font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Noto Sans", sans-serif;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
html, body { height: 100%; }
|
||||
body { margin: 0; font: 13px/1.45 var(--font); color: var(--text); background: var(--bg); }
|
||||
button, input, select { font: inherit; color: inherit; }
|
||||
a { color: var(--accent); }
|
||||
.num { font-variant-numeric: tabular-nums; }
|
||||
|
||||
/* Shell */
|
||||
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
|
||||
.sidebar { background: var(--chrome); border-right: 1px solid var(--stroke); display: flex; flex-direction: column; padding: 16px 12px; }
|
||||
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
|
||||
.brand img { width: 28px; height: 28px; }
|
||||
.brand strong { display: block; font-size: 14px; }
|
||||
.brand span { display: block; font-size: 11px; color: var(--text-muted); }
|
||||
.nav a { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 12px; border-radius: var(--radius); color: var(--text); text-decoration: none; margin-bottom: 2px; }
|
||||
.nav a:hover { background: var(--card-hover); }
|
||||
.nav a[aria-current="page"] { background: var(--accent-selected); color: var(--accent); font-weight: 600; }
|
||||
.nav svg { width: 16px; height: 16px; flex: none; }
|
||||
.nav .badge { margin-left: auto; min-width: 18px; height: 16px; padding: 0 5px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
|
||||
.sidebar .user { margin-top: auto; border-top: 1px solid var(--stroke); padding: 12px 8px 0; display: flex; align-items: center; gap: 10px; }
|
||||
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-selected); color: var(--accent); display: grid; place-items: center; font-weight: 600; }
|
||||
.user .who { flex: 1; min-width: 0; }
|
||||
.user .who strong { display: block; }
|
||||
.user .who span { color: var(--text-muted); font-size: 11px; }
|
||||
|
||||
.main { display: flex; flex-direction: column; min-width: 0; }
|
||||
.header { height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--stroke); background: var(--chrome); }
|
||||
.header h1 { font-size: 18px; font-weight: 600; margin: 0; }
|
||||
.header .meta { color: var(--text-muted); }
|
||||
.header .spacer { flex: 1; }
|
||||
.content { padding: 24px; display: grid; gap: 20px; }
|
||||
|
||||
/* Controls */
|
||||
.btn { height: 32px; min-width: 44px; padding: 0 12px; border: 1px solid var(--stroke); border-radius: var(--radius); background: var(--card); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
|
||||
.btn:hover { background: var(--card-hover); border-color: var(--stroke-strong); }
|
||||
.btn:focus-visible, .input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
|
||||
.btn.primary:hover { background: var(--accent-hover); }
|
||||
.btn.subtle { border-color: transparent; background: transparent; }
|
||||
.btn.icon { width: 32px; padding: 0; }
|
||||
.btn:disabled { opacity: .4; cursor: default; }
|
||||
.input { height: 32px; width: 100%; padding: 0 10px; border: 1px solid var(--stroke); border-radius: var(--radius); background: var(--card); }
|
||||
.input:hover { border-color: var(--stroke-strong); }
|
||||
.input:focus { border-color: var(--accent); outline: none; }
|
||||
.input[aria-invalid="true"] { border-color: var(--error); }
|
||||
select.input { padding-right: 24px; }
|
||||
|
||||
.panel { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius-card); padding: 18px 20px; }
|
||||
.panel h2 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
|
||||
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
|
||||
.tile .label { color: var(--text-muted); }
|
||||
.tile .value { font-size: 28px; font-weight: 600; margin-top: 4px; }
|
||||
.tile .value small { font-size: 13px; font-weight: 400; color: var(--text-muted); margin-left: 6px; }
|
||||
.tile .sub { color: var(--text-muted); margin-top: 6px; }
|
||||
.progress { height: 6px; border-radius: 3px; background: var(--stroke); overflow: hidden; margin-top: 10px; }
|
||||
.progress > div { height: 6px; background: var(--accent); }
|
||||
|
||||
.status-ok { color: var(--success); }
|
||||
.status-warn { color: var(--warning); }
|
||||
.status-err { color: var(--error); }
|
||||
|
||||
/* Login */
|
||||
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
|
||||
.login form { width: 360px; max-width: 100%; display: grid; gap: 14px; }
|
||||
.login .brand { padding: 0 0 8px; }
|
||||
.login label { display: grid; gap: 6px; color: var(--text-muted); }
|
||||
.login .error { color: var(--error); min-height: 18px; }
|
||||
|
||||
@media (max-width: 800px) {
|
||||
.shell { grid-template-columns: 1fr; }
|
||||
.sidebar { flex-direction: row; overflow-x: auto; padding: 8px; }
|
||||
.sidebar .brand, .sidebar .user { display: none; }
|
||||
.nav { display: flex; gap: 4px; }
|
||||
.nav a span { display: none; }
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// Same API as the desktop clients: cookie session + double-submit CSRF token for the web admin (BRIEF §14.2).
|
||||
export class ApiFailure extends Error {
|
||||
constructor(status, code, message) {
|
||||
super(message);
|
||||
this.status = status;
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
|
||||
const SESSION_KEY = "titano.admin.user";
|
||||
|
||||
function csrfToken() {
|
||||
const m = document.cookie.match(/(?:^|; )titano_csrf=([^;]+)/);
|
||||
return m ? decodeURIComponent(m[1]) : "";
|
||||
}
|
||||
|
||||
async function request(method, url, body) {
|
||||
const headers = { Accept: "application/json" };
|
||||
if (body !== undefined) headers["Content-Type"] = "application/json";
|
||||
if (method !== "GET") headers["X-CSRF-Token"] = csrfToken();
|
||||
const res = await fetch(url, { method, headers, credentials: "same-origin", body: body === undefined ? undefined : JSON.stringify(body) });
|
||||
if (res.status === 401 && url !== "/api/v1/auth/login") sessionStorage.removeItem(SESSION_KEY);
|
||||
if (!res.ok) {
|
||||
let err = { code: "http_" + res.status, message: res.statusText };
|
||||
try { err = await res.json(); } catch { /* non-JSON error */ }
|
||||
throw new ApiFailure(res.status, err.code, err.message);
|
||||
}
|
||||
return res.status === 204 ? null : res.json();
|
||||
}
|
||||
|
||||
export const api = {
|
||||
get: (url) => request("GET", url),
|
||||
post: (url, body) => request("POST", url, body ?? {}),
|
||||
patch: (url, body) => request("PATCH", url, body),
|
||||
del: (url) => request("DELETE", url),
|
||||
isSignedIn: () => sessionStorage.getItem(SESSION_KEY) !== null,
|
||||
user: () => JSON.parse(sessionStorage.getItem(SESSION_KEY) ?? "null"),
|
||||
async signIn(username, password) {
|
||||
const r = await request("POST", "/api/v1/auth/login", { username, password, clientName: "admin-web", cookie: true });
|
||||
sessionStorage.setItem(SESSION_KEY, JSON.stringify(r.user));
|
||||
return r;
|
||||
},
|
||||
async signOut() {
|
||||
try { await request("POST", "/api/v1/auth/logout", {}); } catch { /* already gone */ }
|
||||
sessionStorage.removeItem(SESSION_KEY);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,102 @@
|
||||
// Titano Server admin panel — vanilla ES modules, no build step (BRIEF §14.8).
|
||||
import { api, ApiFailure } from "./api.js";
|
||||
import { t, loadStrings, applyStrings } from "./i18n.js";
|
||||
import { icons } from "./icons.js";
|
||||
|
||||
const app = document.getElementById("app");
|
||||
const pages = ["dashboard", "users", "archive", "jobs", "settings", "logs", "about"];
|
||||
const pageIcon = { dashboard: "dashboard", users: "users", archive: "archive", jobs: "jobs", settings: "settings", logs: "logs", about: "about" };
|
||||
|
||||
let info = null;
|
||||
|
||||
async function start() {
|
||||
await loadStrings(navigator.language);
|
||||
info = await api.get("/api/v1/server/info").catch(() => null);
|
||||
window.addEventListener("hashchange", render);
|
||||
render();
|
||||
}
|
||||
|
||||
function currentPage() {
|
||||
const p = location.hash.replace(/^#\/?/, "");
|
||||
return pages.includes(p) ? p : "dashboard";
|
||||
}
|
||||
|
||||
function render() {
|
||||
if (!api.isSignedIn()) {
|
||||
renderLogin();
|
||||
return;
|
||||
}
|
||||
renderShell(currentPage());
|
||||
}
|
||||
|
||||
function renderLogin() {
|
||||
app.innerHTML = `
|
||||
<main class="login">
|
||||
<form novalidate>
|
||||
<div class="brand"><img src="favicon.svg" alt=""><div><strong>Titano Server</strong><span class="num">${escapeHtml(info?.name ?? "")} · v${escapeHtml(info?.version ?? "")}</span></div></div>
|
||||
<label><span data-i18n="Admin.Login.User"></span><input class="input" name="username" autocomplete="username" required></label>
|
||||
<label><span data-i18n="Admin.Login.Password"></span><input class="input" name="password" type="password" autocomplete="current-password" required></label>
|
||||
<div class="error" role="alert"></div>
|
||||
<button class="btn primary" type="submit" data-i18n="Admin.Login.SignIn" data-i18n-title="Admin.Login.SignIn.Tip"></button>
|
||||
</form>
|
||||
</main>`;
|
||||
applyStrings(app);
|
||||
const form = app.querySelector("form");
|
||||
const error = form.querySelector(".error");
|
||||
form.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
error.textContent = "";
|
||||
const data = new FormData(form);
|
||||
try {
|
||||
await api.signIn(String(data.get("username")), String(data.get("password")));
|
||||
render();
|
||||
} catch (err) {
|
||||
error.textContent = err instanceof ApiFailure && err.status === 401 ? t("Admin.Login.Failed") : t("Admin.Error.Unreachable");
|
||||
}
|
||||
});
|
||||
form.querySelector("input").focus();
|
||||
}
|
||||
|
||||
function renderShell(page) {
|
||||
const nav = pages.map((p) => `
|
||||
<a href="#/${p}" ${p === page ? 'aria-current="page"' : ""} data-i18n-title="Admin.Nav.${cap(p)}.Tip">${icons[pageIcon[p]]}<span data-i18n="Admin.Nav.${cap(p)}"></span></a>`).join("");
|
||||
const user = api.user();
|
||||
app.innerHTML = `
|
||||
<div class="shell">
|
||||
<aside class="sidebar">
|
||||
<div class="brand"><img src="favicon.svg" alt=""><div><strong>Titano Server</strong><span class="num">${escapeHtml(info?.name ?? "")} · v${escapeHtml(info?.version ?? "")}</span></div></div>
|
||||
<nav class="nav">${nav}</nav>
|
||||
<div class="user">
|
||||
<div class="avatar">${escapeHtml((user?.username ?? "?").slice(0, 1).toUpperCase())}</div>
|
||||
<div class="who"><strong>${escapeHtml(user?.username ?? "")}</strong><span data-i18n="Admin.Role.${cap(user?.role ?? "viewer")}"></span></div>
|
||||
<button class="btn icon subtle" id="signout" data-i18n-title="Admin.SignOut.Tip" aria-label="${escapeHtml(t("Admin.SignOut.Tip"))}">${icons.power}</button>
|
||||
</div>
|
||||
</aside>
|
||||
<div class="main">
|
||||
<header class="header"><h1 data-i18n="Admin.Nav.${cap(page)}"></h1><span class="meta" id="meta"></span><span class="spacer"></span></header>
|
||||
<section class="content" id="content"></section>
|
||||
</div>
|
||||
</div>`;
|
||||
applyStrings(app);
|
||||
app.querySelector("#signout").addEventListener("click", async () => {
|
||||
await api.signOut();
|
||||
render();
|
||||
});
|
||||
const content = app.querySelector("#content");
|
||||
import(`./pages/${page}.js`)
|
||||
.then((m) => m.render(content, { api, t, info, meta: app.querySelector("#meta") }))
|
||||
.catch(() => {
|
||||
content.innerHTML = `<div class="panel"><span data-i18n="Admin.Error.Unreachable"></span></div>`;
|
||||
applyStrings(content);
|
||||
});
|
||||
}
|
||||
|
||||
export function escapeHtml(s) {
|
||||
return String(s).replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]));
|
||||
}
|
||||
|
||||
function cap(s) {
|
||||
return s.charAt(0).toUpperCase() + s.slice(1);
|
||||
}
|
||||
|
||||
start();
|
||||
@@ -0,0 +1,17 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
|
||||
<rect x="0" y="0" width="256" height="256" rx="56" fill="#1a1a1e"/>
|
||||
<path d="M142.4 37.1 A92 92 0 0 1 161.0 42.1" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="0.14"/>
|
||||
<path d="M185.9 56.5 A92 92 0 0 1 199.5 70.1" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="0.22"/>
|
||||
<path d="M213.9 95.0 A92 92 0 0 1 218.9 113.6" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="0.3"/>
|
||||
<path d="M218.9 142.4 A92 92 0 0 1 213.9 161.0" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="0.37"/>
|
||||
<path d="M199.5 185.9 A92 92 0 0 1 185.9 199.5" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="0.45"/>
|
||||
<path d="M161.0 213.9 A92 92 0 0 1 142.4 218.9" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="0.53"/>
|
||||
<path d="M113.6 218.9 A92 92 0 0 1 95.0 213.9" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="0.61"/>
|
||||
<path d="M70.1 199.5 A92 92 0 0 1 56.5 185.9" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="0.69"/>
|
||||
<path d="M42.1 161.0 A92 92 0 0 1 37.1 142.4" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="0.77"/>
|
||||
<path d="M37.1 113.6 A92 92 0 0 1 42.1 95.0" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="0.84"/>
|
||||
<path d="M56.5 70.1 A92 92 0 0 1 70.1 56.5" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="0.92"/>
|
||||
<path d="M95.0 42.1 A92 92 0 0 1 113.6 37.1" fill="none" stroke="#4cc2ff" stroke-width="20" stroke-linecap="round" opacity="1.0"/>
|
||||
<circle cx="152" cy="104" r="30" fill="#f5a524"/>
|
||||
<circle cx="204" cy="204" r="40" fill="#1a1a1e" stroke="#4cc2ff" stroke-width="6"/><rect x="185" y="188" width="38" height="12" rx="4" fill="#4cc2ff"/><rect x="185" y="208" width="38" height="12" rx="4" fill="#4cc2ff"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1,27 @@
|
||||
// Strings come from /api/v1/i18n/{culture}, generated from the same .resx catalog as the desktop apps.
|
||||
let strings = {};
|
||||
|
||||
export async function loadStrings(culture) {
|
||||
try {
|
||||
const res = await fetch(`/api/v1/i18n/${encodeURIComponent(culture || "en")}`);
|
||||
strings = await res.json();
|
||||
} catch {
|
||||
strings = {};
|
||||
}
|
||||
document.documentElement.lang = strings.$culture || "en";
|
||||
document.documentElement.dir = strings.$rtl === "true" ? "rtl" : "ltr";
|
||||
}
|
||||
|
||||
/** Localized string for key with {0}, {1}… placeholders filled from args. */
|
||||
export function t(key, ...args) {
|
||||
const s = strings[key];
|
||||
if (s === undefined) return `⟦${key}⟧`;
|
||||
return s.replace(/\{(\d+)(?:[,:][^}]*)?\}/g, (_, i) => (args[Number(i)] ?? ""));
|
||||
}
|
||||
|
||||
/** Fills data-i18n (text), data-i18n-title (tooltip) and data-i18n-placeholder attributes. */
|
||||
export function applyStrings(root) {
|
||||
root.querySelectorAll("[data-i18n]").forEach((el) => { el.textContent = t(el.dataset.i18n); });
|
||||
root.querySelectorAll("[data-i18n-title]").forEach((el) => { el.title = t(el.dataset.i18nTitle); });
|
||||
root.querySelectorAll("[data-i18n-placeholder]").forEach((el) => { el.placeholder = t(el.dataset.i18nPlaceholder); });
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Generated from branding/ui-icons/icons.py (same 16-px set as the desktop apps).
|
||||
export const icons = {
|
||||
dashboard: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M2.5 1.5 H6.0 A1 1 0 0 1 7.0 2.5 V6.0 A1 1 0 0 1 6.0 7.0 H2.5 A1 1 0 0 1 1.5 6.0 V2.5 A1 1 0 0 1 2.5 1.5 ZM10 1.5 H13.5 A1 1 0 0 1 14.5 2.5 V6.0 A1 1 0 0 1 13.5 7.0 H10 A1 1 0 0 1 9 6.0 V2.5 A1 1 0 0 1 10 1.5 ZM2.5 9 H6.0 A1 1 0 0 1 7.0 10 V13.5 A1 1 0 0 1 6.0 14.5 H2.5 A1 1 0 0 1 1.5 13.5 V10 A1 1 0 0 1 2.5 9 ZM10 9 H13.5 A1 1 0 0 1 14.5 10 V13.5 A1 1 0 0 1 13.5 14.5 H10 A1 1 0 0 1 9 13.5 V10 A1 1 0 0 1 10 9 Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
users: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M5 5 A3 3 0 1 0 11 5 A3 3 0 1 0 5 5 Z M2.5 14 A5.5 5.5 0 0 1 13.5 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
archive: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M2 4.5 H14 V13.5 H2 Z M2 2 H14 V4.5 H2 Z M6 8 H10" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
jobs: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M3 8 H13 M3 4 H13 M3 12 H9" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
settings: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M5.8 8 A2.2 2.2 0 1 0 10.2 8 A2.2 2.2 0 1 0 5.8 8 Z M8 1.5 V3.5 M8 12.5 V14.5 M1.5 8 H3.5 M12.5 8 H14.5 M3.4 3.4 L4.8 4.8 M11.2 11.2 L12.6 12.6 M3.4 12.6 L4.8 11.2 M11.2 4.8 L12.6 3.4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
logs: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M3.5 1.5 H9.5 L12.5 4.5 V14.5 H3.5 Z M5.5 7 H10.5 M5.5 9.5 H10.5 M5.5 12 H8.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
about: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M8 7 V11 M8 4.8 V5.2" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
power: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M8 1.8 V7.5 M11.54 4.59 A5.5 5.5 0 1 1 4.46 4.59" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
moon: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M9.5 1.8 A6.5 6.5 0 1 0 14.2 11.2 A5.5 5.5 0 0 1 9.5 1.8 Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
refresh: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M10.75 3.24 A5.5 5.5 0 1 1 4.46 3.79 M13.2 2.6 L13.2 5.3 L10.5 5.3" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
close: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M4 4 L12 12 M12 4 L4 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
plus: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M8 3 V13 M3 8 H13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
search: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M2.5 7 A4.5 4.5 0 1 0 11.5 7 A4.5 4.5 0 1 0 2.5 7 Z M10.4 10.4 L14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
};
|
||||
@@ -1 +1,15 @@
|
||||
<!doctype html><title>Titano</title>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="color-scheme" content="light">
|
||||
<title>Titano Server</title>
|
||||
<link rel="icon" href="favicon.svg" type="image/svg+xml">
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
<script type="module" src="app.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" aria-live="polite"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { applyStrings } from "../i18n.js";
|
||||
import { escapeHtml } from "../app.js";
|
||||
|
||||
export async function render(root, { info }) {
|
||||
root.innerHTML = `
|
||||
<div class="panel">
|
||||
<h2 data-i18n="Admin.About.Title"></h2>
|
||||
<p class="num">Titano Server ${escapeHtml(info?.version ?? "")} · API ${escapeHtml(String(info?.apiVersion ?? ""))}</p>
|
||||
<p class="num"><span data-i18n="Admin.About.Fingerprint"></span> ${escapeHtml(info?.tlsFingerprint ?? "–")}</p>
|
||||
</div>`;
|
||||
applyStrings(root);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Dashboard: storage, archive, jobs, render nodes (BRIEF §14.8). Data from the public API only.
|
||||
import { applyStrings } from "../i18n.js";
|
||||
|
||||
export async function render(root, { api, t, info, meta }) {
|
||||
const health = await api.get("/health").catch(() => null);
|
||||
meta.textContent = info ? `v${info.version} · TLS ${info.tlsFingerprint ? "auto" : "proxy"}` : "";
|
||||
root.innerHTML = `
|
||||
<div class="tiles">
|
||||
<div class="panel tile"><div class="label" data-i18n="Admin.Dashboard.Server"></div>
|
||||
<div class="value">${health?.status === "ok" ? `<span class="status-ok">●</span>` : `<span class="status-err">✕</span>`}<small>${health?.status ?? ""}</small></div>
|
||||
<div class="sub num">${info?.name ?? ""}</div></div>
|
||||
<div class="panel tile"><div class="label" data-i18n="Admin.Dashboard.Archive"></div>
|
||||
<div class="value">${health?.checks?.archive === "ok" ? `<span class="status-ok">●</span>` : `<span class="status-warn">▲</span>`}<small>${health?.checks?.archive ?? ""}</small></div></div>
|
||||
<div class="panel tile"><div class="label" data-i18n="Admin.Dashboard.Api"></div>
|
||||
<div class="value num">${info?.apiVersion ?? "–"}</div><div class="sub">${(info?.capabilities ?? []).join(" · ")}</div></div>
|
||||
</div>`;
|
||||
applyStrings(root);
|
||||
}
|
||||
Reference in new issue
Block a user