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:
Claude committed 2026-10-02 09:35:03 +00:00
1 parent 800843d2ae
commit c40b6a7cd3
122 files changed
+6838 -22

No files matched your search

+47
View File
@@ -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);
},
};