mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
add built state and skip auth cookie if not signed in for local calls
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import type { CreateUserPayload } from "auth/AppAuth";
|
import type { CreateUserPayload } from "auth/AppAuth";
|
||||||
import { Event } from "core/events";
|
import { Event } from "core/events";
|
||||||
import { Connection, type LibSqlCredentials, LibsqlConnection } from "data";
|
import { Connection, type LibSqlCredentials, LibsqlConnection } from "data";
|
||||||
|
import type { Hono } from "hono";
|
||||||
import {
|
import {
|
||||||
type InitialModuleConfigs,
|
type InitialModuleConfigs,
|
||||||
ModuleManager,
|
ModuleManager,
|
||||||
@@ -132,7 +133,7 @@ export class App {
|
|||||||
return this.modules.ctx().em;
|
return this.modules.ctx().em;
|
||||||
}
|
}
|
||||||
|
|
||||||
get fetch(): any {
|
get fetch(): Hono["fetch"] {
|
||||||
return this.server.fetch;
|
return this.server.fetch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +156,10 @@ export class App {
|
|||||||
return this.modules.version();
|
return this.modules.version();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isBuilt(): boolean {
|
||||||
|
return this.modules.isBuilt();
|
||||||
|
}
|
||||||
|
|
||||||
registerAdminController(config?: AdminControllerOptions) {
|
registerAdminController(config?: AdminControllerOptions) {
|
||||||
// register admin
|
// register admin
|
||||||
this.adminController = new AdminController(this, config);
|
this.adminController = new AdminController(this, config);
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ export class Authenticator<Strategies extends Record<string, Strategy> = Record<
|
|||||||
}
|
}
|
||||||
|
|
||||||
async requestCookieRefresh(c: Context) {
|
async requestCookieRefresh(c: Context) {
|
||||||
if (this.config.cookie.renew) {
|
if (this.config.cookie.renew && this.isUserLoggedIn()) {
|
||||||
const token = await this.getAuthCookie(c);
|
const token = await this.getAuthCookie(c);
|
||||||
if (token) {
|
if (token) {
|
||||||
await this.setAuthCookie(c, token);
|
await this.setAuthCookie(c, token);
|
||||||
|
|||||||
@@ -171,6 +171,10 @@ export class ModuleManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isBuilt(): boolean {
|
||||||
|
return this._built;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is set through module's setListener
|
* This is set through module's setListener
|
||||||
* It's called everytime a module's config is updated in SchemaObject
|
* It's called everytime a module's config is updated in SchemaObject
|
||||||
|
|||||||
Reference in New Issue
Block a user