Nicolas Cantu b21ac2cf64 feat: anythingllm-devtools service, builazoo project, ssh-config example, docs
- Add services/anythingllm-devtools HTTP API (repos + AnythingLLM + RAG)
- Rename gitea-issues to git-issues across smart_ide agents and docs
- Add projects/builazoo, builazoo README, cron fragment, ssh-config.example
- Add ensure-ia-dev-project-link.sh; wrapper delegates smart_ide id
- Bump ia_dev submodule (git-issues rename, project symlinks)
- Align 4nkaiignore templates; update API index and project docs
2026-04-03 19:06:19 +02:00

22 lines
627 B
TypeScript

import type { IncomingMessage, ServerResponse } from "node:http";
export const readExpectedToken = (): string => {
return process.env.ANYTHINGLLM_DEVTOOLS_TOKEN?.trim() ?? "";
};
export const requireBearer = (
req: IncomingMessage,
res: ServerResponse,
expected: string,
): boolean => {
const h = req.headers.authorization ?? "";
const match = /^Bearer\s+(.+)$/i.exec(h);
const got = match?.[1]?.trim() ?? "";
if (got !== expected) {
res.writeHead(401, { "Content-Type": "application/json; charset=utf-8" });
res.end(JSON.stringify({ error: "Unauthorized" }));
return false;
}
return true;
};