feat: add mdtodo v3s microservice
This commit is contained in:
@@ -101,6 +101,13 @@ async function route(req: Request, server: Server<WsData>): Promise<Response | u
|
||||
|
||||
async function providerRoute(req: Request, server: Server<WsData>): Promise<Response | undefined> {
|
||||
const url = new URL(req.url);
|
||||
if (url.pathname === "/" || url.pathname === "/health") {
|
||||
return jsonResponse({
|
||||
ok: true,
|
||||
service: "unidesk-provider-ingress",
|
||||
activeSocketCount: ctx.activeProviders.size,
|
||||
});
|
||||
}
|
||||
if (url.pathname === "/ws/provider") {
|
||||
const token = url.searchParams.get("token") ?? req.headers.get("x-provider-token");
|
||||
if (token !== config().providerToken) return jsonResponse({ ok: false, error: "invalid provider token" }, 401);
|
||||
|
||||
Reference in New Issue
Block a user