your personal website on atproto - mirror blento.app

Merge pull request #141 from flo-bit/custom-domains-editing

change oauth client metadata

authored by Florian and committed by GitHub 103a262e 8be48c8b

+12 -1
+12 -1
src/routes/(auth)/oauth-client-metadata.json/+server.ts
··· 1 1 import { metadata } from '$lib/atproto'; 2 2 import { json } from '@sveltejs/kit'; 3 3 4 - export async function GET() { 4 + export async function GET({ request }) { 5 + const customDomain = request.headers.get('X-Custom-Domain')?.toLowerCase(); 6 + 7 + if (customDomain) { 8 + const changedMetadata = metadata; 9 + changedMetadata.redirect_uris = changedMetadata.redirect_uris.map((s) => 10 + s.replace('blento.app', customDomain) 11 + ); 12 + changedMetadata.client_id = changedMetadata.client_id.replace('blento.app', customDomain); 13 + return json(changedMetadata); 14 + } 15 + 5 16 return json(metadata); 6 17 }