feat(statuspages): email subscriptions, RSS feed and a JSON API
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / test (pull_request) Successful in 9m5s
ci / lint (pull_request) Successful in 10m24s
ci / build (pull_request) Successful in 18m10s
ci / image (pull_request) Successful in 5m16s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / test (pull_request) Successful in 9m5s
ci / lint (pull_request) Successful in 10m24s
ci / build (pull_request) Successful in 18m10s
ci / image (pull_request) Successful in 5m16s
Visitors can subscribe to a page's incidents by email where the organization allows it. They confirm their address first; confirmation and unsubscribe links only show a button, so mail scanners do not act on them, and mails carry RFC 8058 one-click unsubscribe headers. Subscribers get a mail when an incident opens or resolves and for every public update. Every page also has an RSS feed of incidents and planned maintenance and a read-only JSON API (status, summary, components, incidents), both served from the cached snapshot. Abuse protection: status page servers limit feed and API reads, subscription requests and link actions per visitor; the API limits subscription requests per visitor, mailbox and page, and a new limit caps the subscriptions an organization's pages gain in seven days (platform default and per-organization override, 1000 in the cloud). Unconfirmed subscriptions count towards it and are deleted after a week. The fixed cap of 200 monitors per status page is gone; the configurable limit alone decides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
df39b765cb
commit
cca4e80e54
39 files changed
+4332
-1408
No files matched your search
@@ -15,7 +15,12 @@ templ publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) {
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<meta http-equiv="refresh" content="60"/>
|
||||
if !a.NoRefresh {
|
||||
<meta http-equiv="refresh" content="60"/>
|
||||
}
|
||||
if a.ComponentBase != "" {
|
||||
<link rel="alternate" type="application/rss+xml" title={ s.Title } href={ a.ComponentBase + "feed.rss" }/>
|
||||
}
|
||||
<title>{ docTitle }</title>
|
||||
if a.InlineCSS == "" {
|
||||
@faviconLinks()
|
||||
@@ -38,6 +43,10 @@ templ publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) {
|
||||
<footer class="flex flex-wrap justify-between gap-x-4 gap-y-2 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 flex-wrap justify-end gap-x-4 gap-y-1">
|
||||
if a.ComponentBase != "" {
|
||||
<a href={ templ.SafeURL(a.ComponentBase + "feed.rss") } class="hover:text-ink">{ i18n.T(ctx, "page.feed") }</a>
|
||||
<a href={ templ.SafeURL(a.ComponentBase + "api/v1/summary") } class="hover:text-ink">{ i18n.T(ctx, "page.api") }</a>
|
||||
}
|
||||
for _, l := range PageLegalLinks(s, a.LegalBase) {
|
||||
@legalLink(l)
|
||||
}
|
||||
@@ -94,6 +103,42 @@ templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
|
||||
}
|
||||
@publicIncidents(s.Incidents)
|
||||
@pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), s.Upcoming(a.Now))
|
||||
if s.Subscribe && a.ComponentBase != "" {
|
||||
@publicSubscribe(s, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// publicSubscribe offers email subscriptions to the page's incidents.
|
||||
templ publicSubscribe(s agentapi.PageSnapshot, a PublicAssets) {
|
||||
<section id="subscribe" class="mb-12 border-t border-rule pt-6">
|
||||
<h2 class="mb-1 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "page.subscribe.title") }</h2>
|
||||
<p class="mb-3 text-sm">{ i18n.T(ctx, "page.subscribe.intro") }</p>
|
||||
<form method="post" action={ templ.SafeURL(a.ComponentBase + "subscribe") } class="flex max-w-md flex-wrap gap-2">
|
||||
<label class="sr-only" for="subscribe-email">{ i18n.T(ctx, "page.subscribe.email") }</label>
|
||||
<input id="subscribe-email" type="email" name="email" required maxlength="254" autocomplete="email" placeholder={ i18n.T(ctx, "page.subscribe.email") } class="min-w-0 flex-1 border border-rule bg-transparent px-2 py-1.5 text-sm"/>
|
||||
<button type="submit" class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "page.subscribe.submit") }</button>
|
||||
</form>
|
||||
<p class="mt-2 text-xs text-muted">{ i18n.T(ctx, "page.subscribe.privacy") }</p>
|
||||
</section>
|
||||
}
|
||||
|
||||
// PublicNoticePage tells a visitor of the page the outcome of a
|
||||
// subscription request, or asks to confirm one with form.
|
||||
templ PublicNoticePage(s agentapi.PageSnapshot, a PublicAssets, title, message string, form *NoticeForm) {
|
||||
@publicShell(s, a, title+" · "+s.Title) {
|
||||
<header class="mb-10">
|
||||
<p class="mb-2 font-mono text-xs text-muted">{ s.Title }</p>
|
||||
<h1 class="text-2xl font-semibold" style="color:var(--page-accent,inherit)">{ title }</h1>
|
||||
</header>
|
||||
<p class="mb-8 max-w-xl">{ message }</p>
|
||||
if form != nil {
|
||||
<form method="post" action={ templ.SafeURL(form.Action) } class="mb-8">
|
||||
<input type="hidden" name="token" value={ form.Token }/>
|
||||
<button type="submit" class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ form.Button }</button>
|
||||
</form>
|
||||
}
|
||||
<p class="mb-12 text-sm"><a href={ templ.SafeURL(a.ComponentBase) } class="underline underline-offset-2">{ i18n.T(ctx, "page.back") }</a></p>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user