diff --git a/i18n/en/Admin.resx b/i18n/en/Admin.resx index a4dc3654..677b4ffc 100644 --- a/i18n/en/Admin.resx +++ b/i18n/en/Admin.resx @@ -288,6 +288,8 @@ Network and TLS The PEM file was not found; enter its full path on the server.long Used only in Own certificate mode + Not via proxy + TLS mode is Reverse proxy, but this page did not come through a trusted proxy over HTTPS. Open it through your proxy, or add the proxy's address to TITANO_TRUSTED_PROXIES. Restart required Saved ports, TLS, workers, chunk size or job history apply after a restart Server diff --git a/i18n/it/Admin.it.resx b/i18n/it/Admin.it.resx index 5bbd110c..1372f99c 100644 --- a/i18n/it/Admin.it.resx +++ b/i18n/it/Admin.it.resx @@ -288,6 +288,8 @@ Rete e TLS File PEM non trovato; inserisci il percorso completo sul server. Usato solo in modalità Certificato proprio + Senza proxy + La modalità TLS è Reverse proxy, ma questa pagina non è arrivata da un proxy attendibile in HTTPS. Aprila tramite il proxy o aggiungi l'indirizzo del proxy a TITANO_TRUSTED_PROXIES. Riavvio richiesto Porte, TLS, worker, dimensione blocchi o cronologia job salvati valgono dopo un riavvio Server diff --git a/src/Titano.Protocol/Admin.cs b/src/Titano.Protocol/Admin.cs index 17abbd28..e8b118cb 100644 --- a/src/Titano.Protocol/Admin.cs +++ b/src/Titano.Protocol/Admin.cs @@ -3,7 +3,8 @@ namespace Titano.Protocol; /// /// GET/PUT /api/v1/server/settings (admin): the editable part of the server configuration. Settings named in /// come from environment variables and cannot be changed here; says -/// that saved values (ports, TLS, workers, chunk size) wait for a restart. +/// that saved values (ports, TLS, workers, chunk size) wait for a restart. is set in +/// responses when TLS mode is proxy and the request did not come through a trusted proxy over HTTPS (ignored when saving). /// public sealed record ServerSettingsDto( string ServerName, @@ -21,7 +22,8 @@ public sealed record ServerSettingsDto( int TokenLifetimeDays, int UploadRetentionHours, IReadOnlyList Locked, - bool RestartRequired); + bool RestartRequired, + bool ProxyWarning); /// A server log file (GET /api/v1/logs/files). public sealed record LogFileDto(string Name, long Size, DateTimeOffset Modified); @@ -35,7 +37,10 @@ public sealed record JobCountsDto(int Queued, int Running, int Paused, int DoneT /// Frames committed by uploads on one UTC day. public sealed record UploadDayDto(DateOnly Day, long Frames, long Bytes); -/// GET /api/v1/server/dashboard (admin): everything the dashboard page shows in one call (BRIEF §14.8). +/// +/// GET /api/v1/server/dashboard (admin): everything the dashboard page shows in one call (BRIEF §14.8). +/// : TLS mode is proxy and this request did not come through a trusted proxy over HTTPS. +/// public sealed record DashboardDto( string ServerName, string Version, @@ -50,4 +55,5 @@ public sealed record DashboardDto( IReadOnlyList Nodes, IReadOnlyList Uploads, IReadOnlyList Activity, - IReadOnlyList ActiveJobs); + IReadOnlyList ActiveJobs, + bool ProxyWarning); diff --git a/src/Titano.Server/Admin/web/pages/dashboard.js b/src/Titano.Server/Admin/web/pages/dashboard.js index 8ef19fe9..b0de718e 100644 --- a/src/Titano.Server/Admin/web/pages/dashboard.js +++ b/src/Titano.Server/Admin/web/pages/dashboard.js @@ -1,12 +1,12 @@ // Dashboard (mockup Admin.html, BRIEF §14.8): storage, archive, jobs, render nodes, charts, activity, active jobs. import { t, plural, applyStrings, culture } from "../i18n.js"; -import { escapeHtml, attr, formatBytes, formatNumber, formatTime, formatDuration, bar, columns, toast, errorText, emptyState, redraw, fitColumns } from "../ui.js"; +import { escapeHtml, attr, formatBytes, formatNumber, formatTime, formatDuration, bar, columns, toast, errorText, emptyState, redraw, fitColumns, PROXY_WARNING } from "../ui.js"; import { kindLabel, nodeLabel, progressCell, stateCell, stateLabel, encoders } from "../jobs.js"; import { activityText } from "../audit.js"; const SCAN_BUTTON = ``; -export async function render(root, { api, setMeta, onEvent }) { +export async function render(root, { api, setMeta, actions, onEvent }) { let timer = null; const refresh = () => { clearTimeout(timer); @@ -28,6 +28,8 @@ export async function render(root, { api, setMeta, onEvent }) { const tls = `Admin.Settings.Tls.${d.tlsMode.charAt(0).toUpperCase()}${d.tlsMode.slice(1)}`; setMeta(t("Admin.Dashboard.Meta", formatDuration(d.uptimeSeconds), d.database, t(tls), t(d.discovery ? "Admin.Dashboard.DiscoveryOn" : "Admin.Dashboard.DiscoveryOff"))); + actions.innerHTML = d.proxyWarning ? PROXY_WARNING : ""; + applyStrings(actions); const a = d.archive; const used = a.capacityBytes > 0 ? (a.capacityBytes - a.freeBytes) / a.capacityBytes : 0; const online = d.nodes.filter((n) => n.state !== "offline"); diff --git a/src/Titano.Server/Admin/web/pages/settings.js b/src/Titano.Server/Admin/web/pages/settings.js index 484fe805..4f01e0f6 100644 --- a/src/Titano.Server/Admin/web/pages/settings.js +++ b/src/Titano.Server/Admin/web/pages/settings.js @@ -1,7 +1,7 @@ // Settings (BRIEF §14.8): server name, ports, TLS, discovery, limits, language, retention. Values fixed by environment // variables are read-only here; ports, TLS, workers, chunk size and job history apply at the next restart. import { t, applyStrings, languages } from "../i18n.js"; -import { escapeHtml, attr, toast, errorText, nativeName, fingerprint, markInvalid, clearInvalid, invalidText, escapeReverts } from "../ui.js"; +import { escapeHtml, attr, toast, errorText, nativeName, fingerprint, markInvalid, clearInvalid, invalidText, escapeReverts, PROXY_WARNING } from "../ui.js"; /** Setting → environment variable that can fix it (BRIEF §14.9). */ const VARIABLES = { @@ -46,7 +46,8 @@ export async function render(root, { api, info, setMeta, actions }) { ${field("discovery", ``)}
-

+

+ ${settings.proxyWarning ? PROXY_WARNING : ""}
${number("httpPort", settings.httpPort, 'min="1" max="65535"')} ${number("httpsPort", settings.httpsPort, 'min="1" max="65535"')} ${field("tlsMode", `