This commit is contained in:
Mateusz Gruszczyński committed 2026-11-28 17:36:53 +01:00
1 parent 5b6d4a7903
commit 4d1087e357
160 files changed
+2407 -1933

No files matched your search

-10
View File
@@ -11,13 +11,8 @@ from pathlib import Path
WEB = Path(__file__).resolve().parents[1] / "src/admin/web"
ROOT = WEB / "cf_page"
# Use the exact dashboard brand mark: r / p with the same span structure,
# typography, dimensions and border styles as css/20-shell.css.
LOGO = '<span class="brand-mark" aria-label="RustProxy">r<span>/</span>p</span>'
# Code, title, explanation, advice, RustProxy status label, origin status label,
# RustProxy indicator, origin indicator. Indicators describe this request only;
# they must never claim to have checked the upstream's health.
STATUSES = [
(200, "Service ready", "RustProxy received and handled the request.", "No further action is required for this response.", "Working", "Not checked", "ok", "unknown"),
(400, "Bad request", "The request was malformed or could not be understood.", "Check the request and try again.", "Request rejected", "Not contacted", "error", "unknown"),
@@ -85,7 +80,6 @@ ICONS = {
"origin": '''<svg viewBox="0 0 120 106" aria-hidden="true" focusable="false"><rect x="22" y="13" width="76" height="27" rx="4" fill="#aaa"/><rect x="22" y="46" width="76" height="27" rx="4" fill="#aaa"/><circle cx="34" cy="27" r="4" fill="#f1f1f1"/><circle cx="34" cy="60" r="4" fill="#f1f1f1"/><path d="M48 27h38M48 60h38" stroke="#d9d9d9" stroke-width="4" stroke-linecap="round"/><path d="M60 73v14m-21 0h42" stroke="#aaa" stroke-width="7" stroke-linecap="round"/></svg>''',
}
def node(icon: str, location: str, title: str, state: str, indicator: str) -> str:
indicator_glyph = {"ok": "&#10003;", "error": "&#215;", "unknown": "&#8211;"}[indicator]
return (
@@ -95,7 +89,6 @@ def node(icon: str, location: str, title: str, state: str, indicator: str) -> st
f'<p class="state {indicator}">{escape(state)}</p></div>'
)
def make_page(code: int | None, title: str, happened: str, advice: str, gateway: str, origin: str,
gateway_indicator: str, origin_indicator: str, *, variant: str = "status") -> str:
arrow = '<div class="connector" aria-hidden="true"><svg viewBox="0 0 100 30"><path d="M8 15h84m-74-10L8 15l10 10M82 5l10 10-10 10"/></svg></div>'
@@ -133,7 +126,6 @@ def make_page(code: int | None, title: str, happened: str, advice: str, gateway:
</html>
'''
VARIANTS = [
("welcome", "Congratulations! RustProxy is running.",
"RustProxy is installed and serving this page. This does not verify an upstream application.",
@@ -145,7 +137,6 @@ VARIANTS = [
"Page served", "Not checked", "ok", "unknown"),
]
def main() -> None:
ROOT.mkdir(parents=True, exist_ok=True)
for entry in STATUSES:
@@ -155,6 +146,5 @@ def main() -> None:
(ROOT / f"{variant}.html").write_text(make_page(None, *entry, variant=variant), encoding="utf-8")
print(f"Generated {len(STATUSES) + len(VARIANTS)} offline RustProxy-branded pages")
if __name__ == "__main__":
main()