Extend badge color settings to cover integration types too

Settings → DNS Badges only let you customize DNS provider badge
colors. Expand it into a general Badges page with a second section
for the six integration types (Tailscale, Proxmox, Synology,
Semaphore, Gitea, Dockhand), applied to the type badge in the Manage
integrations table.

- New integrationColors key on AppSettings, stored/merged the same way
  as providerColors via the existing settingsStore.
- New GET /api/settings/integration-colors — non-secret, any signed-in
  user, mirroring /provider-colors — so the badge color can be read
  without needing admin access to the full settings payload.
- Renamed DnsBadgeSettings.tsx -> BadgeSettings.tsx (route
  /settings/dns-badges -> /settings/badges, sub-nav label "DNS
  Badges" -> "Badges") with both color sections saved together.

Verified end-to-end against the real dev server: PUT persists
integration colors independently of provider colors, the public
integration-colors endpoint reflects updates immediately, and the
change is audit-logged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5 committed 2026-09-15 21:28:26 +02:00
1 parent 7fed1dbfa4
commit ad6783b6a1
9 files changed
+175 -100

No files matched your search

+6
View File
@@ -22,6 +22,11 @@ settingsRouter.get("/provider-colors", asyncHandler(async (_req, res) => {
res.json({ providerColors });
}));
settingsRouter.get("/integration-colors", asyncHandler(async (_req, res) => {
const { integrationColors } = await getSettings();
res.json({ integrationColors });
}));
const updateSchema = z.object({
gotify: z.object({ enabled: z.boolean(), url: z.string(), token: z.string(), priority: z.number() }).partial().optional(),
ntfy: z.object({ enabled: z.boolean(), url: z.string(), topic: z.string(), token: z.string(), priority: z.number() }).partial().optional(),
@@ -51,6 +56,7 @@ const updateSchema = z.object({
.partial()
.optional(),
providerColors: z.record(z.string()).optional(),
integrationColors: z.record(z.string()).optional(),
});
settingsRouter.put("/", requireRole("admin"), asyncHandler(async (req, res) => {
+3
View File
@@ -44,6 +44,7 @@ export interface NotificationEvents {
}
export type ProviderColors = Record<string, string>;
export type IntegrationColors = Record<string, string>;
export interface AppSettings {
gotify: GotifySettings;
@@ -52,6 +53,7 @@ export interface AppSettings {
webhook: WebhookSettings;
notifications: NotificationEvents;
providerColors: ProviderColors;
integrationColors: IntegrationColors;
}
const DEFAULTS: AppSettings = {
@@ -68,6 +70,7 @@ const DEFAULTS: AppSettings = {
timezone: "UTC",
},
providerColors: {},
integrationColors: {},
};
const KEYS = Object.keys(DEFAULTS) as (keyof AppSettings)[];