diff --git a/src/daemon/run.ts b/src/daemon/run.ts index 19f3e65..ea672f1 100644 --- a/src/daemon/run.ts +++ b/src/daemon/run.ts @@ -1,4 +1,4 @@ -import NDK, { NDKEvent, NDKNip46Backend, NDKPrivateKeySigner, Nip46PermitCallback, Nip46PermitCallbackParams, NostrEvent } from '@nostr-dev-kit/ndk'; +import NDK, { NDKPrivateKeySigner, Nip46PermitCallback, Nip46PermitCallbackParams } from '@nostr-dev-kit/ndk'; import { nip19 } from 'nostr-tools'; import { Backend } from './backend/index.js'; import { @@ -174,9 +174,14 @@ class Daemon { async startWebAuth() { if (!this.config.authPort) return; + const urlPrefix = new URL(this.config.baseUrl as string).pathname.replace(/\/+$/, ''); + this.fastify.register(FastifyView, { engine: { - handlebars: Handlebars + handlebars: Handlebars, + }, + defaultContext: { + urlPrefix } }); @@ -202,7 +207,7 @@ class Daemon { } const nsec = nip19.nsecEncode(settings.key); - await this.loadNsec(keyName, nsec); + this.loadNsec(keyName, nsec); } } diff --git a/templates/authorizeRequest.handlebar b/templates/authorizeRequest.handlebar index 1b2f40e..dcff0ea 100644 --- a/templates/authorizeRequest.handlebar +++ b/templates/authorizeRequest.handlebar @@ -1,131 +1,110 @@ - + + - - Document + Authorize Request - - - - + - - - - -
-

- + + +
+
+

+ Do you want to allow this client to use account +
+ {{record.keyName}}?

-
-
-

Do you want to allow this client to use account -
- {{record.keyName}}?

-