From 24d73cb730c5b320fc7ada9db5c6d672fecb42df Mon Sep 17 00:00:00 2001 From: Admin Date: Fri, 3 Apr 2026 20:37:10 +0500 Subject: [PATCH] fix: add device_fingerprint to PB schema + fix homelab Redis routing OAuth login was silently failing: upsertUserSession() queried the device_fingerprint column which didn't exist in the user_sessions collection, PocketBase returned 400, the fallback authSessionId was never written to the DB, and isSessionRevoked() immediately revoked the cookie on first load after the OAuth redirect. - scripts/pb-init-v3.sh: add device_fingerprint text field to the user_sessions create block (new installs) and add an idempotent add_field migration line (existing installs) Audio jobs were stuck pending because the homelab runner was connecting to its own local Redis instead of the prod VPS Redis. - homelab/docker-compose.yml: change hardcoded REDIS_ADDR=redis:6379 to ${REDIS_ADDR} so Doppler injects rediss://redis.libnovel.cc:6380 (the Caddy TLS proxy that bridges the homelab runner to prod Redis) --- homelab/docker-compose.yml | 2 +- scripts/pb-init-v3.sh | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/homelab/docker-compose.yml b/homelab/docker-compose.yml index f8347dc..45fa4eb 100644 --- a/homelab/docker-compose.yml +++ b/homelab/docker-compose.yml @@ -63,7 +63,7 @@ services: LIBRETRANSLATE_API_KEY: "${LIBRETRANSLATE_API_KEY}" # ── Asynq / Redis ───────────────────────────────────────────────────── - REDIS_ADDR: "redis:6379" + REDIS_ADDR: "${REDIS_ADDR}" REDIS_PASSWORD: "${REDIS_PASSWORD}" KOKORO_URL: "http://kokoro-fastapi:8880" diff --git a/scripts/pb-init-v3.sh b/scripts/pb-init-v3.sh index 81d0b46..eb9f62f 100755 --- a/scripts/pb-init-v3.sh +++ b/scripts/pb-init-v3.sh @@ -190,14 +190,15 @@ create "app_users" '{ {"name":"oauth_id", "type":"text"} ]}' -create "user_sessions" '{ + create "user_sessions" '{ "name":"user_sessions","type":"base","fields":[ - {"name":"user_id", "type":"text","required":true}, - {"name":"session_id","type":"text","required":true}, - {"name":"user_agent","type":"text"}, - {"name":"ip", "type":"text"}, - {"name":"created_at","type":"text"}, - {"name":"last_seen", "type":"text"} + {"name":"user_id", "type":"text","required":true}, + {"name":"session_id", "type":"text","required":true}, + {"name":"user_agent", "type":"text"}, + {"name":"ip", "type":"text"}, + {"name":"device_fingerprint", "type":"text"}, + {"name":"created_at", "type":"text"}, + {"name":"last_seen", "type":"text"} ]}' create "user_library" '{ @@ -291,5 +292,6 @@ add_field "app_users" "oauth_id" "text" add_field "app_users" "polar_customer_id" "text" add_field "app_users" "polar_subscription_id" "text" add_field "user_library" "shelf" "text" +add_field "user_sessions" "device_fingerprint" "text" log "done"