feat: add custom domains

This commit is contained in:
2026-04-10 05:09:28 +04:00
parent 34470197d1
commit b80258f17e
9 changed files with 201 additions and 13 deletions
+4 -2
View File
@@ -17,6 +17,7 @@ const StatusPageBody = t.Object({
show_cert_expiry: t.Optional(t.Boolean()),
bar_frequency: t.Optional(BarFrequency),
bar_count: t.Optional(t.Number({ minimum: 1, maximum: 180 })),
custom_domain: t.Optional(t.Nullable(t.String({ maxLength: 253 }))),
custom_css: t.Optional(t.Nullable(t.String({ maxLength: 50_000 }))),
footer_text: t.Optional(t.Nullable(t.String({ maxLength: 5000 }))),
og_image_url: t.Optional(t.Nullable(t.String({ maxLength: 2048 }))),
@@ -129,7 +130,7 @@ export const statusPages = new Elysia({ prefix: "/pages" })
account_id, slug, title, description, theme, password_hash, index_search,
show_powered_by, show_response_time, show_cert_expiry,
bar_frequency, bar_count,
custom_css, footer_text, og_image_url, analytics_html, auto_refresh_s
custom_domain, custom_css, footer_text, og_image_url, analytics_html, auto_refresh_s
)
VALUES (
${accountId}, ${body.slug}, ${body.title}, ${body.description ?? null},
@@ -137,7 +138,7 @@ export const statusPages = new Elysia({ prefix: "/pages" })
${body.show_powered_by ?? true}, ${body.show_response_time ?? true},
${body.show_cert_expiry ?? false},
${body.bar_frequency ?? 'daily'}, ${body.bar_count ?? 90},
${css}, ${body.footer_text ?? null}, ${body.og_image_url ?? null},
${body.custom_domain || null}, ${css}, ${body.footer_text ?? null}, ${body.og_image_url ?? null},
${body.analytics_html ?? null}, ${body.auto_refresh_s ?? 60}
)
RETURNING *
@@ -193,6 +194,7 @@ export const statusPages = new Elysia({ prefix: "/pages" })
show_cert_expiry = COALESCE(${body.show_cert_expiry ?? null}, show_cert_expiry),
bar_frequency = COALESCE(${body.bar_frequency ?? null}, bar_frequency),
bar_count = COALESCE(${body.bar_count ?? null}, bar_count),
custom_domain = CASE WHEN ${body.custom_domain !== undefined} THEN ${body.custom_domain || null} ELSE custom_domain END,
custom_css = CASE WHEN ${body.custom_css !== undefined} THEN ${css} ELSE custom_css END,
footer_text = COALESCE(${body.footer_text ?? null}, footer_text),
og_image_url = COALESCE(${body.og_image_url ?? null}, og_image_url),