Files
uptimesebi/internal/web/public.templ
T
Sebastian UnterschützandClaude Opus 5.5 73eb0f8bcd feat: legal notice and privacy policy as Markdown or link
Admins set the platform's documents, linked in the footer of the console
and sign-in pages and served at /legal/<kind>. Organizations set their
own for their status pages, falling back to the platform's. Documents
travel in the status page snapshot, so status page servers serve them at
/<slug>/imprint and /imprint on custom domains during API outages too.
Markdown is rendered with goldmark, which drops raw HTML and unsafe
links; stored links must be http or https.

Closes #67

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
2026-11-22 10:17:39 +01:00

118 lines
4.2 KiB
Templ
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package web
import (
"time"
"git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi"
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
)
templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
<!DOCTYPE html>
<html lang={ i18n.Lang(ctx) }>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="refresh" content="60"/>
<title>{ s.Title }</title>
if a.InlineCSS != "" {
@templ.Raw("<style>" + a.InlineCSS + "</style>")
} else {
<link rel="stylesheet" href={ a.CSSHref }/>
}
if s.Theme.Accent != "" {
@templ.Raw("<style>:root{--page-accent:" + s.Theme.Accent + "}</style>")
}
if s.Theme.CSS != "" {
@templ.Raw("<style>" + s.Theme.CSS + "</style>")
}
</head>
<body class="min-h-screen">
<main class="mx-auto max-w-3xl px-6 py-14">
<header class="mb-10">
if s.Theme.LogoURL != "" {
<img src={ s.Theme.LogoURL } alt={ s.Title } class="mb-6 h-10"/>
}
<h1 class="text-2xl font-semibold" style="color:var(--page-accent,inherit)">{ s.Title }</h1>
if s.Description != "" {
<p class="mt-2 text-muted">{ s.Description }</p>
}
</header>
if !a.StaleSince.IsZero() {
<p class="mb-6 border border-degraded/50 bg-degraded/10 px-4 py-2 text-sm">
{ i18n.T(ctx, "page.stale", "Time", a.StaleSince.UTC().Format("2006-01-02 15:04")+" UTC") }
</p>
}
<section
class={ "mb-12 border-l-4 py-3 pl-4",
templ.KV("border-up", s.Status == agentapi.PageOperational),
templ.KV("border-degraded", s.Status == agentapi.PageDegraded),
templ.KV("border-down", s.Status == agentapi.PageOutage),
templ.KV("border-unknown", s.Status == agentapi.PageUnknown) }
>
<p class="text-lg font-medium">{ i18n.T(ctx, "page.status."+s.Status) }</p>
</section>
for _, sec := range s.Sections {
<section class="mb-10">
if sec.Name != "" {
<h2 class="mb-3 text-xs font-medium uppercase tracking-wider text-muted">{ sec.Name }</h2>
}
<ul class="divide-y divide-rule border-y border-rule">
for _, comp := range sec.Components {
<li class="py-3">
<div class="mb-2 flex items-center gap-2.5">
@statusDot(PageStatus(comp.Status))
<span>{ comp.Name }</span>
<span class="ml-auto text-sm text-muted">{ i18n.T(ctx, "page.component."+comp.Status) }</span>
</div>
@bars(DayBars(comp.Days), 22)
<div class="mt-1 flex justify-between font-mono text-xs text-muted">
<span>{ i18n.T(ctx, "page.days_ago", "Count", len(comp.Days)) }</span>
<span>{ UptimeText(comp.Uptime) }</span>
<span>{ i18n.T(ctx, "page.today") }</span>
</div>
</li>
}
</ul>
</section>
}
<section class="mb-12">
<h2 class="mb-3 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "page.incidents") }</h2>
if len(s.Incidents) == 0 {
<p class="text-sm text-muted">{ i18n.T(ctx, "page.no_incidents") }</p>
} else {
<ul class="divide-y divide-rule border-y border-rule text-sm">
for _, inc := range s.Incidents {
<li class="flex flex-wrap items-baseline gap-x-4 gap-y-1 py-2.5">
if inc.ResolvedAt == nil {
<span class="font-medium text-down">{ i18n.T(ctx, "incidents.ongoing") }</span>
} else {
<span class="text-up">{ i18n.T(ctx, "incidents.resolved") }</span>
}
<span>{ inc.Component }</span>
<span class="ml-auto font-mono text-xs text-muted">
{ inc.StartedAt.UTC().Format("2006-01-02 15:04") }
if inc.ResolvedAt != nil {
– { inc.ResolvedAt.UTC().Format("15:04") }
}
UTC
</span>
</li>
}
</ul>
}
</section>
<footer class="flex justify-between border-t border-rule pt-4 font-mono text-xs text-muted">
<span>{ i18n.T(ctx, "page.updated", "Time", s.GeneratedAt.UTC().Format(time.DateTime)+" UTC") }</span>
<span class="flex gap-4">
for _, l := range PageLegalLinks(s, a.LegalBase) {
@legalLink(l)
}
<span>uptimesebi</span>
</span>
</footer>
</main>
</body>
</html>
}