diff --git a/.changeset/admin-link-titles.md b/.changeset/admin-link-titles.md new file mode 100644 index 0000000..469fc1e --- /dev/null +++ b/.changeset/admin-link-titles.md @@ -0,0 +1,7 @@ +--- +'@goto/web': patch +'@goto/cli': patch +'@goto/worker': patch +--- + +Show the configured title, when present, in the named link’s Redirect card. diff --git a/.changeset/domain-details-first.md b/.changeset/domain-details-first.md new file mode 100644 index 0000000..302a4ed --- /dev/null +++ b/.changeset/domain-details-first.md @@ -0,0 +1,7 @@ +--- +'@goto/web': patch +'@goto/cli': patch +'@goto/worker': patch +--- + +Show the Details card above the links on the Domain page. diff --git a/.changeset/remove-worker-totals-note.md b/.changeset/remove-worker-totals-note.md new file mode 100644 index 0000000..d788532 --- /dev/null +++ b/.changeset/remove-worker-totals-note.md @@ -0,0 +1,7 @@ +--- +'@goto/web': patch +'@goto/cli': patch +'@goto/worker': patch +--- + +Remove the hourly worker totals note from the Root details card. diff --git a/apps/web/e2e/auth.e2e.ts b/apps/web/e2e/auth.e2e.ts index c00666c..9a3604e 100644 --- a/apps/web/e2e/auth.e2e.ts +++ b/apps/web/e2e/auth.e2e.ts @@ -5,6 +5,7 @@ test.use({ withWorker: true }); const sharedTag = 'Work/100%é'; const tagPath = '/admin/tags/Work%2F100%25%C3%A9'; +const docsTitle = 'New hire handbook'; test('shared credentials protect admin pages and sign-out removes access', async ({ page, @@ -245,10 +246,12 @@ test('shared credentials protect admin pages and sign-out removes access', async await expect(redirectCard.locator('dt')).toHaveText([ 'Domain', 'Path', + 'Title', 'Destination', 'Rules', 'Visits' ]); + await expect(redirectCard.getByText(docsTitle, { exact: true })).toBeVisible(); await expect(settingsCard.locator('dt')).toHaveText([ 'HTTP status', 'Case insensitive', @@ -371,6 +374,7 @@ test('shared credentials protect admin pages and sign-out removes access', async 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(redirectCard.getByText('Title', { exact: true })).toHaveCount(0); await expect(page).toHaveURL( `${appServer.origin}/admin/domains/go.example.org/links/a%252Fb?period=all` ); diff --git a/apps/web/e2e/server.js b/apps/web/e2e/server.js index 393dcbf..37189e6 100644 --- a/apps/web/e2e/server.js +++ b/apps/web/e2e/server.js @@ -36,6 +36,7 @@ const configuration = { '/a/b': { url: 'https://example.org/decoded' }, '/a%2Fb': { url: 'https://example.org/literal-percent' }, '/docs': { + title: 'New hire handbook', url: 'https://example.org/first-domain', redirect: [ { if: { language: 'fr', os: 'linux' }, to: 'https://example.org/french-linux' }, diff --git a/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/+page.svelte b/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/+page.svelte index 3c1c8ed..deef223 100644 --- a/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/+page.svelte +++ b/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/+page.svelte @@ -43,15 +43,6 @@ /> {/if} {/snippet} -
-

Links

- -

Details

@@ -71,6 +62,15 @@
+
+

Links

+ +
diff --git a/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/+page.svelte b/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/+page.svelte index e68ea81..07806a2 100644 --- a/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/+page.svelte +++ b/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/+page.svelte @@ -68,7 +68,6 @@
{data.response.forward_query ? 'Yes' : 'No'}
{/if} -

Worker totals update hourly; pending visits are not yet included.

Fallback

diff --git a/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/[...path]/+page.server.ts b/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/[...path]/+page.server.ts index 0ee3473..9afab55 100644 --- a/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/[...path]/+page.server.ts +++ b/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/[...path]/+page.server.ts @@ -56,6 +56,7 @@ export const load = (async ({ locals, params }) => { return { domain, path, + linkTitle: link.title, lifetimeVisits, response, redirectRules, diff --git a/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/[...path]/+page.svelte b/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/[...path]/+page.svelte index 708cd9f..45729fc 100644 --- a/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/[...path]/+page.svelte +++ b/apps/web/src/routes/(admin)/(auth)/admin/domains/[domain]/links/[...path]/+page.svelte @@ -54,6 +54,10 @@
Path
{data.path}
+ {#if data.linkTitle} +
Title
+
{data.linkTitle}
+ {/if}
Destination
0}> {#if data.redirectRules.length > 0} diff --git a/packages/config/src/resolve.test.ts b/packages/config/src/resolve.test.ts index 62fdbf7..94a771e 100644 --- a/packages/config/src/resolve.test.ts +++ b/packages/config/src/resolve.test.ts @@ -260,7 +260,6 @@ describe('effective domains', () => { links: { '/docs': { url: 'https://example.com/docs', - title: '/docs', tags: [], enabled: true, status_code: 302, diff --git a/packages/config/src/resolve.ts b/packages/config/src/resolve.ts index 3c6c480..e4d8cbc 100644 --- a/packages/config/src/resolve.ts +++ b/packages/config/src/resolve.ts @@ -19,7 +19,7 @@ export function buildRedirectDomainLookup( const host = normalizeHost(key)!; const links: Record = Object.create(null); for (const [path, link] of Object.entries(domain.links)) { - links[path] = buildRedirectLink(path, link, domain, configuration, authoredLinkDefaults); + links[path] = buildRedirectLink(link, domain, configuration, authoredLinkDefaults); } const caseInsensitivePaths = buildCaseInsensitivePathLookup(links); let fallbackSource: SettingSource = 'builtin'; @@ -39,7 +39,6 @@ export function buildRedirectDomainLookup( } function buildRedirectLink( - path: string, link: LinkConfiguration, domain: DomainConfiguration, configuration: GotoConfiguration, @@ -47,7 +46,6 @@ function buildRedirectLink( ): PreparedLink { const prepared: PreparedLink = { ...link, - title: link.title ?? path, status_code: link.status_code ?? domain.link_defaults.status_code ?? diff --git a/packages/config/src/types.ts b/packages/config/src/types.ts index 9c14d11..05fa3a1 100644 --- a/packages/config/src/types.ts +++ b/packages/config/src/types.ts @@ -17,14 +17,8 @@ export type SettingSource = 'builtin' | 'global' | 'domain' | 'link'; export type PreparedLink = Omit< LinkConfiguration, - | 'title' - | 'status_code' - | 'forward_query' - | 'case_insensitive' - | 'ignore_trailing_slash' - | 'forward_path' + 'status_code' | 'forward_query' | 'case_insensitive' | 'ignore_trailing_slash' | 'forward_path' > & { - title: string; status_code: RedirectStatus; forward_query: boolean; case_insensitive: boolean;