mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
Refactor asset handling and authentication logic (for node)
Updated asset path configuration and server-side logic to standardize asset serving. Introduced `shouldSkipAuth` to bypass authentication for asset requests. Added test coverage for the new asset path handling logic.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { IncomingMessage } from "node:http";
|
||||
import { App, type CreateAppConfig, registries } from "bknd";
|
||||
import { config as $config } from "core";
|
||||
import type { MiddlewareHandler } from "hono";
|
||||
import { StorageLocalAdapter } from "media/storage/adapters/StorageLocalAdapter";
|
||||
import type { AdminControllerOptions } from "modules/server/AdminController";
|
||||
@@ -106,12 +107,10 @@ export async function createRuntimeApp<Env = any>(
|
||||
App.Events.AppBuiltEvent,
|
||||
async () => {
|
||||
if (serveStatic) {
|
||||
if (Array.isArray(serveStatic)) {
|
||||
const [path, handler] = serveStatic;
|
||||
app.modules.server.get(path, handler);
|
||||
} else {
|
||||
app.modules.server.get("/*", serveStatic);
|
||||
}
|
||||
const [path, handler] = Array.isArray(serveStatic)
|
||||
? serveStatic
|
||||
: [$config.server.assets_path + "*", serveStatic];
|
||||
app.modules.server.get(path, handler);
|
||||
}
|
||||
|
||||
await config.onBuilt?.(app);
|
||||
|
||||
Reference in New Issue
Block a user