feat(api): organizations with own status page servers serve their pages alone
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Canceled after 6m3s
ci / test (pull_request) Canceled after 6m2s
ci / build (pull_request) Canceled after 0s
ci / image (pull_request) Canceled after 0s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Canceled after 6m3s
ci / test (pull_request) Canceled after 6m2s
ci / build (pull_request) Canceled after 0s
ci / image (pull_request) Canceled after 0s
The platform's status page servers handed out every published page, including those of organizations running their own servers. Once one of an organization's own status page servers has connected, the agent API now answers the platform's servers 404 for its pages, so they drop them from their cache, and only the organization's servers serve them. A created but never connected token changes nothing, so moving over does not take the pages offline. The console no longer links such pages to the platform's address, which would not serve them; the editor says who does. 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
20874a5a87
commit
c0239e15bb
11 files changed
+905
-778
No files matched your search
+22
-6
@@ -1016,19 +1016,31 @@ func (s *Server) channelsView(c *gin.Context, p *principal, page web.Page, me we
|
||||
return web.ChannelsPage(page, me, v), nil
|
||||
}
|
||||
|
||||
func (s *Server) pageURL(p store.StatusPage) string {
|
||||
// pageURL is where p is reachable, or empty when only the organization's
|
||||
// own status page servers serve it, at an address the platform does not
|
||||
// know.
|
||||
func (s *Server) pageURL(p store.StatusPage, ownServers bool) string {
|
||||
if p.CustomDomain != nil && p.DomainVerifiedAt != nil {
|
||||
return "https://" + *p.CustomDomain + "/"
|
||||
}
|
||||
if ownServers {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSuffix(s.cfg.StatusPageURL, "/") + "/" + p.Slug
|
||||
}
|
||||
|
||||
func (s *Server) statusPagesView(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error) {
|
||||
ctx := c.Request.Context()
|
||||
var rows []store.StatusPage
|
||||
var (
|
||||
rows []store.StatusPage
|
||||
own bool
|
||||
)
|
||||
err := s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
|
||||
var err error
|
||||
rows, err = q.ListStatusPages(ctx)
|
||||
if rows, err = q.ListStatusPages(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
own, err = q.OrgServesOwnPages(ctx, &p.Org.ID)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
@@ -1041,7 +1053,7 @@ func (s *Server) statusPagesView(c *gin.Context, p *principal, page web.Page, me
|
||||
}
|
||||
v.Pages = append(v.Pages, web.PageRow{
|
||||
ID: r.ID.String(), Title: r.Title, Slug: r.Slug, Published: r.Published,
|
||||
URL: s.pageURL(r), Domain: deref(r.CustomDomain), Suspended: r.SuspendedAt != nil,
|
||||
URL: s.pageURL(r, own), Domain: deref(r.CustomDomain), Suspended: r.SuspendedAt != nil,
|
||||
})
|
||||
}
|
||||
return web.StatusPagesPage(page, me, v), nil
|
||||
@@ -1059,6 +1071,7 @@ func (s *Server) statusPageEditor(c *gin.Context, p *principal, page web.Page, m
|
||||
pageGroups []store.StatusPageGroup
|
||||
orgGroups []store.MonitorGroup
|
||||
monitors []store.Monitor
|
||||
own bool
|
||||
)
|
||||
err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
|
||||
var err error
|
||||
@@ -1074,7 +1087,10 @@ func (s *Server) statusPageEditor(c *gin.Context, p *principal, page web.Page, m
|
||||
if orgGroups, err = q.ListGroups(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
monitors, err = q.ListMonitors(ctx)
|
||||
if monitors, err = q.ListMonitors(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
own, err = q.OrgServesOwnPages(ctx, &p.Org.ID)
|
||||
return err
|
||||
})
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
@@ -1089,7 +1105,7 @@ func (s *Server) statusPageEditor(c *gin.Context, p *principal, page web.Page, m
|
||||
Published: row.Published, ShowDetails: row.ShowComponentDetails,
|
||||
Suspended: row.SuspendedAt != nil, SuspendedReason: row.SuspendedReason,
|
||||
Accent: v.Theme.Accent, LogoURL: v.Theme.LogoURL, CSS: v.Theme.CSS,
|
||||
URL: s.pageURL(row), Domain: deref(row.CustomDomain), DomainVerified: v.DomainVerified,
|
||||
URL: s.pageURL(row, own), OwnServers: own, Domain: deref(row.CustomDomain), DomainVerified: v.DomainVerified,
|
||||
HasOrgGroups: len(orgGroups) > 0,
|
||||
}
|
||||
if v.DomainRecord != nil {
|
||||
|
||||
Reference in new issue
Block a user