This commit is contained in:
Mateusz Gruszczyński committed 2026-11-16 21:06:27 +01:00
1 parent 6fe2aa137b
commit a977cf78a5
18 files changed
+182 -19

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
"openapi": "3.0.3",
"info": {
"title": "RustProxy Administration API",
"version": "0.38.5",
"version": "0.38.6",
"description": "Administration API for the active panel origin. Sign in through the panel; the same-origin HttpOnly cookie authenticates all private operations. Mutations also require the exact Origin, X-RustProxy-Request: 1 and a session-bound X-CSRF-Token. Loopback HTTP is the default; Settings can enable HTTPS before using a non-loopback administration bind. This document contains no live configuration or credentials. Object schemas marked extensible are summaries: full configuration validation is authoritative in Rust. The API also permits explicitly scoped GeneralApiBearer tokens on a narrow route allowlist, with RO/RW and source CIDR checks; API-token management and Prometheus-token management are browser-session-only."
},
"servers": [
+40
View File
@@ -50,6 +50,45 @@ window.rustProxyChartScale = (() => {
}
return `${format(n)}${unit === "percent" ? "%" : unit === "ms" ? " ms" : unit === "rate" ? "/s" : ""}`;
}
// Crosshair: with axes enabled, dashed guide lines follow the pointer and
// label the Y value and X sample under it. Values come from the same
// axis data the overlay uses, so they match the drawn scale.
function crosshairValues(svg, event) {
const data = svg.rustProxyAxisData, box = svg.getBoundingClientRect();
if (!data || !box.width || !box.height) return null;
const fx = Math.min(1, Math.max(0, (event.clientX - box.left) / box.width));
const fy = Math.min(1, Math.max(0, (event.clientY - box.top) / box.height));
const span = data.bottom - data.top || 1, ratio = Math.max(0, (data.bottom - fy) / span);
const sample = data.count > 1 ? Math.round(fx * (data.count - 1)) + 1 : data.count;
const scales = Array.isArray(data.seriesScales) && data.seriesScales.length ? data.seriesScales : null;
const y = scales ? scales.map(([name, peak]) => `${name}: ${axisValue(peak * ratio, data.unit)}`).join(" · ") : `Y ${axisValue(data.peak * ratio, data.unit)}`;
return { box, fx, fy, y, x: data.count ? `X ${sample}/${data.count}` : "X –" };
}
function attachCrosshair(host, svg) {
const cross = document.createElement("div"); cross.className = "rp-chart-crosshair"; cross.hidden = true; cross.setAttribute("aria-hidden", "true");
const vertical = document.createElement("i"), horizontal = document.createElement("i"), yLabel = document.createElement("span"), xLabel = document.createElement("span");
vertical.className = "rp-chart-crosshair-v"; horizontal.className = "rp-chart-crosshair-h"; yLabel.className = "rp-chart-crosshair-y"; xLabel.className = "rp-chart-crosshair-x";
cross.append(vertical, horizontal, yLabel, xLabel); host.append(cross);
let frame = 0, last = null;
const draw = () => {
frame = 0; if (!last || !host.isConnected) return;
const values = crosshairValues(svg, last); if (!values) { cross.hidden = true; return; }
// Client rectangles include the interface-scale transform; the
// overlay is positioned in the host's own (unscaled) pixels.
const hostBox = host.getBoundingClientRect(), scale = host.offsetWidth ? hostBox.width / host.offsetWidth : 1;
const left = (values.box.left - hostBox.left) / scale, top = (values.box.top - hostBox.top) / scale, width = values.box.width / scale, height = values.box.height / scale;
const x = left + values.fx * width, y = top + values.fy * height;
cross.style.setProperty("--rp-cross-left", `${left}px`); cross.style.setProperty("--rp-cross-top", `${top}px`);
cross.style.setProperty("--rp-cross-width", `${width}px`); cross.style.setProperty("--rp-cross-height", `${height}px`);
cross.style.setProperty("--rp-cross-x", `${x}px`); cross.style.setProperty("--rp-cross-y", `${y}px`);
cross.classList.toggle("is-right", values.fx > .6); cross.classList.toggle("is-low", values.fy > .7);
yLabel.textContent = values.y; xLabel.textContent = values.x; cross.hidden = false;
};
const move = event => { if (event.target.closest?.(".rp-chart-axis-x, .rp-chart-axis-series")) { cross.hidden = true; return; } last = event; if (!frame) frame = requestAnimationFrame(draw); };
const leave = () => { last = null; cross.hidden = true; };
host.addEventListener("pointermove", move); host.addEventListener("pointerdown", move);
host.addEventListener("pointerleave", leave); host.addEventListener("pointercancel", leave);
}
function setAxisText(node, value) {
if (node.textContent !== value) node.textContent = value;
}
@@ -81,6 +120,7 @@ window.rustProxyChartScale = (() => {
x.append(tick);
}
host.append(overlay, perSeries, x);
attachCrosshair(host, svg);
}
const { peak: maximum, unit, count, top, bottom, clipped, seriesScales } = svg.rustProxyAxisData;
const compact = svg.closest(".stat-chart") !== null;
+7
View File
@@ -494,6 +494,13 @@ button.is-saving {
font-size: 11px;
}
/* The 13px top margin lines a single toggle up with labelled fields above
it; stacked toggles only need a small step, and toggles laid out in rows
or editor grids use the container gap instead. */
.check+.check {
margin-top: 6px !important;
}
.form-actions {
display: flex;
align-items: center;
+65
View File
@@ -169,6 +169,71 @@ html[data-theme=cream] :is(.card, .stat, dialog) {
gap: 2px;
}
.rp-chart-crosshair {
position: absolute;
inset: 0;
pointer-events: none;
z-index: 2;
font: 9px/1.15 var(--mono);
font-variant-numeric: tabular-nums;
}
.rp-chart-crosshair[hidden] {
display: none;
}
.rp-chart-crosshair-v,
.rp-chart-crosshair-h {
position: absolute;
display: block;
border: 0 dashed color-mix(in srgb, var(--text) 55%, transparent);
}
.rp-chart-crosshair-v {
top: var(--rp-cross-top);
left: var(--rp-cross-x);
height: var(--rp-cross-height);
border-left-width: 1px;
}
.rp-chart-crosshair-h {
top: var(--rp-cross-y);
left: var(--rp-cross-left);
width: var(--rp-cross-width);
border-top-width: 1px;
}
.rp-chart-crosshair-y,
.rp-chart-crosshair-x {
position: absolute;
padding: 1px 4px;
border: 1px solid var(--line);
border-radius: min(3px, var(--rp-radius-control, 3px));
background: var(--panel);
color: var(--text);
white-space: nowrap;
}
.rp-chart-crosshair-y {
top: var(--rp-cross-y);
left: calc(var(--rp-cross-left) + 3px);
transform: translateY(-120%);
}
.rp-chart-crosshair.is-low .rp-chart-crosshair-y {
transform: translateY(20%);
}
.rp-chart-crosshair-x {
top: calc(var(--rp-cross-top) + var(--rp-cross-height) - 2px);
left: var(--rp-cross-x);
transform: translate(6px, -100%);
}
.rp-chart-crosshair.is-right .rp-chart-crosshair-x {
transform: translate(calc(-100% - 6px), -100%);
}
.rp-chart-axis-series {
display: flex;
flex-wrap: wrap;
+41
View File
@@ -80,6 +80,47 @@
gap: 7px;
}
/* Switches never share a row with ordinary fields: a field after a switch
and a switch after a field each start a new row. Consecutive switches
still sit side by side (for example TLS 1.2 / TLS 1.3). */
.vh-grid>.check+:not(.check),
.vh-grid>:not(.check)+.check {
grid-column-start: 1;
}
.vh-grid>.check,
.vh-backend-switches>.check {
margin-top: 0 !important;
}
.vh-grid>:not(.check)+.check {
margin-top: 6px !important;
}
/* Fields in one row line up: each field spans a caption row and a control
row of the editor grid, and a plain caption + control field uses those
rows as a subgrid, so a caption that wraps to more lines makes the whole
caption row taller and every control in the row still starts on the same
line. Multi-line text areas take the whole row instead of a narrow column. */
:is(.vh-grid>.vh-field, .cache-rules-tester-grid>.cache-rule-field, .field-grid>label:not([class])) {
grid-row: span 2;
}
:is(.vh-grid>.vh-field, .cache-rules-tester-grid>.cache-rule-field, .field-grid>label:not([class])):has(>:nth-child(2):last-child) {
display: grid;
grid-template-rows: subgrid;
row-gap: 4px;
align-content: start;
}
:is(.vh-grid>.vh-field, .cache-rules-tester-grid>.cache-rule-field, .field-grid>label:not([class])):has(>:nth-child(2):last-child)>:first-child {
align-self: end;
}
.vh-grid>.vh-field:has(>textarea) {
grid-column: 1 / -1;
}
.vh-field input,
.vh-field select {
width: 100%;
+1 -1
View File
@@ -1030,7 +1030,7 @@
const transformEnabled = input("", "checkbox", "docker-transform-enabled switch"); transformEnabled.checked = assignment?.transform_enabled === true; const transformField = checkboxField("dockerTransform", transformEnabled);
const compressionEnabled = input("", "checkbox", "docker-compression-enabled switch"); compressionEnabled.checked = assignment?.compression_enabled !== false; const compressionField = checkboxField("dockerCompression", compressionEnabled); compressionField.title = t("dockerCompressionHelp");
const switches = el("div", undefined, "docker-switch-row"); switches.append(preserveLabel, forceSslField, websocketField, cacheField, compressionField, transformField);
const certMismatch = input("", "checkbox", "docker-cert-mismatch"); certMismatch.checked = assignment?.allow_certificate_mismatch === true;
const certMismatch = input("", "checkbox", "docker-cert-mismatch switch"); certMismatch.checked = assignment?.allow_certificate_mismatch === true;
certMismatch.disabled = !agentCertificates(agent).length;
if (certMismatch.disabled) certMismatch.checked = false;
const mismatchLabel = el("label", undefined, "check");
+2 -2
View File
@@ -217,13 +217,13 @@ function memberRow(parent, value = { id: `origin-${parent.children.length + 1}`,
for (const [name, key, checked] of [["member-enabled", "vhEnabled", value.enabled !== false], ["member-pool", "locationPoolEligible", value.pool_eligible !== false], ["member-backup", "vhBackup", value.backup], ["member-drain", "vhDrain", value.drain], ["member-health-enabled", "backendHealthEnabled", value.health_check_enabled !== false]]) controls[name] = field(routing, name, key, checked, "checkbox");
const connection = el("div", undefined, "vh-wide vh-backend-switches vh-backend-connection"); main.append(connection);
for (const name of ["member-enabled", "member-pool", "member-backup", "member-drain", "member-health-enabled"]) controls[name].classList.add("switch");
controls["member-private"] = field(connection, "member-private", "vhPrivate", value.allow_private, "checkbox");
controls["member-private"] = field(connection, "member-private", "vhPrivate", value.allow_private, "checkbox", { switch: true });
const preserve = field(connection, "member-host", "vhPreserveHost", value.preserve_host === true, "checkbox", { switch: true });
const advanced = el("details", undefined, "vh-wide vh-backend-advanced"), extra = el("div", undefined, "vh-grid"); advanced.append(text("summary", "advanced"), extra);
field(extra, "member-allowlist", "vhAddressAllowlist", (value.address_allowlist || []).join("\n"), "textarea", { rows: 2, maxLength: 8192 });
const riskGate = el("div", undefined, "vh-wide vh-local-risk-gate"); extra.append(riskGate);
const localRisk = field(riskGate, "member-local-risk", "vhLocalListenerRisk", value.accept_local_listener_risk === true, "checkbox");
const localRisk = field(riskGate, "member-local-risk", "vhLocalListenerRisk", value.accept_local_listener_risk === true, "checkbox", { switch: true });
localRisk.addEventListener("change", async () => { if (localRisk.checked && !(await appConfirm(t("vhLocalListenerRiskConfirm"), { danger: true }))) localRisk.checked = false; });
note(riskGate, "vhLocalListenerRiskHelp");
field(extra, "member-tls-name", "vhTlsServerName", value.tls_server_name || "", "text", { maxLength: 253, placeholder: "backend.example.internal" });
+5 -5
View File
@@ -354,14 +354,14 @@ function load(value = defaults(), migrationIds = [], show = true) {
vhostAutoCertificate = window.rustProxyAutoCertificate.attach(selector, { auto: !editing, anchor: certificateRow, hosts: () => { try { return readHosts(); } catch { return []; } }, certificates: () => [...(envelope?.config.tls?.certificates || []), ...stagedCertificates] }); vhostAutoCertificate.refresh();
certificateRow.append(button("certManage", async () => { if (!(await closeEditor())) return; setPanel("tls"); }));
note(g, "certSelectHint");
const mismatch = field(g, "allow-certificate-mismatch", "vhCertificateMismatchForce", value.allow_certificate_mismatch === true, "checkbox");
const mismatch = field(g, "allow-certificate-mismatch", "vhCertificateMismatchForce", value.allow_certificate_mismatch === true, "checkbox", { switch: true });
const mismatchHint = note(g, "vhCertificateMismatchWarning");
const syncMismatch = () => { mismatch.disabled = !selector.value; if (!selector.value) mismatch.checked = false; mismatchHint.hidden = !mismatch.checked; };
selector.addEventListener("change", syncMismatch); mismatch.addEventListener("change", syncMismatch); syncMismatch();
g = group("vhSslSettings");
const inheritedTlsPolicy = envelope?.config.tls?.policy || { tls12: true, tls13: true, cipher_suites: [] };
const tlsPolicy = value.tls_policy || inheritedTlsPolicy;
const customTlsPolicy = field(g, "tls-policy-custom", "vhTlsOverride", value.tls_policy != null, "checkbox", { switch: true });
const customTlsPolicy = field(g, "tls-policy-custom", "vhTlsOverride", value.tls_policy != null, "checkbox", { switch: true }); customTlsPolicy.closest("label")?.classList.add("vh-wide");
const tls12 = field(g, "tls-policy-12", "tls12", tlsPolicy.tls12 !== false, "checkbox", { switch: true });
const tls13 = field(g, "tls-policy-13", "tls13", tlsPolicy.tls13 !== false, "checkbox", { switch: true });
const tlsCiphers = field(g, "tls-policy-ciphers", "tlsCiphers", (tlsPolicy.cipher_suites || []).join("\n"), "textarea", { rows: 7, maxLength: 8192 });
@@ -381,7 +381,7 @@ function load(value = defaults(), migrationIds = [], show = true) {
const loginUrl = field(taPrimary, "auth-login", "taLogin", auth.login_url || "", "url", { maxLength: 2048 });
authUrl.placeholder = "http://10.87.7.99:3000"; loginUrl.placeholder = "https://auth.example.com/login";
const taOptions = el("div", undefined, "vh-wide auth-provider-options"); taPrimary.append(taOptions);
field(taOptions, "auth-private", "vhPrivate", auth.allow_private, "checkbox");
field(taOptions, "auth-private", "vhPrivate", auth.allow_private, "checkbox", { switch: true });
field(taOptions, "auth-redirect-forbidden", "taRedirectForbidden", auth.redirect_forbidden !== false, "checkbox", { switch: true });
note(taBody, "taHelp");
@@ -408,7 +408,7 @@ function load(value = defaults(), migrationIds = [], show = true) {
login.placeholder = "https://auth.example.com";
}
const options = el("div", undefined, "vh-wide auth-provider-options"); primary.append(options);
field(options, `${id}-private`, "vhPrivate", current.allow_private, "checkbox");
field(options, `${id}-private`, "vhPrivate", current.allow_private, "checkbox", { switch: true });
field(options, `${id}-redirect-forbidden`, "taRedirectForbidden", current.redirect_forbidden === true, "checkbox", { switch: true });
note(body, id === "authelia" ? "autheliaHelp" : "authentikHelp");
const advanced = el("details", undefined, "vh-wide auth-advanced"); advanced.append(text("summary", "forwardAuthAdvanced"));
@@ -441,7 +441,7 @@ function load(value = defaults(), migrationIds = [], show = true) {
oidcSession.autocomplete = "new-password";
const oidcScopes = field(oidcPrimary, "oidc-scopes", "oidcScopes", oidc.scopes || "openid profile email", "text", { maxLength: 1024 });
const oidcOptions = el("div", undefined, "vh-wide auth-provider-options"); oidcPrimary.append(oidcOptions);
field(oidcOptions, "oidc-private", "vhPrivate", oidc.allow_private === true, "checkbox");
field(oidcOptions, "oidc-private", "vhPrivate", oidc.allow_private === true, "checkbox", { switch: true });
note(oidcBody, "oidcHelp");
const oidcAdvanced = el("details", undefined, "vh-wide auth-advanced"); oidcAdvanced.append(text("summary", "forwardAuthAdvanced"));
const oidcAdvancedGrid = el("div", undefined, "vh-grid"); oidcAdvanced.append(oidcAdvancedGrid); oidcBody.append(oidcAdvanced);