Compare commits

..

4 commits

Author SHA1 Message Date
97101cfcc3 debug
Some checks failed
Docker Image CI / docker-build (push) Has been cancelled
2025-06-29 13:49:09 +02:00
101efa2605 debug 2025-06-29 13:43:10 +02:00
6986ab1ec5 Debug 2025-06-29 13:38:31 +02:00
89825059a8 Add debug env 2025-06-29 13:05:48 +02:00

View file

@ -28,22 +28,6 @@ const oidcClaimsHook = async (orig: OidcAuth | undefined, claims: IDToken | unde
};
};
app.get("/auth/callback", async (c: Context) => {
c.set("oidcClaimsHook", oidcClaimsHook);
return processOAuthCallback(c);
});
app.use(logger(), compress());
app.use("/", serveStatic({ root: "./public" }));
app.use("/auth/*", oidcAuthMiddleware());
app.use("/auth/*", async (c, next) => {
const auth = await getAuth(c);
if (!auth) {
return c.json({ status: 401, message: "Unauthorized" }, 401);
}
await next();
});
app.get("/auth/logout", async (c) => {
const auth = await getAuth(c);
if (!auth) {
@ -53,6 +37,15 @@ app.get("/auth/logout", async (c) => {
return c.json({ status: 200, message: "OK" });
});
app.get("/auth/callback", async (c: Context) => {
c.set("oidcClaimsHook", oidcClaimsHook);
return processOAuthCallback(c);
});
app.use(logger(), compress());
app.use("/", serveStatic({ root: "./public" }));
app.use("/auth/*", oidcAuthMiddleware());
app.get("/auth/login", async (c) => {
const auth = await getAuth(c);
return c.json({ status: 200, message: "OK", data: auth });
@ -100,6 +93,12 @@ app.get("/stats", async (c) => {
});
app.onError((err, c) => {
const isDev = Deno.env.get("NODE_ENV") === "development";
if (isDev) {
console.error(err);
console.log(Deno.env.toObject());
return c.json({ status: 500, message: "Server Error", error: err.message }, 500);
}
return c.json({ status: 500, message: "Server Error" }, 500);
});