1eddb9173e
feat: add condition to only delete manually added stocks from DB docs: clarify stock notes saving method and Alpaca mode indicator fetching chore: update binary database file
9 lines
357 B
TypeScript
9 lines
357 B
TypeScript
export async function requireAdmin(request: Request) {
|
|
// If ADMIN_TOKEN is not set, allow access (dev mode)
|
|
if (!process.env.ADMIN_TOKEN) return;
|
|
// Otherwise check the x-admin-token header
|
|
const token = request.headers.get('x-admin-token');
|
|
if (token === process.env.ADMIN_TOKEN) return;
|
|
throw new Response('Unauthorized', { status: 401 });
|
|
}
|