🐛 fix: restore plugin auth and proxy connection info

This commit is contained in:
2026-08-13 02:32:39 +07:00
parent 3df22125dd
commit 5567ac6594
20 changed files with 141 additions and 65 deletions
+19
View File
@@ -0,0 +1,19 @@
import { prisma } from "@minikura/db";
export async function findApiKeyOwner(apiKey: string) {
if (!apiKey) return null;
const [server, proxy] = await Promise.all([
prisma.server.findUnique({ where: { api_key: apiKey }, select: { id: true } }),
prisma.reverseProxyServer.findUnique({ where: { api_key: apiKey }, select: { id: true } }),
]);
if (server) return { kind: "server" as const, id: server.id };
if (proxy) return { kind: "reverse-proxy" as const, id: proxy.id };
return null;
}
export function bearerToken(header: string | null): string {
if (!header?.startsWith("Bearer ")) return "";
return header.slice(7).trim();
}