fix: OIDC auth flow, Vite proxy, and PostgreSQL query compat

- Add auth redirect in root layout for unauthenticated users
- Proxy OIDC routes (/login, /callback, /logout) through Vite dev server
- Strip Secure flag from OIDC cookies in dev mode (HTTP localhost)
- Disable retry on auth query to prevent stale cookie loops
- Fix SQLite .get()/.all()/.run() calls in category and global-item
  services for PostgreSQL compatibility
- Add userId scoping to category service functions
- Add OIDC error logging in auth middleware
- Apply linter auto-formatting across affected files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 18:25:31 +02:00
parent f7588827b1
commit 574a12e6fa
32 changed files with 315 additions and 253 deletions

View File

@@ -1,7 +1,8 @@
import { zValidator } from "@hono/zod-validator";
import { getAuth } from "@hono/oidc-auth";
import { zValidator } from "@hono/zod-validator";
import { Hono } from "hono";
import { z } from "zod";
import { updateProfileSchema } from "../../shared/schemas.ts";
import { parseId } from "../lib/params.ts";
import { requireAuth } from "../middleware/auth.ts";
import {
@@ -10,7 +11,6 @@ import {
listApiKeys,
} from "../services/auth.service.ts";
import { updateProfile } from "../services/profile.service.ts";
import { updateProfileSchema } from "../../shared/schemas.ts";
type Env = { Variables: { db?: any; userId?: number } };

View File

@@ -7,7 +7,6 @@ import {
updateSetupSchema,
} from "../../shared/schemas.ts";
import { parseId } from "../lib/params.ts";
import { withImageUrls } from "../services/storage.service.ts";
import { getPublicSetupWithItems } from "../services/profile.service.ts";
import {
createSetup,
@@ -19,6 +18,7 @@ import {
updateItemClassification,
updateSetup,
} from "../services/setup.service.ts";
import { withImageUrls } from "../services/storage.service.ts";
type Env = { Variables: { db?: any; userId?: number } };

View File

@@ -9,10 +9,7 @@ import {
updateThreadSchema,
} from "../../shared/schemas.ts";
import { parseId } from "../lib/params.ts";
import {
deleteImage,
withImageUrls,
} from "../services/storage.service.ts";
import { deleteImage, withImageUrls } from "../services/storage.service.ts";
import {
createCandidate,
createThread,