mirror of
https://github.com/kind-0/nsecbunkerd.git
synced 2025-03-17 13:22:54 +01:00
fix
This commit is contained in:
parent
7ee7e0cfff
commit
30ab41907d
@ -174,6 +174,8 @@ 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
|
||||
@ -182,9 +184,9 @@ class Daemon {
|
||||
|
||||
this.fastify.listen({ port: this.config.authPort });
|
||||
|
||||
this.fastify.get('/requests/:id', authorizeRequestWebHandler);
|
||||
this.fastify.post('/requests/:id', processRequestWebHandler);
|
||||
this.fastify.post('/register/:id', processRegistrationWebHandler);
|
||||
this.fastify.get(`${path}/requests/:id`, authorizeRequestWebHandler);
|
||||
this.fastify.post(`${path}/requests/:id`, processRequestWebHandler);
|
||||
this.fastify.post(`${path}/register/:id`, processRegistrationWebHandler);
|
||||
}
|
||||
|
||||
async startKeys() {
|
||||
|
@ -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] || '/';
|
||||
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] || '/';
|
||||
const baseUrl = new URL(request.url).pathname?.split('/')?.[1]?.replace(/\/+$/, '') || '/';
|
||||
|
||||
// we serialize the payload again and store it
|
||||
// along with the allowed flag
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta name="robots" content="noindex">
|
||||
<meta charset="UTF-8">
|
||||
<title>Authorize Request - Nostr</title>
|
||||
<title>Authorize Request</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<script src="https://cdn.tailwindcss.com?plugins=forms"></script>
|
||||
<script>
|
||||
|
@ -87,7 +87,7 @@
|
||||
</h1>
|
||||
</div>
|
||||
<form
|
||||
action="{{baseUrl}}register/{{record.id}}"
|
||||
action="{{baseUrl}}/register/{{record.id}}"
|
||||
method="POST"
|
||||
class="w-full flex flex-col gap-5">
|
||||
{{#if error}}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Login Error - Nostr</title>
|
||||
<title>Error</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<script src="https://cdn.tailwindcss.com?plugins=forms"></script>
|
||||
<script>
|
||||
|
@ -52,7 +52,7 @@
|
||||
</h1>
|
||||
</div>
|
||||
<form
|
||||
action="{{baseUrl}}login"
|
||||
action="{{baseUrl}}/login"
|
||||
method="POST"
|
||||
class="w-full flex flex-col gap-5">
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta name="robots" content="noindex">
|
||||
<meta charset="UTF-8">
|
||||
<title>Redirect - Nostr</title>
|
||||
<title>Redirect</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<script src="https://cdn.tailwindcss.com?plugins=forms"></script>
|
||||
<script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user