Add Better Auth worker route

This commit is contained in:
2026-05-09 03:35:00 -04:00
parent 928bb3cfb0
commit 0178940e0f
13 changed files with 556 additions and 4 deletions
+4
View File
@@ -1,5 +1,6 @@
import type { Env } from "./bindings.js";
import { withAuthenticatedApiControls, withPublicApiControls } from "./api_controls.js";
import { handleBetterAuthRoute } from "./better_auth.js";
import {
DevicePermissionError,
DevicePersistenceError,
@@ -42,6 +43,9 @@ export default {
export async function handleRequest(request: Request, env: Env): Promise<Response> {
const url = new URL(request.url);
if (url.pathname === "/api/auth" || url.pathname.startsWith("/api/auth/")) {
return handleBetterAuthRoute(request, env);
}
if (url.pathname === "/api/devices") {
return withAuthenticatedApiControls(request, env, "devices.list", ["GET"], async (context) => {
try {