feat: choose which checkers may check private addresses, check types per organization
ci / image (pull_request) Successful in 3m33s
ci / lint (pull_request) Successful in 6m25s
ci / test (pull_request) Successful in 11m34s
ci / build (pull_request) Successful in 11m54s

Whether platform checkers may check private addresses, including the
host's Docker socket, is now a platform setting; unset, it stays as
before: allowed self-hosted, forbidden in the cloud edition. Each of an
organization's checkers has its own switch, on by default, settable at
creation and toggled in the checker list. Both apply from the checker's
next poll.

Organizations choose in their settings which of the platform's check
types their members are offered; existing monitors keep running, and if
the platform later switches off everything an organization kept, it is
offered the platform's types again rather than none. Forms marked
data-autosave are sent when a field changes.

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-22 17:18:22 +01:00
1 parent 0b7f48a609
commit 465fda60dc
26 files changed
+984 -281

No files matched your search

+36 -5
View File
@@ -22,6 +22,9 @@ type Agent struct {
Region string
Prefix string
LastSeen string
// AllowPrivate is set for an organization's checkers: whether they
// may check private addresses.
AllowPrivate *bool
}
// RegionsView is the data of the org regions page and the admin panel.
@@ -106,6 +109,10 @@ templ regionsBody(v RegionsView) {
}
</select>
</label>
if v.APIBase == "/org" {
@checkbox(i18n.T(ctx, "agents.allow_private"), "allow_private", true)
<p class="-mt-2 mb-4 ml-6 text-xs text-muted">{ i18n.T(ctx, "agents.allow_private_hint") }</p>
}
@submit(i18n.T(ctx, "agents.create"))
<div data-link-output hidden class="mt-6 border border-ink p-4">
<p class="mb-2 text-sm">{ i18n.T(ctx, "agents.token_now") }</p>
@@ -128,6 +135,15 @@ templ regionsBody(v RegionsView) {
}
<span class="block font-mono text-xs text-muted">{ a.Prefix }… · { a.LastSeen }</span>
</span>
if a.AllowPrivate != nil {
<form data-api={ v.APIBase + "/agents/" + a.ID } data-method="patch" data-autosave class="ml-auto">
<label class="flex items-center gap-2 text-xs text-muted">
<input type="checkbox" name="allow_private" checked?={ *a.AllowPrivate } class="accent-ink"/>
{ i18n.T(ctx, "agents.allow_private_short") }
</label>
<p data-error class="hidden text-xs text-down"></p>
</form>
}
<button type="button" data-delete={ v.APIBase + "/agents/" + a.ID } data-confirm={ i18n.T(ctx, "agents.revoke_confirm") } class="text-muted hover:text-down">{ i18n.T(ctx, "members.revoke") }</button>
</li>
}
@@ -143,7 +159,7 @@ templ RegionsPage(p Page, me Me, v RegionsView) {
}
}
templ AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption) {
templ AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption, platformPrivate bool) {
@consoleShell(p, me) {
@settingsHeading("admin.title", "admin.intro")
<p class="-mt-4 mb-8 flex gap-4 text-sm">
@@ -151,7 +167,8 @@ templ AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []
<a href="/admin/legal" class="underline underline-offset-2">{ i18n.T(ctx, "legal.platform_title") }</a>
</p>
@regionsBody(v)
@checkTypesSection(checkTypes)
@checkerNetworkSection(platformPrivate)
@checkTypesSection(checkTypes, "/admin/check-types", "/admin", "admin.check_types_intro")
@storageSection(storage)
}
}
@@ -162,11 +179,25 @@ type CheckTypeOption struct {
Enabled bool
}
templ checkTypesSection(types []CheckTypeOption) {
templ checkerNetworkSection(allow bool) {
<section class="mt-12 max-w-3xl">
@sectionHeading("admin.checker_network")
<form data-api="/admin/checker-network" data-method="put" data-next="/admin">
@formError()
@checkbox(i18n.T(ctx, "admin.platform_private"), "allow_private", allow)
<p class="mb-4 ml-6 text-xs text-muted">{ i18n.T(ctx, "admin.platform_private_hint") }</p>
<button type="submit" class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "common.save") }</button>
</form>
</section>
}
// checkTypesSection lets the platform or an organization choose the
// check types it offers.
templ checkTypesSection(types []CheckTypeOption, api, next, introID string) {
<section class="mt-12 max-w-3xl">
@sectionHeading("admin.check_types")
<p class="mb-4 text-sm text-muted">{ i18n.T(ctx, "admin.check_types_intro") }</p>
<form data-api="/admin/check-types" data-method="put" data-next="/admin">
<p class="mb-4 text-sm text-muted">{ i18n.T(ctx, introID) }</p>
<form data-api={ api } data-method="put" data-next={ next }>
@formError()
<div class="mb-4 grid grid-cols-2 gap-x-6 gap-y-1.5 text-sm sm:grid-cols-3">
for _, t := range types {