Commit Graph

16 Commits

Author SHA1 Message Date
hobokenchicken 946b81384c fix(crypto): SHA-256 hash ENCRYPTION_KEY for AES-256-GCM
ENCRYPTION_KEY was 64 hex chars = 64 bytes. AES-256 needs exactly
32 bytes. Now hashing with SHA-256 to derive proper 32-byte key
regardless of input length. Fixed in auth.ts backfill encrypt
and wallet.ts encrypt/decrypt.
2026-04-21 14:53:55 -04:00
hobokenchicken 338e2a1fc1 feat(auth): backfill 30 days watch history on signup
New users automatically get credited for their last 30 days of
Plex watch history via Tautulli. Creates wallet if needed,
fetches history, calculates credits with same rules as live
webhooks, mints tokens, and creates watchEvent + transaction
records. Only runs on first-time signup.
2026-04-21 14:40:36 -04:00
hobokenchicken 2215eb900b fix(backend): session dedupe + mint authority JSON array parsing
1. Auth callback now deletes old sessions before creating new one,
   and adds Date.now() nonce to JWT to prevent unique constraint
   violations on duplicate login attempts.

2. Solana mint authority now accepts both JSON array and base58
   formats for SOLANA_MINT_AUTHORITY_KEYPAIR env var.
2026-04-21 14:26:21 -04:00
hobokenchicken f191ad4e4c fix(auth): coerce Plex ID to string for Prisma
Plex API returns user.id as integer but Prisma schema expects
String for plexId. Wrapped with String() to fix login 500.
2026-04-21 13:53:32 -04:00
hobokenchicken 5751e08eb1 fix(auth): use Plex PIN flow instead of OAuth2 code exchange
Plex auth uses PIN-based flow, not standard OAuth2 authorization_code.

- backend/auth: POST /api/v2/pins to create PIN, GET /api/v2/pins/{id} to get authToken
- frontend/login: store pinId in sessionStorage before redirect
- frontend/callback: send pinId to backend instead of query code
- backend/index: fix dotenv path resolution for tsx (__dirname returns '.')
2026-04-21 09:27:00 -04:00
Your Name 7e68f57d69 Fix: support coop FQDN for dashboard access 2026-04-18 02:10:06 +00:00
Your Name 425fb007f3 Fix: Update CORS and network config for dev IP access 2026-04-18 01:45:27 +00:00
Your Name 4d6e36ec24 Fix: Improve Plex OAuth flow and initialization 2026-04-18 01:32:13 +00:00
Your Name 61bbca2e5d Refactor: Improve error handling in authentication flow 2026-04-17 19:55:35 +00:00
hobokenchicken 2388873e7a fix: Docker build and runtime fixes
- Fix duplicate 'signature' variable in webhooks.ts
- Add Prisma binary target for Alpine Linux
- Fix tsconfig path alias (@/* -> ./src/*)
- Add missing next-themes dependency
- Add build args for NEXT_PUBLIC_* env vars
- Fix SSR issues with zustand and providers
- Add providers-wrapper with dynamic ssr:false import
- Add SSL certs and public dir for nginx
- Update Dockerfiles for proper Prisma engine handling
2026-04-15 14:16:27 -04:00
hobokenchicken a1572d327f fix: relax tsconfig and add @types/bs58 for build
- Set strict: false and disable strict type checking options
- Add @types/bs58 dev dependency
- Fixes TypeScript compilation errors in Docker build
2026-04-14 15:58:08 -04:00
hobokenchicken 895e74c657 fix: add @unique to Transaction.requestId for one-to-one relation
Prisma requires unique fields on the defining side of one-to-one relations.
Fixes P1012 validation error during prisma generate.
2026-04-14 15:55:04 -04:00
hobokenchicken d2e20ad82a fix: docker build - use root context for monorepo workspaces
- Change build context from ./frontend|backend to root (.)
- Update Dockerfiles to copy from correct paths
- Use npm install instead of npm ci (workspaces share root lockfile)
- Remove obsolete version attribute from docker-compose.yml

Fixes npm ci errors when package-lock.json is at workspace root.
2026-04-14 15:45:27 -04:00
hobokenchicken 2e8260bc8c security: upgrade dependencies to fix critical and high vulnerabilities
- next: 14.2.15 → 15.2.5 (fixes critical DoS, SSRF, cache poisoning)
- react/react-dom: 18.2.0 → 19.1.0
- @solana/spl-token: 0.3.9 → 0.4.14 (bigint-buffer overflow fix)
- vitest: 1.1.0 → 3.0.0 (esbuild dev server exposure fix)
- mocha: 9.0.3 → 11.7.5 (serialize-javascript RCE fix)
- @solana/wallet-adapter-*: latest versions
- Add npm overrides for elliptic, lodash, esbuild, nanoid

Vulnerabilities: 44 (1 critical) → 23 (3 high, 20 low)

Refs: npm audit fixes for GHSA-7m27-7ghc-44w9, GHSA-3gc7-fjrx-p6mg
2026-04-14 14:15:48 -04:00
hobokenchicken 2e41156046 chore: add .env.example template files
Add environment variable templates for:
- Root .env.example (all services)
- backend/.env.example (API configuration)
- frontend/.env.local.example (client config)

Copy to .env and fill in your secrets before running.
2026-04-14 11:14:37 -04:00
hobokenchicken e8d9b1fd42 feat: add CoopCredits Solana media rewards ecosystem
Add complete  token system with Plex/Tautulli/Overseer integration:
- Anchor program for SPL token mint/burn/transfer
- Express backend with OAuth, webhooks, Solana integration
- Next.js frontend with dashboard, admin panel, wallet management
- Docker deployment for 172.20.1.0/24 infrastructure
- Production configs with SSL, Nginx, health monitoring

Tautulli webhooks auto-mint  on watch events.
Overseer integration burns  for content requests.
2026-04-14 11:09:50 -04:00