- 拆分管理台入口为 App/feature/core 结构并更新样式/配置 - 规范 worker 路由/中间件/服务类型与 JSON 解析 - 同步工具链与知识库记录
13 lines
358 B
TypeScript
13 lines
358 B
TypeScript
import type { Context } from "hono";
|
|
|
|
/**
|
|
* Reads a bearer token from common headers.
|
|
*/
|
|
export function getBearerToken(c: Context): string | null {
|
|
const auth = c.req.header("Authorization");
|
|
if (auth?.toLowerCase().startsWith("bearer ")) {
|
|
return auth.slice(7).trim();
|
|
}
|
|
return c.req.header("x-api-key") ?? c.req.header("x-admin-token") ?? null;
|
|
}
|