From 87dee8e62851cea97f113acda8eac12fd54de6cd Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 14 Nov 2024 14:45:58 +0100 Subject: [PATCH] fix: default value for client-metadata filename --- src/module.ts | 4 ++-- src/runtime/server/lib/oauth/bluesky.ts | 2 +- src/utils/atproto.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/module.ts b/src/module.ts index b67d1ab..797855c 100644 --- a/src/module.ts +++ b/src/module.ts @@ -15,7 +15,7 @@ import { defu } from 'defu' import { randomUUID } from 'uncrypto' import type { ScryptConfig } from '@adonisjs/hash/types' import type { SessionConfig } from 'h3' -import { atProtoProviderDefaultClientMetadata, atprotoProviders } from './utils/atproto' +import { atprotoProviderDefaultClientMetadata, atprotoProviders } from './utils/atproto' import type { AtprotoProviderClientMetadata } from './runtime/types/atproto' // Module options TypeScript interface definition @@ -253,7 +253,7 @@ export default defineNuxtModule({ // Atproto OAuth for (const provider of atprotoProviders) { // @ts-expect-error Not typesafe, but avoids repeating the same code for each provider - runtimeConfig.oauth[provider] = defu(runtimeConfig.oauth[provider], atProtoProviderDefaultClientMetadata) as AtprotoProviderClientMetadata + runtimeConfig.oauth[provider] = defu(runtimeConfig.oauth[provider], atprotoProviderDefaultClientMetadata) as AtprotoProviderClientMetadata } // Keycloak OAuth diff --git a/src/runtime/server/lib/oauth/bluesky.ts b/src/runtime/server/lib/oauth/bluesky.ts index 13b3c11..3b0678c 100644 --- a/src/runtime/server/lib/oauth/bluesky.ts +++ b/src/runtime/server/lib/oauth/bluesky.ts @@ -70,7 +70,7 @@ export function defineOAuthBlueskyEventHandler({ config, onSuccess, onError }: O const clientId = dev // For local development, Bluesky authorization servers allow "http://localhost" as a special value for the client ? `http://localhost?redirect_uri=${encodeURIComponent(redirectURL.toString())}&scope=${encodeURIComponent(scope)}` - : `${baseUrl}/${blueskyRuntimeConfig.clientMetadataFilename}` + : `${baseUrl}/${blueskyRuntimeConfig.clientMetadataFilename || 'bluesky/client-metadata.json'}` const storage = useStorage() const sessionStore = new SessionStore(storage) diff --git a/src/utils/atproto.ts b/src/utils/atproto.ts index ab614a7..3e5b9a5 100644 --- a/src/utils/atproto.ts +++ b/src/utils/atproto.ts @@ -3,7 +3,7 @@ import type { AtprotoProviderClientMetadata } from '../runtime/types/atproto' export const atprotoProviders: readonly OAuthProvider[] = ['bluesky'] as const -export const atProtoProviderDefaultClientMetadata: AtprotoProviderClientMetadata = { +export const atprotoProviderDefaultClientMetadata: AtprotoProviderClientMetadata = { clientMetadataFilename: '', clientName: '', clientUri: '',