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

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:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-26 18:18:08 +01:00
1 parent df39b765cb
commit cca4e80e54
39 files changed
+4332 -1408

No files matched your search

+19 -8
View File
@@ -59,9 +59,9 @@ func (q *Queries) ClearStatusPageMonitors(ctx context.Context, pageID uuid.UUID)
}
const createStatusPage = `-- name: CreateStatusPage :one
INSERT INTO status_pages (org_id, slug, title, description, published, show_component_details, domain_token, theme)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method
INSERT INTO status_pages (org_id, slug, title, description, published, show_component_details, domain_token, theme, subscriptions)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method, subscriptions
`
type CreateStatusPageParams struct {
@@ -73,6 +73,7 @@ type CreateStatusPageParams struct {
ShowComponentDetails bool
DomainToken string
Theme []byte
Subscriptions bool
}
func (q *Queries) CreateStatusPage(ctx context.Context, arg CreateStatusPageParams) (StatusPage, error) {
@@ -85,6 +86,7 @@ func (q *Queries) CreateStatusPage(ctx context.Context, arg CreateStatusPagePara
arg.ShowComponentDetails,
arg.DomainToken,
arg.Theme,
arg.Subscriptions,
)
var i StatusPage
err := row.Scan(
@@ -107,6 +109,7 @@ func (q *Queries) CreateStatusPage(ctx context.Context, arg CreateStatusPagePara
&i.DomainCheckedAt,
&i.DomainFailingSince,
&i.DomainVerifyMethod,
&i.Subscriptions,
)
return i, err
}
@@ -242,7 +245,7 @@ func (q *Queries) DomainsToCheck(ctx context.Context, arg DomainsToCheckParams)
}
const findPublishedPage = `-- name: FindPublishedPage :one
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method FROM status_pages
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method, subscriptions FROM status_pages
WHERE published AND suspended_at IS NULL
AND NOT EXISTS (SELECT 1 FROM orgs o WHERE o.id = status_pages.org_id AND o.suspended_at IS NOT NULL)
AND (($1::citext IS NOT NULL AND custom_domain = $1 AND domain_verified_at IS NOT NULL)
@@ -279,12 +282,13 @@ func (q *Queries) FindPublishedPage(ctx context.Context, arg FindPublishedPagePa
&i.DomainCheckedAt,
&i.DomainFailingSince,
&i.DomainVerifyMethod,
&i.Subscriptions,
)
return i, err
}
const getStatusPage = `-- name: GetStatusPage :one
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method FROM status_pages WHERE id = $1
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method, subscriptions FROM status_pages WHERE id = $1
`
func (q *Queries) GetStatusPage(ctx context.Context, id uuid.UUID) (StatusPage, error) {
@@ -310,6 +314,7 @@ func (q *Queries) GetStatusPage(ctx context.Context, id uuid.UUID) (StatusPage,
&i.DomainCheckedAt,
&i.DomainFailingSince,
&i.DomainVerifyMethod,
&i.Subscriptions,
)
return i, err
}
@@ -350,7 +355,7 @@ func (q *Queries) ListStatusPageGroups(ctx context.Context, pageID uuid.UUID) ([
}
const listStatusPages = `-- name: ListStatusPages :many
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method FROM status_pages ORDER BY title
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method, subscriptions FROM status_pages ORDER BY title
`
func (q *Queries) ListStatusPages(ctx context.Context) ([]StatusPage, error) {
@@ -382,6 +387,7 @@ func (q *Queries) ListStatusPages(ctx context.Context) ([]StatusPage, error) {
&i.DomainCheckedAt,
&i.DomainFailingSince,
&i.DomainVerifyMethod,
&i.Subscriptions,
); err != nil {
return nil, err
}
@@ -520,7 +526,7 @@ UPDATE status_pages SET
custom_domain = $1,
updated_at = now()
WHERE id = $2
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method, subscriptions
`
type SetStatusPageDomainParams struct {
@@ -552,6 +558,7 @@ func (q *Queries) SetStatusPageDomain(ctx context.Context, arg SetStatusPageDoma
&i.DomainCheckedAt,
&i.DomainFailingSince,
&i.DomainVerifyMethod,
&i.Subscriptions,
)
return i, err
}
@@ -652,9 +659,10 @@ SET slug = $2,
published = $5,
show_component_details = $6,
theme = $7,
subscriptions = $8,
updated_at = now()
WHERE id = $1
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method, subscriptions
`
type UpdateStatusPageParams struct {
@@ -665,6 +673,7 @@ type UpdateStatusPageParams struct {
Published bool
ShowComponentDetails bool
Theme []byte
Subscriptions bool
}
func (q *Queries) UpdateStatusPage(ctx context.Context, arg UpdateStatusPageParams) (StatusPage, error) {
@@ -676,6 +685,7 @@ func (q *Queries) UpdateStatusPage(ctx context.Context, arg UpdateStatusPagePara
arg.Published,
arg.ShowComponentDetails,
arg.Theme,
arg.Subscriptions,
)
var i StatusPage
err := row.Scan(
@@ -698,6 +708,7 @@ func (q *Queries) UpdateStatusPage(ctx context.Context, arg UpdateStatusPagePara
&i.DomainCheckedAt,
&i.DomainFailingSince,
&i.DomainVerifyMethod,
&i.Subscriptions,
)
return i, err
}