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

+33 -29
View File
@@ -15,7 +15,7 @@ import (
const adminListOrgs = `-- name: AdminListOrgs :many
SELECT o.id, o.slug, o.name, o.created_at, o.suspended_at, o.suspended_reason,
o.limit_monitors, o.limit_status_pages, o.limit_regions_per_monitor, o.limit_own_regions_count,
o.limit_monitors_per_page,
o.limit_monitors_per_page, o.limit_subscribers_per_week,
(SELECT count(*) FROM monitors m WHERE m.org_id = o.id)::integer AS monitors,
(SELECT count(*) FROM status_pages p WHERE p.org_id = o.id)::integer AS status_pages,
coalesce(ow.id, '00000000-0000-0000-0000-000000000000'::uuid)::uuid AS owner_id,
@@ -52,26 +52,27 @@ type AdminListOrgsParams struct {
}
type AdminListOrgsRow struct {
ID uuid.UUID
Slug string
Name string
CreatedAt time.Time
SuspendedAt *time.Time
SuspendedReason string
LimitMonitors *int32
LimitStatusPages *int32
LimitRegionsPerMonitor *int32
LimitOwnRegionsCount *bool
LimitMonitorsPerPage *int32
Monitors int32
StatusPages int32
OwnerID uuid.UUID
OwnerEmail string
OwnerDisabledAt *time.Time
OwnerDisabledReason string
OwnerIsAdmin bool
OwnerLimitOrgs *int32
OwnerOrgs int32
ID uuid.UUID
Slug string
Name string
CreatedAt time.Time
SuspendedAt *time.Time
SuspendedReason string
LimitMonitors *int32
LimitStatusPages *int32
LimitRegionsPerMonitor *int32
LimitOwnRegionsCount *bool
LimitMonitorsPerPage *int32
LimitSubscribersPerWeek *int32
Monitors int32
StatusPages int32
OwnerID uuid.UUID
OwnerEmail string
OwnerDisabledAt *time.Time
OwnerDisabledReason string
OwnerIsAdmin bool
OwnerLimitOrgs *int32
OwnerOrgs int32
}
// System scope: organizations with their usage, limit overrides and owner,
@@ -105,6 +106,7 @@ func (q *Queries) AdminListOrgs(ctx context.Context, arg AdminListOrgsParams) ([
&i.LimitRegionsPerMonitor,
&i.LimitOwnRegionsCount,
&i.LimitMonitorsPerPage,
&i.LimitSubscribersPerWeek,
&i.Monitors,
&i.StatusPages,
&i.OwnerID,
@@ -172,18 +174,19 @@ func (q *Queries) LockOrgUsage(ctx context.Context, orgID uuid.UUID) error {
const setOrgLimits = `-- name: SetOrgLimits :one
UPDATE orgs SET limit_monitors = $1, limit_status_pages = $2,
limit_regions_per_monitor = $3, limit_own_regions_count = $4,
limit_monitors_per_page = $5
WHERE id = $6
limit_monitors_per_page = $5, limit_subscribers_per_week = $6
WHERE id = $7
RETURNING id, slug
`
type SetOrgLimitsParams struct {
Monitors *int32
StatusPages *int32
RegionsPerMonitor *int32
OwnRegionsCount *bool
MonitorsPerPage *int32
ID uuid.UUID
Monitors *int32
StatusPages *int32
RegionsPerMonitor *int32
OwnRegionsCount *bool
MonitorsPerPage *int32
SubscribersPerWeek *int32
ID uuid.UUID
}
type SetOrgLimitsRow struct {
@@ -198,6 +201,7 @@ func (q *Queries) SetOrgLimits(ctx context.Context, arg SetOrgLimitsParams) (Set
arg.RegionsPerMonitor,
arg.OwnRegionsCount,
arg.MonitorsPerPage,
arg.SubscribersPerWeek,
arg.ID,
)
var i SetOrgLimitsRow