pass url prefix to handlebar

This commit is contained in:
reya
2024-01-23 14:31:49 +07:00
parent f3b8aa8ebb
commit bc28858146
3 changed files with 7 additions and 5 deletions

View File

@@ -174,13 +174,15 @@ class Daemon {
async startWebAuth() {
if (!this.config.authPort) return;
const prefix = new URL(this.config.baseUrl as string).pathname.replace(/\/+$/, '');
const urlPrefix = new URL(this.config.baseUrl as string).pathname.replace(/\/+$/, '');
this.fastify.register(FastifyView, {
engine: {
handlebars: Handlebars
handlebars: Handlebars,
},
prefix
defaultContext: {
urlPrefix
}
});
this.fastify.listen({ port: this.config.authPort });

View File

@@ -87,7 +87,7 @@
</h1>
</div>
<form
action="/register/{{record.id}}"
action="{{urlPrefix}}/register/{{record.id}}"
method="POST"
class="w-full flex flex-col gap-5">
{{#if error}}

View File

@@ -52,7 +52,7 @@
</h1>
</div>
<form
action="/login"
action="{{urlPrefix}}/login"
method="POST"
class="w-full flex flex-col gap-5">