fix(admin): show the GoTo title and app icon #46

Merged
eleith merged 1 commits from fix/admin-nav-title into main 2026-11-21 14:55:36 +00:00
21 changed files with 87 additions and 151 deletions

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
---
'@goto/web': patch
'@goto/cli': patch
'@goto/worker': patch
---
Fix the admin and sign-in title to GoTo and remove the `site` config section. Show the app icon beside the title, link the pair to Overview only from other pages, and move Health next to the theme switcher.
+5 -4
View File
@@ -50,10 +50,11 @@ The shared `@goto/config` package validates the YAML contract; the web runtime d
not load it yet. See [the example](examples/goto.yaml) and
[the package API](packages/config/README.md).
Configuration is a single `config/goto.yaml` with `site`, `appearance`, `auth`,
`database`, `analytics`, `defaults`, and `domains` sections. Unknown fields and
null values fail validation. Auth declares exactly one OIDC or shared-credentials
provider; `auth.secret` is optional and is not generated by the loader.
Configuration is a single `config/goto.yaml` with top-level keys `version`,
`url`, `appearance`, `auth`, `database`, `analytics`, `link_defaults`, `fallback`,
and `domains`. Unknown fields and null values fail validation. Auth declares
exactly one OIDC or shared-credentials provider; `auth.secret` is optional and
is not generated by the loader.
Redirect status and query forwarding inherit built-in → global → domain → link.
Fallback inherits only through domain scope. Defaults are 302, forwarding off,
+13 -9
View File
@@ -176,11 +176,12 @@ describe('goto-cli config validate', () => {
environment: env
},
{
name: 'actual error alongside dropped tags',
source: `${validYaml} tags: [., ""]\nsite: {title: null}\n`,
environment: env
name: 'invalid appearance alongside dropped tags',
source: `${validYaml} tags: [., ""]\nappearance: false\n`,
environment: env,
issue: '\n /appearance: Expected object\n'
}
])('reports $name without disclosing configuration', async ({ source, environment }) => {
])('reports $name without disclosing configuration', async ({ source, environment, issue }) => {
await writeConfiguration('config/goto.yaml', source);
const output = createOutput();
@@ -190,6 +191,7 @@ describe('goto-cli config validate', () => {
expect.stringMatching(/^Configuration validation failed\.\n/)
);
const diagnostic = output.stderr.mock.calls[0]?.[0];
if (issue !== undefined) expect(diagnostic).toContain(issue);
for (const sensitive of [...Object.values(env), ...Object.values(environment)]) {
if (sensitive !== undefined) expect(diagnostic).not.toContain(sensitive);
}
@@ -198,17 +200,19 @@ describe('goto-cli config validate', () => {
expect(diagnostic).not.toContain('config/goto.yaml');
});
it('reports the site section for an unsupported site.url without printing its value', async () => {
const oldSiteUrl = 'https://old.example.test/private-do-not-print';
await writeConfiguration('config/goto.yaml', `${validYaml}site:\n url: ${oldSiteUrl}\n`);
it('rejects the removed site section without printing its custom title', async () => {
const oldTitle = 'Private title not for diagnostics';
await writeConfiguration('config/goto.yaml', `${validYaml}site:\n title: ${oldTitle}\n`);
const output = createOutput();
expect(await runCli(['config', 'validate'], output, { cwd, env })).toBe(1);
expect(output.stdout).not.toHaveBeenCalled();
expect(output.stderr).toHaveBeenCalledExactlyOnceWith(
expect.stringMatching(/^Configuration validation failed\.\n {2}\/site: \S[^\n]*\n$/)
expect.stringMatching(
/^Configuration validation failed\.\n {2}\/: Unexpected property\.[^\n]*\n$/
)
);
expect(output.stderr.mock.calls[0]?.[0]).not.toContain(oldSiteUrl);
expect(output.stderr.mock.calls[0]?.[0]).not.toContain(oldTitle);
});
it('reports a missing file without disclosing the path', async () => {
+17 -9
View File
@@ -32,6 +32,8 @@ test('shared credentials protect admin pages and sign-out removes access', async
const signInPage = await page.goto(`${appServer.origin}/admin`);
await expect(page).toHaveURL(/\/signin\?/);
expect(signInPage?.headers()['cache-control']).toBe('private, no-store');
await expect(page).toHaveTitle('Sign in — GoTo');
await expect(page.getByRole('heading', { name: 'Sign in to GoTo', exact: true })).toBeVisible();
await page.getByLabel('Username', { exact: true }).fill('example');
await page.getByLabel('Password', { exact: true }).fill('incorrect');
const failedSignIn = page.waitForResponse(`${appServer.origin}/auth/sign-in/credentials`);
@@ -145,11 +147,15 @@ test('shared credentials protect admin pages and sign-out removes access', async
await expect(visitsValue).toHaveText('4');
await expect(graph).toHaveAccessibleName(/^Visits by week\. Total: 4\./);
expect(navigationWarnings).toEqual([]);
const adminNav = page.getByRole('navigation', { name: 'Administration', exact: true });
const overviewLink = adminNav.getByRole('link', { name: 'GoTo', exact: true });
await expect(adminNav.getByText('GoTo', { exact: true })).toBeVisible();
await expect(overviewLink).toHaveCount(0);
await domainLink.click();
await expect(page.getByRole('heading', { name: 'Domain', exact: true })).toBeVisible();
const context = page.locator('.admin-context');
await expect(context).toHaveCount(0);
await expect(page).toHaveTitle('Domain — go.example.org — Goto');
await expect(page).toHaveTitle('Domain — go.example.org — GoTo');
await expect(acceptedLanguages).toBeVisible();
await expect(browsers.getByRole('columnheader')).toHaveText(['Browser', 'Visits', 'Share']);
await expect(operatingSystems.getByRole('columnheader')).toHaveText([
@@ -158,10 +164,12 @@ test('shared credentials protect admin pages and sign-out removes access', async
'Share'
]);
await expect(browsers.getByRole('rowheader', { name: 'Other', exact: true })).toBeVisible();
const overviewLink = page
.getByRole('navigation', { name: 'Administration', exact: true })
.getByRole('link', { name: 'Goto', exact: true });
await expect(overviewLink).toHaveAttribute('href', '/admin?period=all');
const appIcon = overviewLink.locator('img[src="/@static/favicon.svg"]');
await expect(appIcon).toBeVisible();
await expect
.poll(() => appIcon.evaluate((image: HTMLImageElement) => image.naturalWidth))
.toBeGreaterThan(0);
await expect(page.getByRole('link', { name: 'Overview', exact: true })).toHaveCount(0);
await expect(graph).toHaveAttribute('aria-busy', 'false');
await expect(graph).toHaveAccessibleName(/^Visits by week\. Total: 3\./);
@@ -297,7 +305,7 @@ test('shared credentials protect admin pages and sign-out removes access', async
await expect(redirectCard.locator('dd').nth(1)).toHaveText('/docs');
await expect(page.locator('.admin-cards .admin-stat-label')).toHaveText(['Visits', 'Status']);
await expect(page.getByRole('region', { name: 'Status', exact: true })).toContainText('Active');
await expect(page).toHaveTitle('Link — go.example.org/docs — Goto');
await expect(page).toHaveTitle('Link — go.example.org/docs — GoTo');
await expect(graph).toHaveAttribute('aria-busy', 'false');
await expect(chartTable).toHaveAccessibleName('Visits');
await expect(graph).toHaveAccessibleName(/^Visits by week\. Total: 1\./);
@@ -343,7 +351,7 @@ test('shared credentials protect admin pages and sign-out removes access', async
const tagHeading = page.getByRole('heading', { name: `Tag: ${sharedTag}`, exact: true });
await expect(tagHeading).toBeVisible();
await expect(tagHeading).toHaveAttribute('title', `Tag: ${sharedTag}`);
await expect(page).toHaveTitle(`Tag: ${sharedTag} — Goto`);
await expect(page).toHaveTitle(`Tag: ${sharedTag} — GoTo`);
await expect(page.getByRole('region', { name: 'Tag details', exact: true })).toHaveCount(0);
const taggedLinks = page.getByRole('region', { name: `Links tagged ${sharedTag}`, exact: true });
await expect(taggedLinks.getByRole('link')).toHaveCount(2);
@@ -373,7 +381,7 @@ test('shared credentials protect admin pages and sign-out removes access', async
await domainLink.click();
await page.getByRole('link', { name: '/a%2Fb', exact: true }).click();
await expect(page.getByRole('heading', { name: 'Link', exact: true })).toBeVisible();
await expect(page).toHaveTitle('Link — go.example.org/a%2Fb — Goto');
await expect(page).toHaveTitle('Link — go.example.org/a%2Fb — GoTo');
await expect(redirectCard.getByText('Title', { exact: true })).toHaveCount(0);
await expect(page).toHaveURL(
`${appServer.origin}/admin/domains/go.example.org/links/a%252Fb?period=all`
@@ -385,14 +393,14 @@ test('shared credentials protect admin pages and sign-out removes access', async
`${appServer.origin}/admin/domains/go.example.org/links/a/b?period=all`
);
await expect(page.getByRole('heading', { name: 'Link', exact: true })).toBeVisible();
await expect(page).toHaveTitle('Link — go.example.org/a/b — Goto');
await expect(page).toHaveTitle('Link — go.example.org/a/b — GoTo');
await expect(visitsValue).toHaveText('0');
await page.goBack();
await rootLink.click();
await expect(page).toHaveURL(`${appServer.origin}/admin/domains/go.example.org/links?period=all`);
await expect(page.getByRole('heading', { name: 'Root', exact: true })).toBeVisible();
await expect(page).toHaveTitle('Root — go.example.org — Goto');
await expect(page).toHaveTitle('Root — go.example.org — GoTo');
await expect(acceptedLanguages).toBeVisible();
await expect(visitsValue).toHaveText('1');
await expect(page.getByRole('region', { name: 'Status', exact: true })).toHaveCount(0);
@@ -5,9 +5,10 @@
import { authClient } from '#lib/auth-client.js';
import ThemeToggle from '../ThemeToggle.svelte';
let { title, overviewHref }: { title: string; overviewHref: string } = $props();
let { overviewHref }: { overviewHref: string } = $props();
let currentPath = $derived(page.url.pathname + page.url.search);
let onOverview = $derived(page.url.pathname === '/admin');
let pending = $state(false);
let signoutError = $state<'rate' | 'network' | 'auth' | null>(null);
@@ -47,12 +48,19 @@
}}
/>
{#snippet titleWithIcon()}
<img src="/@static/favicon.svg" alt="" width="24" height="24" />
GoTo
{/snippet}
<header class="admin-nav">
<div class="nav-container">
<nav aria-label="Administration">
<a href={overviewHref} aria-current={page.url.pathname === '/admin' ? 'page' : undefined}
>{title}</a
>
<nav class="nav-container" aria-label="Administration">
{#if onOverview}
<span class="nav-title" aria-current="page">{@render titleWithIcon()}</span>
{:else}
<a class="nav-title" href={overviewHref}>{@render titleWithIcon()}</a>
{/if}
<div class="nav-actions">
<a
class="ui-button health-link"
href="/admin/health"
@@ -62,8 +70,6 @@
>
<IconHeartbeat aria-hidden="true" focusable="false" />
</a>
</nav>
<div class="nav-actions">
<ThemeToggle />
<form method="POST" aria-label="Sign out" aria-busy={pending} onsubmit={signOut}>
<button
@@ -76,7 +82,7 @@
</button>
</form>
</div>
</div>
</nav>
{#if signoutError}
<p id="signout-error" class="signout-error" role="alert">
{#if signoutError === 'rate'}
@@ -106,14 +112,10 @@
gap: var(--space-5);
}
nav {
display: flex;
flex-wrap: wrap;
.nav-title {
display: inline-flex;
align-items: center;
gap: var(--space-5);
}
a {
gap: var(--space-4);
color: var(--color-text);
font-weight: 600;
text-decoration: none;
@@ -5,7 +5,6 @@
import '#lib/styles/admin.css';
let {
siteTitle,
title: heading,
documentTitle,
context,
@@ -14,7 +13,6 @@
actions,
children
}: {
siteTitle: string;
title: string;
documentTitle?: string;
context?: Snippet;
@@ -28,8 +26,8 @@
let compactActivityText = $derived(formatLastVisitCompact(lastActivityAt));
</script>
<svelte:head><title>{documentTitle ?? heading} — {siteTitle}</title></svelte:head>
<AdminNav title={siteTitle} {overviewHref} />
<svelte:head><title>{documentTitle ?? heading} — GoTo</title></svelte:head>
<AdminNav {overviewHref} />
<main class="admin-page">
<header class="admin-heading">
<div class="admin-title-row">
@@ -111,8 +111,7 @@ test('an existing request retains its snapshot when the application publishes an
current = prepareSnapshot(
loadConfig(
{
url: { app: 'https://admin.example.org' },
site: { title: 'Updated' },
url: { app: 'https://updated-admin.example.org' },
auth: { credentials: { username: 'example', password: 'test-password' } },
domains: {}
},
@@ -124,7 +123,7 @@ test('an existing request retains its snapshot when the application publishes an
expect(requestSnapshot(first)).toBe(initial);
expect(requestSnapshot(second)).toBe(current);
expect(requestSnapshot(first)?.configuration.site.title).toBe('Goto');
expect(requestSnapshot(first)?.configuration.url.app).toBe('https://admin.example.org');
});
test('binding neither consumes the request body nor serializes private configuration', async () => {
@@ -26,7 +26,7 @@
let acceptedLanguageVisits = $derived(data.acceptedLanguageVisitsByTimeframe[timeframe] ?? null);
</script>
<AdminPage siteTitle={data.title} title="Overview" lastActivityAt={data.lastActivityAt}>
<AdminPage title="Overview" lastActivityAt={data.lastActivityAt}>
{#snippet actions()}
{#if data.available && data.timeframes.length > 0}
<VisitTimeframes
@@ -28,7 +28,6 @@
</script>
<AdminPage
siteTitle={data.title}
title="Domain"
documentTitle={`Domain — ${data.domain}`}
lastActivityAt={data.lastActivityAt}
@@ -27,7 +27,6 @@
</script>
<AdminPage
siteTitle={data.title}
title="Root"
documentTitle={`Root — ${data.domain}`}
lastActivityAt={data.lastActivityAt}
@@ -28,7 +28,6 @@
</script>
<AdminPage
siteTitle={data.title}
title="Link"
documentTitle={`Link — ${data.domain}${data.path}`}
lastActivityAt={data.lastActivityAt}
@@ -22,7 +22,7 @@
};
</script>
<AdminPage siteTitle={data.title} title="Health">
<AdminPage title="Health">
<section class="admin-info" aria-labelledby="application-heading">
<h2 id="application-heading">Application</h2>
<dl>
@@ -28,7 +28,6 @@
</script>
<AdminPage
siteTitle={data.title}
title={`Tag: ${data.tag}`}
lastActivityAt={data.lastActivityAt}
overviewHref={`/admin?period=${timeframe}`}
@@ -67,7 +67,7 @@
</script>
<svelte:head>
<title>Sign in — {data.title}</title>
<title>Sign in — GoTo</title>
</svelte:head>
<svelte:window
@@ -79,7 +79,7 @@
<div class="signin-container">
<main class="signin-card">
<header>
<h1>Sign in to {data.title}</h1>
<h1>Sign in to GoTo</h1>
</header>
{#if errorCode}
@@ -1,5 +0,0 @@
import type { LayoutServerLoad } from './$types';
export const load: LayoutServerLoad = ({ locals }) => {
return { title: locals.snapshot.configuration.site.title };
};
-3
View File
@@ -5,9 +5,6 @@ url:
app: https://goto.example.net
worker: http://goto-worker:9000
site:
title: Goto
appearance:
primary_light_color: '#0f766e'
primary_dark_color: '#5eead4'
-34
View File
@@ -6,7 +6,6 @@
"properties": {
"version": { "default": 1, "const": 1, "type": "number" },
"url": { "default": {}, "$ref": "#/$defs/Url" },
"site": { "default": {}, "$ref": "#/$defs/Site" },
"appearance": { "default": {}, "$ref": "#/$defs/Appearance" },
"auth": { "$ref": "#/$defs/Auth" },
"database": { "default": {}, "$ref": "#/$defs/Database" },
@@ -107,20 +106,6 @@
}
]
},
"LocalImagePath": {
"description": "A decoded /public/ SVG, PNG, JPEG, GIF or WebP image path without dot segments, percent escapes, backslashes, queries or fragments.",
"type": "string",
"anyOf": [
{
"type": "string",
"pattern": "^/public/(?:(?!\\.{1,2}(?:/|$))[^/%\\\\?#\\x00-\\x1f\\x7f]+/)*(?!\\.{1,2}(?:/|$))[^/%\\\\?#\\x00-\\x1f\\x7f]+\\.(?:[sS][vV][gG]|[pP][nN][gG]|[jJ][pP][eE]?[gG]|[gG][iI][fF]|[wW][eE][bB][pP])(?![\\s\\S])"
},
{
"type": "string",
"pattern": "(?:^|[^$])(?:\\$\\$)*\\$\\{[A-Z_][A-Z0-9_]*(?::-[^}]*)?\\}"
}
]
},
"HexColor": {
"type": "string",
"anyOf": [
@@ -175,25 +160,6 @@
"worker": { "default": "http://goto-worker:9000", "$ref": "#/$defs/BaseUrl" }
}
},
"Site": {
"additionalProperties": false,
"type": "object",
"properties": {
"title": {
"default": "Goto",
"type": "string",
"anyOf": [
{ "type": "string", "pattern": "\\S", "minLength": 1 },
{
"type": "string",
"pattern": "(?:^|[^$])(?:\\$\\$)*\\$\\{[A-Z_][A-Z0-9_]*(?::-[^}]*)?\\}"
}
]
},
"logo_path": { "$ref": "#/$defs/LocalImagePath" },
"favicon_path": { "$ref": "#/$defs/LocalImagePath" }
}
},
"Appearance": {
"additionalProperties": false,
"type": "object",
+8 -8
View File
@@ -24,15 +24,15 @@ function captureConfigError(action: () => unknown): ConfigError {
describe('configuration diagnostics', () => {
it('keeps the error message generic and formats issues only when requested', () => {
const issues = [{ path: '/site', message: 'Expected object' }];
const issues = [{ path: '/url', message: 'Expected object' }];
const error = new ConfigError(issues);
expect(error.message).toBe('Invalid configuration');
expect(String(error)).toBe('ConfigError: Invalid configuration');
expect(error.issues).toEqual(issues);
expect(error).not.toHaveProperty('cause');
expect(formatConfigError(error)).toBe('Invalid configuration\n /site: Expected object');
expect(formatConfigError(error)).toBe('Invalid configuration\n /url: Expected object');
expect(formatConfigError(error, 'Configuration validation failed.')).toBe(
'Configuration validation failed.\n /site: Expected object'
'Configuration validation failed.\n /url: Expected object'
);
expect(new ConfigError().issues).toEqual([]);
expect(formatConfigError(new ConfigError())).toBe('Invalid configuration');
@@ -76,12 +76,12 @@ describe('configuration diagnostics', () => {
}
});
it('identifies the site section and its allowed fields without echoing the old URL', () => {
it('identifies the URL section and its allowed fields without echoing the value', () => {
const error = captureConfigError(() =>
loadConfig(
{
...configurationInput(),
site: { url: `https://${privateValue}.example.com` }
url: { origin: `https://${privateValue}.example.com` }
},
options
)
@@ -89,8 +89,8 @@ describe('configuration diagnostics', () => {
expect(error.message).toBe('Invalid configuration');
expect(error.issues).toEqual([
{
path: '/site',
message: 'Unexpected property. Allowed fields: title, logo_path, favicon_path'
path: '/url',
message: 'Unexpected property. Allowed fields: app, worker'
}
]);
expect(JSON.stringify(error)).not.toContain(privateValue);
@@ -99,7 +99,7 @@ describe('configuration diagnostics', () => {
it.each([
{ override: { [privateKey]: privateValue }, path: '/' },
{ override: { site: { [privateKey]: privateValue } }, path: '/site' }
{ override: { url: { [privateKey]: privateValue } }, path: '/url' }
])('omits unknown property names and values at $path', ({ override, path }) => {
const error = captureConfigError(() =>
loadConfig({ ...configurationInput(), ...override }, options)
+2 -3
View File
@@ -23,11 +23,10 @@ describe('Goto editor schema', () => {
it('relaxes defaulted fields while keeping authentication, domain links and destinations required', () => {
const editor = createEditorSchema();
expect(editor.required).toEqual(['auth', 'domains']);
for (const name of ['Url', 'Site', 'Appearance', 'Database', 'Analytics', 'LinkDefaults']) {
for (const name of ['Url', 'Appearance', 'Database', 'Analytics', 'LinkDefaults']) {
expect(definition(editor, name).required).toBeUndefined();
}
expect(property(editor, 'site')).toEqual({ $ref: '#/$defs/Site', default: {} });
expect(object(definition(editor, 'Site').properties)).not.toHaveProperty('url');
expect(object(editor.properties)).not.toHaveProperty('site');
expect(property(editor, 'url')).toEqual({ $ref: '#/$defs/Url', default: {} });
expect(property(definition(editor, 'Url'), 'app')).toEqual({
$ref: '#/$defs/AppUrl',
+9 -25
View File
@@ -12,10 +12,7 @@ const yaml = 'auth: {credentials: {username: admin, password: test-password}}\nd
const authoredKeyMarker = 'dummy-authored-key-marker';
describe('configuration loading', () => {
it('parses YAML and applies configuration defaults without mutating the input', () => {
expect(parseConfig(`${yaml}\nsite: {title: yes}`, options).configuration.site.title).toBe(
'yes'
);
it('applies configuration defaults without mutating the input', () => {
const input = configurationInput();
const original = structuredClone(input);
const { configuration, warnings } = loadConfig(input, options);
@@ -23,7 +20,6 @@ describe('configuration loading', () => {
expect(configuration).toMatchObject({
version: 1,
url: { app: 'http://localhost:3000', worker: 'http://goto-worker:9000' },
site: { title: 'Goto' },
database: { path: './data/goto.sqlite', worker_path: './data/worker.sqlite' },
analytics: { retention_months: 3 },
link_defaults: {
@@ -225,7 +221,9 @@ domains:
}
]);
expect(() => loadConfig(input, options)).toThrow(ConfigError);
expect(() => loadConfig({ ...input, site: null }, { env: { TAG: '.' } })).toThrow(ConfigError);
expect(() => loadConfig({ ...input, appearance: false }, { env: { TAG: '.' } })).toThrow(
expect.objectContaining({ issues: [{ path: '/appearance', message: 'Expected object' }] })
);
});
it.each([null, {}, 'work', ['work', 42], [false], [null], [{}]])(
@@ -348,19 +346,8 @@ domains:
);
});
it('rejects the old site URL key without accepting it as an app URL', () => {
for (const url of [undefined, { app: 'https://admin.example.com' }]) {
expect(() =>
loadConfig(
{
...configurationInput(),
...(url === undefined ? {} : { url }),
site: { url: 'https://old.example.com', title: 'Custom title' }
},
options
)
).toThrow(ConfigError);
}
it('rejects the removed site section even when empty', () => {
expect(() => parseConfig(`${yaml}\nsite: {}`, options)).toThrow(ConfigError);
});
it('defaults the OIDC name after resolving authentication placeholders', () => {
@@ -470,8 +457,6 @@ domains:
it.each([
{ unknown: 'private-value' },
{ site: null },
{ site: [] },
{ url: null },
{ url: [] },
{ version: Infinity },
@@ -541,8 +526,7 @@ domains:
it.each([
`${yaml}\nversion: 1\nversion: 1`,
`${yaml}\n<<: {version: 1}`,
`${yaml}\n---\n${yaml}`,
`${yaml}\nsite: &cycle {title: *cycle}`
`${yaml}\n---\n${yaml}`
])('rejects non-strict YAML', (source) => {
expect(() => parseConfig(source, options)).toThrow(ConfigError);
});
@@ -585,7 +569,7 @@ domains:
let calls = 0;
const getter = {
...configurationInput(),
get site() {
get appearance() {
calls++;
return {};
}
@@ -593,7 +577,7 @@ domains:
expect(() => loadConfig(getter, options)).toThrow(ConfigError);
expect(calls).toBe(0);
const cycle = configurationInput();
Object.assign(cycle, { site: cycle });
Object.assign(cycle, { appearance: cycle });
for (const input of [
cycle,
Object.create(configurationInput()),
-20
View File
@@ -68,7 +68,6 @@ FormatRegistry.Set('goto-instant', (value) => {
});
const nonBlankText = { minLength: 1, pattern: '\\S' };
const imageSegment = '(?!\\.{1,2}(?:/|$))[^/%\\\\?#\\x00-\\x1f\\x7f]+';
const HttpUrlSchema = Type.String({
$id: 'HttpUrl',
@@ -114,13 +113,6 @@ const AuthSecretSchema = Type.String({
minLength: 32
});
const LocalImagePathSchema = Type.String({
$id: 'LocalImagePath',
pattern: `^/public/(?:${imageSegment}/)*${imageSegment}\\.(?:[sS][vV][gG]|[pP][nN][gG]|[jJ][pP][eE]?[gG]|[gG][iI][fF]|[wW][eE][bB][pP])${end}`,
description:
'A decoded /public/ SVG, PNG, JPEG, GIF or WebP image path without dot segments, percent escapes, backslashes, queries or fragments.'
});
const HexColorSchema = Type.String({
$id: 'HexColor',
pattern: `^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})${end}`
@@ -163,15 +155,6 @@ const UrlSchema = Type.Object(
{ $id: 'Url', additionalProperties: false }
);
const SiteSchema = Type.Object(
{
title: Type.String({ ...nonBlankText, default: 'Goto' }),
logo_path: Type.Optional(ref(LocalImagePathSchema)),
favicon_path: Type.Optional(ref(LocalImagePathSchema))
},
{ $id: 'Site', additionalProperties: false }
);
const AppearanceSchema = Type.Object(
{
primary_light_color: ref(HexColorSchema, { default: '#0f766e' }),
@@ -346,7 +329,6 @@ export const GotoConfigurationSchema = Type.Object(
{
version: Type.Literal(1, { default: 1 }),
url: ref(UrlSchema, { default: {} }),
site: ref(SiteSchema, { default: {} }),
appearance: ref(AppearanceSchema, { default: {} }),
auth: ref(AuthSchema),
database: ref(DatabaseSchema, { default: {} }),
@@ -369,13 +351,11 @@ export const configurationReferences: TSchema[] = [
AppUrlSchema,
InstantSchema,
AuthSecretSchema,
LocalImagePathSchema,
HexColorSchema,
TagsSchema,
RedirectStatusSchema,
RedirectResponseSchema,
UrlSchema,
SiteSchema,
AppearanceSchema,
OidcAuthSchema,
CredentialsAuthSchema,