v0.31.8
This commit is contained in:
1 parent
68ada6680d
commit
180a0e4877
56 files changed
+9866
-205
No files matched your search
@@ -35,6 +35,8 @@ struct FileLogQuery {
|
||||
aggregate_field: Option<String>,
|
||||
aggregate_limit: Option<usize>,
|
||||
aggregate_min_count: Option<usize>,
|
||||
sort_by: Option<String>,
|
||||
sort_descending: Option<bool>,
|
||||
offset: Option<usize>,
|
||||
limit: Option<usize>,
|
||||
}
|
||||
|
||||
@@ -50,6 +50,91 @@ fn record_matches(value: &Value, query: &FileLogQuery, search: &[FileLogSearchCl
|
||||
true
|
||||
}
|
||||
|
||||
// Order the entire bounded matching scan before applying offset/limit. Sorting
|
||||
// only the current browser page would give misleading navigation results.
|
||||
#[derive(Debug)]
|
||||
enum FileLogSortKey {
|
||||
Number(serde_json::Number),
|
||||
Text(String),
|
||||
}
|
||||
|
||||
fn stored_log_summary(value: &Value) -> String {
|
||||
let field = |name| value.get(name).and_then(Value::as_str).filter(|text| !text.is_empty());
|
||||
if let Some(reason) = field("reason").or_else(|| field("protocol_error")) {
|
||||
return reason.to_owned();
|
||||
}
|
||||
if field("method").is_some() || field("path").is_some() {
|
||||
return format!("{} {}{}", field("method").unwrap_or(""),
|
||||
field("host").or_else(|| field("authority")).unwrap_or(""),
|
||||
field("path").unwrap_or("")).trim().to_owned();
|
||||
}
|
||||
for key in ["error", "error_detail", "message", "raw", "outcome"] {
|
||||
if let Some(text) = field(key) { return text.to_owned(); }
|
||||
}
|
||||
String::new()
|
||||
}
|
||||
|
||||
fn stored_log_sort_key(record: &Value, field: &str) -> Option<FileLogSortKey> {
|
||||
if field == "record" {
|
||||
return Some(FileLogSortKey::Text(stored_log_summary(record).to_lowercase()));
|
||||
}
|
||||
// Prefer millisecond timestamps for numeric chronological sorting. RAW
|
||||
// file timestamps use the existing ISO/text fallback.
|
||||
let value = if field == "time" {
|
||||
record.get("time_ms").filter(|value| value.is_number())
|
||||
.or_else(|| record.get("timestamp"))
|
||||
} else {
|
||||
file_log_field(record, field)
|
||||
}?;
|
||||
match value {
|
||||
Value::Null => None,
|
||||
Value::Number(number) => Some(FileLogSortKey::Number(number.clone())),
|
||||
Value::String(text) if !text.is_empty() => Some(FileLogSortKey::Text(text.to_lowercase())),
|
||||
Value::Bool(boolean) => Some(FileLogSortKey::Text(boolean.to_string())),
|
||||
Value::Array(_) | Value::Object(_) => Some(FileLogSortKey::Text(value.to_string().to_lowercase())),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn file_log_timestamp_cmp_desc(left: &Value, right: &Value) -> std::cmp::Ordering {
|
||||
match (left.get("time_ms").and_then(Value::as_u64), right.get("time_ms").and_then(Value::as_u64)) {
|
||||
(Some(a), Some(b)) => b.cmp(&a),
|
||||
_ => right.get("timestamp").and_then(Value::as_str).unwrap_or("")
|
||||
.cmp(left.get("timestamp").and_then(Value::as_str).unwrap_or("")),
|
||||
}
|
||||
}
|
||||
|
||||
fn sort_file_log_records(records: &mut Vec<Value>, field: &str, descending: bool) {
|
||||
use std::cmp::Ordering;
|
||||
// Build one key per record; do not repeatedly allocate/parse strings in
|
||||
// the O(n log n) comparison loop. The scan itself is limited to 20k lines.
|
||||
let mut keyed = std::mem::take(records).into_iter().enumerate()
|
||||
.map(|(ordinal, record)| (stored_log_sort_key(&record, field), ordinal, record))
|
||||
.collect::<Vec<_>>();
|
||||
keyed.sort_by(|left, right| {
|
||||
let order = match (&left.0, &right.0) {
|
||||
(None, None) => Ordering::Equal,
|
||||
(None, Some(_)) => return Ordering::Greater, // missing values always last
|
||||
(Some(_), None) => return Ordering::Less,
|
||||
(Some(FileLogSortKey::Number(a)), Some(FileLogSortKey::Number(b))) =>
|
||||
match (a.as_i64(), b.as_i64()) {
|
||||
(Some(left), Some(right)) => left.cmp(&right),
|
||||
_ => match (a.as_u64(), b.as_u64()) {
|
||||
(Some(left), Some(right)) => left.cmp(&right),
|
||||
_ => a.as_f64().partial_cmp(&b.as_f64()).unwrap_or(Ordering::Equal),
|
||||
},
|
||||
},
|
||||
(Some(FileLogSortKey::Text(a)), Some(FileLogSortKey::Text(b))) => a.cmp(b),
|
||||
(Some(FileLogSortKey::Number(_)), Some(FileLogSortKey::Text(_))) => Ordering::Less,
|
||||
(Some(FileLogSortKey::Text(_)), Some(FileLogSortKey::Number(_))) => Ordering::Greater,
|
||||
};
|
||||
(if descending { order.reverse() } else { order })
|
||||
.then_with(|| file_log_timestamp_cmp_desc(&left.2, &right.2))
|
||||
.then_with(|| left.1.cmp(&right.1))
|
||||
});
|
||||
records.extend(keyed.into_iter().map(|(_, _, record)| record));
|
||||
}
|
||||
|
||||
fn validate_file_log_query(query: &FileLogQuery) -> Result<(), ApiError> {
|
||||
let text_ok = |value: &Option<String>, max: usize| {
|
||||
value
|
||||
@@ -61,6 +146,7 @@ fn validate_file_log_query(query: &FileLogQuery) -> Result<(), ApiError> {
|
||||
|| !text_ok(&query.client_ip, 128)
|
||||
|| !text_ok(&query.vhost, 256)
|
||||
|| query.aggregate_field.as_ref().is_some_and(|field| !valid_raw_field_key(field))
|
||||
|| query.sort_by.as_ref().is_some_and(|field| !valid_raw_field_key(field))
|
||||
|| query.aggregate_limit.is_some_and(|value| value == 0 || value > FILE_LOG_MAX_AGGREGATE_RESULTS)
|
||||
|| query.aggregate_min_count.is_some_and(|value| value < 2 || value > FILE_LOG_SCAN_LINES)
|
||||
|| query.offset.unwrap_or(0) > FILE_LOG_MAX_OFFSET
|
||||
@@ -171,17 +257,8 @@ async fn file_logs_query(
|
||||
Err(_) => truncated = true,
|
||||
}
|
||||
}
|
||||
records.sort_by(|a, b| {
|
||||
let numeric = |value: &Value| value.get("time_ms").and_then(Value::as_u64);
|
||||
match (numeric(a), numeric(b)) {
|
||||
(Some(left), Some(right)) => right.cmp(&left),
|
||||
_ => b
|
||||
.get("timestamp")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("")
|
||||
.cmp(a.get("timestamp").and_then(Value::as_str).unwrap_or("")),
|
||||
}
|
||||
});
|
||||
sort_file_log_records(&mut records, query.sort_by.as_deref().unwrap_or("time"),
|
||||
query.sort_descending.unwrap_or(true));
|
||||
let mut aggregation = aggregate_counts.into_iter()
|
||||
.filter(|(_, count)| *count >= aggregate_min_count)
|
||||
.map(|(value, count)| json!({"value": value, "count": count}))
|
||||
|
||||
+33
-1
@@ -2,7 +2,7 @@
|
||||
"openapi": "3.0.3",
|
||||
"info": {
|
||||
"title": "RustProxy Administration API",
|
||||
"version": "0.31.7",
|
||||
"version": "0.31.8",
|
||||
"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."
|
||||
},
|
||||
"servers": [
|
||||
@@ -3625,6 +3625,17 @@
|
||||
"default": 60
|
||||
}
|
||||
}
|
||||
},
|
||||
"file_log_sort": {
|
||||
"type": "string",
|
||||
"maxLength": 128,
|
||||
"default": "time",
|
||||
"description": "Account-scoped Stored Logs sort column; a fixed or discovered parsed JSON field, including nested dotted fields."
|
||||
},
|
||||
"file_log_descending": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Account-scoped Stored Logs sort direction."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -11009,6 +11020,27 @@
|
||||
"maximum": 500,
|
||||
"default": 100
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sort_by",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"description": "Sort field applied across the entire bounded matching scan before pagination. Includes time, record summary, source and parsed nested field names.",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"maxLength": 128,
|
||||
"default": "time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sort_descending",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"description": "Descending sort direction; null/missing field values are always last.",
|
||||
"schema": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
||||
@@ -30,6 +30,8 @@ fn default_admin_dashboard_widgets() -> Vec<String> {
|
||||
.map(|value| (*value).to_owned())
|
||||
.collect()
|
||||
}
|
||||
fn default_file_log_sort() -> String { "time".to_owned() }
|
||||
fn default_file_log_descending() -> bool { true }
|
||||
fn default_file_log_columns() -> Vec<String> {
|
||||
[
|
||||
"time",
|
||||
@@ -99,6 +101,10 @@ struct AdminPreferences {
|
||||
dashboard_hidden_widgets: Vec<String>,
|
||||
#[serde(default = "default_file_log_columns")]
|
||||
file_log_columns: Vec<String>,
|
||||
#[serde(default = "default_file_log_sort")]
|
||||
file_log_sort: String,
|
||||
#[serde(default = "default_file_log_descending")]
|
||||
file_log_descending: bool,
|
||||
#[serde(default = "default_backend_table_columns")]
|
||||
backend_table_columns: Vec<String>,
|
||||
#[serde(default = "default_backend_table_sort")]
|
||||
@@ -146,6 +152,8 @@ impl Default for AdminPreferences {
|
||||
dashboard_widgets: default_admin_dashboard_widgets(),
|
||||
dashboard_hidden_widgets: Vec::new(),
|
||||
file_log_columns: default_file_log_columns(),
|
||||
file_log_sort: default_file_log_sort(),
|
||||
file_log_descending: default_file_log_descending(),
|
||||
backend_table_columns: default_backend_table_columns(),
|
||||
backend_table_sort: default_backend_table_sort(),
|
||||
backend_table_descending: false,
|
||||
@@ -203,6 +211,12 @@ fn validate_admin_preferences(preferences: &AdminPreferences) -> Result<(), ApiE
|
||||
));
|
||||
}
|
||||
}
|
||||
if !valid_raw_field_key(&preferences.file_log_sort) {
|
||||
return Err(ApiError(
|
||||
StatusCode::UNPROCESSABLE_ENTITY,
|
||||
"invalid stored-log sort column preference".into(),
|
||||
));
|
||||
}
|
||||
if !matches!(preferences.theme.as_str(), "dark" | "light") {
|
||||
return Err(ApiError(
|
||||
StatusCode::UNPROCESSABLE_ENTITY,
|
||||
|
||||
+2661
-11
File diff suppressed because it is too large.
Load diff
@@ -151,6 +151,7 @@ async function api(path, options = {}) {
|
||||
function setPanel(name, navigate = true) {
|
||||
if (name === "security") { setPanel("settings", navigate); window.rustProxySettings?.select("security"); return; }
|
||||
if (!Object.hasOwn(PANEL_PATHS, name)) name = "overview";
|
||||
const previousPanel = currentPanel;
|
||||
currentPanel = name;
|
||||
$("overview-refresh").hidden = name !== "overview";
|
||||
document.querySelectorAll(".nav").forEach(e => e.classList.toggle("active", e.dataset.panel === name));
|
||||
@@ -159,6 +160,9 @@ function setPanel(name, navigate = true) {
|
||||
if (navigate && typeof location !== "undefined" && ["http:", "https:"].includes(location.protocol) && location.pathname !== PANEL_PATHS[name]) history.pushState({ panel: name }, "", PANEL_PATHS[name]);
|
||||
if (name === "settings") window.rustProxySettings?.syncLocation?.();
|
||||
window.rustProxyRefresh?.setPanel(name);
|
||||
// Read the cached Docker status on each visit, independent of the Live-view toggle.
|
||||
// This is GET /api/docker, not the POST that triggers an agent poll.
|
||||
if (name === "docker-vhosts" && previousPanel !== name && authenticated && envelope) void window.rustProxyRefresh?.manual("docker");
|
||||
if (name === "tls") window.rustProxyAcme?.syncLocation?.();
|
||||
if (name === "filelogs") void window.rustProxyFileLogs?.refresh();
|
||||
if (name === "tls") void refreshCertificateInventory().then(() => { if (authenticated && currentPanel === "tls") renderCertificates(); });
|
||||
|
||||
+10
-4
@@ -10,6 +10,7 @@
|
||||
const HIDDEN_KEY = "rustproxy.docker.hidden-vhosts";
|
||||
const cfg = () => envelope?.config?.docker_agents || { agents: [] };
|
||||
const obs = id => observations.find(item => item.agent_id === id);
|
||||
const hasUnobservedAgent = () => (cfg().agents || []).some(agent => agent.enabled !== false && !obs(agent.id));
|
||||
const firstListener = () => envelope?.config?.listeners?.endpoints?.find(item => item.enabled !== false)?.id || "http";
|
||||
const defaultHealth = () => ({ mode: "tcp", path: "/", host: null, interval_ms: 5000, timeout_ms: 2000, slow_response_ms: 1500, fall: 3, rise: 2, expected_status_min: 200, expected_status_max: 399 });
|
||||
const defaultPassiveHealth = () => ({ enabled: false, count_connect_errors: true, count_timeouts: true, count_io_errors: true, count_http_5xx: true, count_slow_responses: false, fall: null, rise: null });
|
||||
@@ -115,7 +116,7 @@
|
||||
const https = String(agent?.endpoint || "").toLowerCase().startsWith("https://");
|
||||
const pinned = !!agent?.tls_fingerprint_sha256;
|
||||
if (!https) return { key: "dockerTlsPlain", cls: "warn", detail: t("dockerTlsPlainHelp") };
|
||||
if (pinned) return { key: "dockerTlsPinned", cls: "live", detail: `${t("dockerTlsFingerprint")}: ${prettyFingerprint(agent.tls_fingerprint_sha256)}` };
|
||||
if (pinned) return { key: "dockerTlsPinned", cls: state?.ok ? "live" : "", detail: `${t("dockerTlsFingerprint")}: ${prettyFingerprint(agent.tls_fingerprint_sha256)}` };
|
||||
if (state?.ok) return { key: "dockerTlsPublicCa", cls: "live", detail: t("dockerTlsPublicCaHelp") };
|
||||
return { key: "dockerTlsPublicCa", cls: "", detail: t("dockerTlsPublicCaHelp") };
|
||||
}
|
||||
@@ -326,7 +327,10 @@
|
||||
const state = obs(agent.id), box = el("article", undefined, "card docker-agent-card"); box.dataset.agentId = agent.id; box.dataset.searchText = `${agent.id} ${agent.name || ""} ${agent.base_domain || ""}`.toLowerCase(); const head = el("div", undefined, "card-heading"), left = el("div"); left.append(el("span", agent.id, "small-label"), el("h2", agent.name));
|
||||
const badges = el("div", undefined, "entity-actions"), connection = el("span", state?.ok ? t("dockerConnected") : state ? t("dockerError") : t("dockerWaiting"), `pill ${state?.ok ? "live" : ""}`), sec = securityInfo(agent, state); badges.append(el("span", t(sec.key), `pill ${sec.cls}`.trim()), connection); head.append(left, badges); box.append(head);
|
||||
if (!agent.enabled) { box.append(el("p", t("dockerAgentDisabled"), "fine")); target.append(box); continue; }
|
||||
if (!state?.ok) { const error = el("div", undefined, "docker-agent-error"); error.append(el("b", t("dockerAgentConnectionFailed")), el("p", state?.error || t("dockerNoObservation"), "fine"), el("small", sec.detail, "fine")); box.append(error); }
|
||||
// No observation is the normal state while the first background poll is in flight.
|
||||
// A configured TLS fingerprint alone is not proof that an agent was contacted.
|
||||
if (!state) box.append(el("p", t("dockerNoObservation"), "fine"));
|
||||
else if (!state.ok) { const error = el("div", undefined, "docker-agent-error"); error.append(el("b", t("dockerAgentConnectionFailed")), el("p", state.error || t("dockerUnknownPollError"), "fine")); box.append(error); }
|
||||
if (!state?.inventory) { const rows = el("div", undefined, "docker-service-list"); for (const item of agent.assignments || []) rows.append(assignmentRow(agent, null, null, item, true)); if (!rows.children.length) rows.append(el("p", t("dockerNoPublishedPorts"), "empty")); box.append(rows); target.append(box); continue; }
|
||||
const inv = state.inventory, defaultIp = agent.default_target_ip || agent.target_ip_override || t("dockerTargetAuto"), serviceCount = (inv.services || []).length, overview = el("div", undefined, "docker-agent-overview"); box.dataset.searchText += ` ${inv.hostname || ""}`.toLowerCase();
|
||||
overview.append(el("span", `${t("dockerHost")}: ${inv.hostname}`), el("span", `${t("dockerServices")}: ${serviceCount}`), el("span", `${t("dockerLastChecked")}: ${checkedAgo(state.checked_at_unix_ms)}`), el("span", `*.${agent.base_domain}`)); box.append(overview);
|
||||
@@ -406,8 +410,10 @@
|
||||
$("docker-agents-form")?.addEventListener("submit", async event => { event.preventDefault(); const form = event.currentTarget; if (!envelope || busy) return; try { await withFormSubmitState(form, event.submitter, async () => { if (await saveSection("docker-agents", collectSettings())) { setSettingsDirty("docker-agents-form", false); await refresh(true); } }); } catch (error) { toast(error.message, true); } });
|
||||
rustProxyRefresh.register("docker", {
|
||||
interval: () => 5,
|
||||
active: () => currentPanel === "docker-vhosts" && liveEnabled() && canLiveRender(),
|
||||
// Even with local Live view off, observe the first startup result.
|
||||
// Once every enabled agent has a first result, stop unless Live is enabled.
|
||||
active: () => currentPanel === "docker-vhosts" && canLiveRender() && (liveEnabled() || hasUnobservedAgent()),
|
||||
run: async context => refresh(false, context)
|
||||
});
|
||||
window.rustProxyDocker = { render() { syncLiveSwitch(); renderSettings(); renderDiscovery(); }, refresh, applyPreferences, reset() { observations = []; pools = []; poolRoutes = []; poolIndex = new Map(); showHidden = false; listPrefs = { sort: "service", descending: false }; hiddenVhosts = loadHidden(); if ($("docker-search")) $("docker-search").value = ""; if ($("docker-vhost-sort")) $("docker-vhost-sort").value = listPrefs.sort; syncSortDirection(); $("docker-discovery-list")?.replaceChildren(); $("docker-agent-settings-list")?.replaceChildren(); syncLiveSwitch(); applyViewFilters(); } };
|
||||
window.rustProxyDocker = { render() { syncLiveSwitch(); renderSettings(); renderDiscovery(); if (currentPanel === "docker-vhosts" && authenticated) { rustProxyRefresh.sync(); void rustProxyRefresh.manual("docker"); } }, refresh, applyPreferences, reset() { observations = []; pools = []; poolRoutes = []; poolIndex = new Map(); showHidden = false; listPrefs = { sort: "service", descending: false }; hiddenVhosts = loadHidden(); if ($("docker-search")) $("docker-search").value = ""; if ($("docker-vhost-sort")) $("docker-vhost-sort").value = listPrefs.sort; syncSortDirection(); $("docker-discovery-list")?.replaceChildren(); $("docker-agent-settings-list")?.replaceChildren(); syncLiveSwitch(); applyViewFilters(); } };
|
||||
})();
|
||||
@@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>400 - Bad request - RustProxy</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 12vh auto;
|
||||
padding: 24px;
|
||||
max-width: 620px;
|
||||
background: #131615;
|
||||
color: #e5e9e6;
|
||||
font: 15px/1.6 system-ui, sans-serif
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
margin: 0 0 8px
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: #b9c3bc
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<h1>400 - Bad request</h1>
|
||||
<p>The request could not be processed because it is invalid.</p>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>408 - Request timeout - RustProxy</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 12vh auto;
|
||||
padding: 24px;
|
||||
max-width: 620px;
|
||||
background: #131615;
|
||||
color: #e5e9e6;
|
||||
font: 15px/1.6 system-ui, sans-serif
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
margin: 0 0 8px
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: #b9c3bc
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<h1>408 - Request timeout</h1>
|
||||
<p>The request was not completed in time. Please try again.</p>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>410 - Gone - RustProxy</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 12vh auto;
|
||||
padding: 24px;
|
||||
max-width: 620px;
|
||||
background: #131615;
|
||||
color: #e5e9e6;
|
||||
font: 15px/1.6 system-ui, sans-serif
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
margin: 0 0 8px
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: #b9c3bc
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<h1>410 - Gone</h1>
|
||||
<p>The requested resource is no longer available.</p>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>413 - Payload too large - RustProxy</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 12vh auto;
|
||||
padding: 24px;
|
||||
max-width: 620px;
|
||||
background: #131615;
|
||||
color: #e5e9e6;
|
||||
font: 15px/1.6 system-ui, sans-serif
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
margin: 0 0 8px
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: #b9c3bc
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<h1>413 - Payload too large</h1>
|
||||
<p>The request body exceeds the allowed size.</p>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>500 - Internal server error - RustProxy</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 12vh auto;
|
||||
padding: 24px;
|
||||
max-width: 620px;
|
||||
background: #131615;
|
||||
color: #e5e9e6;
|
||||
font: 15px/1.6 system-ui, sans-serif
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
margin: 0 0 8px
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: #b9c3bc
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<h1>500 - Internal server error</h1>
|
||||
<p>The server encountered an unexpected error.</p>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>502 - Bad gateway - RustProxy</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 12vh auto;
|
||||
padding: 24px;
|
||||
max-width: 620px;
|
||||
background: #131615;
|
||||
color: #e5e9e6;
|
||||
font: 15px/1.6 system-ui, sans-serif
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
margin: 0 0 8px
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: #b9c3bc
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<h1>502 - Bad gateway</h1>
|
||||
<p>The upstream service returned an invalid response.</p>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -11,6 +11,7 @@
|
||||
]);
|
||||
let availableColumns = new Set(defaultColumnIds);
|
||||
let visibleColumns = new Set(defaultColumnIds);
|
||||
let sortBy = "time", sortDescending = true, pendingRefresh = false;
|
||||
|
||||
|
||||
const CONSOLIDATION_STORAGE_KEY = "rp-file-logs-consolidate-vhosts";
|
||||
@@ -146,8 +147,22 @@
|
||||
function syncHeaders() {
|
||||
const row = $("file-logs-table-head").querySelector("tr");
|
||||
const headers = orderedColumns().filter(id => visibleColumns.has(id)).map(id => {
|
||||
const header = el("th", columnLabel(id)); header.dataset.fileLogColumn = id;
|
||||
const key = specialLabels.get(id); if (key) header.dataset.i18n = key;
|
||||
const header = el("th"); header.dataset.fileLogColumn = id;
|
||||
header.setAttribute("aria-sort", sortBy === id ? (sortDescending ? "descending" : "ascending") : "none");
|
||||
const button = el("button", undefined, "file-log-sort-button"); button.type = "button";
|
||||
const caption = el("span", columnLabel(id));
|
||||
const key = specialLabels.get(id); if (key) caption.dataset.i18n = key;
|
||||
const arrow = el("span", sortBy === id ? (sortDescending ? "↓" : "↑") : "↕", "file-log-sort-indicator");
|
||||
arrow.setAttribute("aria-hidden", "true");
|
||||
const willDescend = sortBy === id ? !sortDescending : false;
|
||||
button.title = `${t(willDescend ? "fileLogsSortDescending" : "fileLogsSortAscending")}: ${columnLabel(id)}`;
|
||||
button.setAttribute("aria-label", button.title);
|
||||
button.addEventListener("click", () => {
|
||||
sortDescending = sortBy === id ? !sortDescending : false;
|
||||
sortBy = id; selectedIndex = null; offset = 0;
|
||||
syncHeaders(); void savePreferences(); void refresh(true);
|
||||
});
|
||||
button.append(caption, arrow); header.append(button);
|
||||
return header;
|
||||
});
|
||||
row.replaceChildren(...headers);
|
||||
@@ -172,6 +187,8 @@
|
||||
? preferences.file_log_columns.filter(id => typeof id === "string" && id.length <= 128)
|
||||
: [];
|
||||
visibleColumns = new Set(selected.length ? selected : defaultColumnIds);
|
||||
sortBy = typeof preferences?.file_log_sort === "string" && /^[a-z0-9_.-]{1,128}$/i.test(preferences.file_log_sort) ? preferences.file_log_sort : "time";
|
||||
sortDescending = preferences?.file_log_descending !== false;
|
||||
for (const id of visibleColumns) availableColumns.add(id);
|
||||
preferencesLoaded = true;
|
||||
syncColumnPicker(); syncHeaders(); renderRows();
|
||||
@@ -184,7 +201,7 @@
|
||||
do {
|
||||
preferenceSaveQueued = false;
|
||||
const selected = orderedColumns().filter(id => visibleColumns.has(id));
|
||||
const preferences = await window.rustProxyPreferences.update({ file_log_columns: selected });
|
||||
const preferences = await window.rustProxyPreferences.update({ file_log_columns: selected, file_log_sort: sortBy, file_log_descending: sortDescending });
|
||||
if (!preferenceSaveQueued) applyPreferences(preferences);
|
||||
} while (preferenceSaveQueued);
|
||||
} catch (error) { toast(error.message, true); }
|
||||
@@ -267,12 +284,14 @@
|
||||
params.set("aggregate_min_count", String(Math.max(2, Number($("file-log-aggregate-min")?.value) || 2)));
|
||||
params.set("aggregate_limit", String(Math.max(1, Number($("file-log-aggregate-limit")?.value) || 50)));
|
||||
}
|
||||
params.set("sort_by", sortBy); params.set("sort_descending", String(sortDescending));
|
||||
params.set("offset", String(offset)); params.set("limit", String(currentLimit()));
|
||||
return params.toString();
|
||||
}
|
||||
async function refresh(reset = false) {
|
||||
if (!authenticated || busy) return;
|
||||
if (!authenticated) return;
|
||||
if (reset) offset = 0;
|
||||
if (busy) { pendingRefresh = true; return; }
|
||||
busy = true; $("file-logs-refresh").disabled = true;
|
||||
try {
|
||||
if (!inventory) await loadInventory();
|
||||
@@ -289,10 +308,11 @@
|
||||
$("file-logs-prev").disabled = offset === 0;
|
||||
$("file-logs-next").disabled = offset + currentLimit() >= lastTotal;
|
||||
} catch (error) { toast(error.message, true); }
|
||||
finally { busy = false; $("file-logs-refresh").disabled = false; }
|
||||
finally { busy = false; $("file-logs-refresh").disabled = false; if (pendingRefresh) { pendingRefresh = false; void refresh(); } }
|
||||
}
|
||||
function reset() {
|
||||
inventory = null; offset = 0; lastTotal = 0; currentEntries = []; selectedIndex = null; aggregateField = "";
|
||||
sortBy = "time"; sortDescending = true; pendingRefresh = false;
|
||||
preferencesLoaded = false; preferenceSaveRunning = false; preferenceSaveQueued = false;
|
||||
availableColumns = new Set(defaultColumnIds); visibleColumns = new Set(defaultColumnIds);
|
||||
sourceSelect().replaceChildren(Object.assign(el("option", t("fileLogsAllSources")), { value: "all" }));
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>200 - OK - RustProxy</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 12vh auto;
|
||||
padding: 24px;
|
||||
max-width: 620px;
|
||||
background: #131615;
|
||||
color: #e5e9e6;
|
||||
font: 15px/1.6 system-ui, sans-serif
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
margin: 0 0 8px
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: #b9c3bc
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<h1>200 - OK</h1>
|
||||
<p>The request completed successfully.</p>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -8692,6 +8692,25 @@ button.config-history-day.is-selected {
|
||||
box-shadow: 0 1px 0 var(--line);
|
||||
}
|
||||
|
||||
/* Stored Logs sorting is performed by the bounded server scan before pagination. */
|
||||
.file-logs-table th .file-log-sort-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 3px 2px;
|
||||
font: inherit;
|
||||
font-weight: inherit;
|
||||
color: inherit;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
}
|
||||
.file-logs-table th .file-log-sort-button:hover { color: var(--accent); }
|
||||
.file-logs-table th[aria-sort="ascending"] .file-log-sort-button,
|
||||
.file-logs-table th[aria-sort="descending"] .file-log-sort-button { color: var(--accent); }
|
||||
.file-logs-table .file-log-sort-indicator { font-size: 11px; opacity: .8; }
|
||||
|
||||
.file-logs-table tbody tr:not(.file-log-detail-row) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user