Skip to content

Commit

Permalink
fix: default value for client-metadata filename
Browse files Browse the repository at this point in the history
  • Loading branch information
noook committed Nov 18, 2024
1 parent 1c1fcaf commit 87dee8e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -253,7 +253,7 @@ export default defineNuxtModule<ModuleOptions>({
// 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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/server/lib/oauth/bluesky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/atproto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand Down

0 comments on commit 87dee8e

Please sign in to comment.