From 25e7267105c86e42d3cc70d099bc8f548246072f Mon Sep 17 00:00:00 2001 From: lmjabreu Date: Sat, 17 Oct 2026 17:15:07 +0100 Subject: [PATCH 1/3] fix: show the current icon on the auth result pages The success and failure pages had their own inline copy of the old artwork. They now load LOGO_URI, the PNG the consent screen shows. Co-Authored-By: Claude Opus 5.5 --- src/lib/auth-constants.ts | 8 ++ src/lib/auth-pages.test.ts | 14 ++++ src/lib/auth-pages.ts | 166 ++----------------------------------- src/lib/auth-provider.ts | 4 +- 4 files changed, 31 insertions(+), 161 deletions(-) create mode 100644 src/lib/auth-pages.test.ts diff --git a/src/lib/auth-constants.ts b/src/lib/auth-constants.ts index d8dc09a..b3a824b 100644 --- a/src/lib/auth-constants.ts +++ b/src/lib/auth-constants.ts @@ -1,2 +1,10 @@ /** OS keyring `service` identifier for every comms-cli secret. */ export const SECURE_STORE_SERVICE = 'comms-cli' + +/** + * Icon sent as `logo_uri` when registering an OAuth client, and shown on the + * local auth result pages. Todoist keeps the URL each client registered with, + * so never rename or delete the file behind it (see docs/icon.md). + */ +export const LOGO_URI = + 'https://raw.githubusercontent.com/doist/comms-cli/main/icons/comms-cli_512px.png' diff --git a/src/lib/auth-pages.test.ts b/src/lib/auth-pages.test.ts new file mode 100644 index 0000000..9266cad --- /dev/null +++ b/src/lib/auth-pages.test.ts @@ -0,0 +1,14 @@ +import { describe, expect, it } from 'vitest' + +import { LOGO_URI } from './auth-constants.js' +import { renderError, renderSuccess } from './auth-pages.js' + +describe('auth pages', () => { + it.each([ + ['success', renderSuccess()], + ['error', renderError('boom')], + ])('the %s page shows the published icon rather than an inline copy', (_, html) => { + expect(html).toContain(` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -` +import { LOGO_URI } from './auth-constants.js' + +// The same PNG the OAuth consent screen shows, so the icon lives in one file. +const COMMS_CLI_ICON = `` export function renderSuccess(): string { return ` @@ -229,6 +77,7 @@ export function renderSuccess(): string { position: relative; isolation: isolate; } + .logo-wrap img, .logo-wrap svg { width: 100%; height: 100%; @@ -390,7 +239,7 @@ export function renderSuccess(): string {
- ${COMMS_CLI_ICON_SVG} + ${COMMS_CLI_ICON}
@@ -513,6 +362,7 @@ export function renderError(errorMessage: string): string { position: relative; isolation: isolate; } + .logo img, .logo svg { width: 100%; height: 100%; @@ -562,7 +412,7 @@ export function renderError(errorMessage: string): string {