fix again
This commit is contained in:
parent
30ab41907d
commit
65e067505b
2 changed files with 7 additions and 9 deletions
|
|
@ -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,8 +174,6 @@ class Daemon {
|
|||
async startWebAuth() {
|
||||
if (!this.config.authPort) return;
|
||||
|
||||
const path = new URL(this.config.baseUrl as string).pathname.replace(/\/+$/, '');
|
||||
|
||||
this.fastify.register(FastifyView, {
|
||||
engine: {
|
||||
handlebars: Handlebars
|
||||
|
|
@ -184,9 +182,9 @@ class Daemon {
|
|||
|
||||
this.fastify.listen({ port: this.config.authPort });
|
||||
|
||||
this.fastify.get(`${path}/requests/:id`, authorizeRequestWebHandler);
|
||||
this.fastify.post(`${path}/requests/:id`, processRequestWebHandler);
|
||||
this.fastify.post(`${path}/register/:id`, processRegistrationWebHandler);
|
||||
this.fastify.get('/requests/:id', authorizeRequestWebHandler);
|
||||
this.fastify.post('/requests/:id', processRequestWebHandler);
|
||||
this.fastify.post('/register/:id', processRegistrationWebHandler);
|
||||
}
|
||||
|
||||
async startKeys() {
|
||||
|
|
@ -204,7 +202,7 @@ class Daemon {
|
|||
}
|
||||
|
||||
const nsec = nip19.nsecEncode(settings.key);
|
||||
await this.loadNsec(keyName, nsec);
|
||||
this.loadNsec(keyName, nsec);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export async function authorizeRequestWebHandler(request, reply) {
|
|||
const record = await getAndValidateStateOfRequest(request);
|
||||
const url = new URL(request.url, `http://${request.headers.host}`);
|
||||
const callbackUrl = url.searchParams.get("callbackUrl");
|
||||
const baseUrl = new URL(request.url).pathname?.split('/')?.[1]?.replace(/\/+$/, '') || '/';
|
||||
const baseUrl = new URL(request.url).pathname?.split('/')?.[1]?.replace(/\/+$/, '');
|
||||
|
||||
const method = record.method;
|
||||
let nip05: string | undefined;
|
||||
|
|
@ -164,7 +164,7 @@ export async function processRegistrationWebHandler(request, reply) {
|
|||
try {
|
||||
const record = await getAndValidateStateOfRequest(request);
|
||||
const body = request.body;
|
||||
const baseUrl = new URL(request.url).pathname?.split('/')?.[1]?.replace(/\/+$/, '') || '/';
|
||||
const baseUrl = new URL(request.url).pathname?.split('/')?.[1]?.replace(/\/+$/, '');
|
||||
|
||||
// we serialize the payload again and store it
|
||||
// along with the allowed flag
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue