Skip to content

Commit c33a8e7

Browse files
committed
refactor: addServerTemplate
1 parent f8034cd commit c33a8e7

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

modules/oauth.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineNuxtModule, useNuxt, addTemplate } from 'nuxt/kit'
1+
import { defineNuxtModule, useNuxt, addServerTemplate } from 'nuxt/kit'
22
import { join } from 'node:path'
33
import { appendFileSync, existsSync, readFileSync } from 'node:fs'
44
import { randomUUID } from 'node:crypto'
@@ -24,14 +24,11 @@ export default defineNuxtModule({
2424
}
2525

2626
// bake it into a virtual file
27-
const template = addTemplate({
28-
filename: 'oauth-config.mjs',
27+
addServerTemplate({
28+
filename: '#oauth/config',
2929
getContents: () => `export const clientUri = ${JSON.stringify(clientUri)};`,
30-
write: true,
3130
})
3231

33-
nuxt.options.alias['#oauth/config'] = template.dst
34-
3532
if (nuxt.options._prepare || process.env.NUXT_SESSION_PASSWORD) {
3633
return
3734
}

server/utils/atproto/oauth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getOAuthLock } from '#server/utils/atproto/lock'
66
import { useOAuthStorage } from '#server/utils/atproto/storage'
77
import { UNSET_NUXT_SESSION_PASSWORD } from '#shared/utils/constants'
88
import { OAuthMetadataSchema } from '#shared/schemas/oauth'
9-
// @ts-ignore: virtual file from oauth module
9+
// @ts-expect-error virtual file from oauth module
1010
import { clientUri } from '#oauth/config'
1111
// TODO: limit scope as features gets added. atproto just allows login so no scary login screen till we have scopes
1212
export const scope = 'atproto'

0 commit comments

Comments
 (0)