diff --git a/package-lock.json b/package-lock.json index 14d3d88..fa621b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@startup-api/cloudflare", - "version": "0.4.3", + "version": "0.4.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@startup-api/cloudflare", - "version": "0.4.3", + "version": "0.4.4", "license": "Apache-2.0", "dependencies": { "he": "^1.2.0", diff --git a/package.json b/package.json index 91d1d15..b7090ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@startup-api/cloudflare", - "version": "0.4.3", + "version": "0.4.4", "license": "Apache-2.0", "publishConfig": { "access": "public" diff --git a/public/users/profile.html b/public/users/profile.html index 972f473..10832ab 100644 --- a/public/users/profile.html +++ b/public/users/profile.html @@ -451,7 +451,8 @@

Link another account

} function credentialIdentifier(c) { if (c.provider === 'atproto') { - return c.handle ? `${c.handle} (${c.subject_id})` : c.subject_id; + if (!c.handle) return c.subject_id; + return `@${c.handle} (${c.subject_id})`; } return c.email || c.subject_id; } diff --git a/src/handlers/ssr.ts b/src/handlers/ssr.ts index 6c6b7c1..3b76a7e 100644 --- a/src/handlers/ssr.ts +++ b/src/handlers/ssr.ts @@ -214,10 +214,14 @@ function providerLabel(provider: string): string { return provider.charAt(0).toUpperCase() + provider.slice(1); } -/** The identifier shown under the provider name. atproto shows the handle with the DID in parens. */ +/** + * The identifier shown under the provider name. atproto emphasizes the handle (larger, with an `@`) + * and de-emphasizes the DID in parentheses. + */ function credentialIdentifier(c: any): string { if (c.provider === 'atproto') { - return c.handle ? `${c.handle} (${c.subject_id})` : c.subject_id; + if (!c.handle) return c.subject_id; + return `@${c.handle} (${c.subject_id})`; } return c.email || c.subject_id; } diff --git a/test/integration.spec.ts b/test/integration.spec.ts index 905312e..a7ab6b9 100644 --- a/test/integration.spec.ts +++ b/test/integration.spec.ts @@ -344,9 +344,10 @@ describe('Integration Tests', () => { expect(html).toContain('twitch@example.com'); expect(html).toContain('providers="google,twitch,patreon"'); expect(html).not.toContain('{{ssr:profile_name}}'); - // atproto credential: branded label + "handle (did)" identifier, not the bare provider key. + // atproto credential: branded label + "@handle (did)" identifier, not the bare provider key. expect(html).toContain('Atmosphere / ATproto'); - expect(html).toContain('tester.bsky.social (did:plc:abc123)'); + expect(html).toContain('@tester.bsky.social'); + expect(html).toContain('(did:plc:abc123)'); // The old Bluesky butterfly mark must not appear anywhere on the rendered page (SSR or client script). expect(html).not.toContain('M12 10.5C10.9'); });