Commit Graph

66 Commits

Author SHA1 Message Date
hobokenchicken daf21f67ad style: earthy merged dashboard design 2026-04-23 09:54:33 -04:00
hobokenchicken 5315dca6d7 style: simplify dashboard hero 2026-04-23 09:52:06 -04:00
hobokenchicken 48da1cd571 style: apply earthy site palette 2026-04-23 09:48:59 -04:00
hobokenchicken d37369eca2 feat: remove blockchain landing copy 2026-04-23 09:43:03 -04:00
hobokenchicken 1dafc7d312 feat: rustic dashboard redesign 2026-04-23 09:23:52 -04:00
hobokenchicken bf57169014 fix: sync pending requests from overseer 2026-04-23 09:14:44 -04:00
hobokenchicken e594b450c6 fix: remove dashboard auto-refresh churn 2026-04-22 15:55:17 -04:00
hobokenchicken a8c5ef557d fix: keep refresh only in requests tab 2026-04-22 15:41:20 -04:00
hobokenchicken 65ae7a6924 feat: add dashboard refresh buttons 2026-04-22 15:37:47 -04:00
hobokenchicken fb32a66996 fix: log overseer webhook payload 2026-04-22 14:35:30 -04:00
hobokenchicken 50ca3c2900 fix: reduce dashboard request churn 2026-04-22 14:28:07 -04:00
hobokenchicken 5a8eb90c38 fix: overseer status coercion 2026-04-22 14:11:02 -04:00
hobokenchicken a5dd85f5c1 fix: normalize overseer webhook statuses 2026-04-22 14:10:03 -04:00
hobokenchicken 2a7b4f46b3 fix: poll request status updates 2026-04-22 14:06:41 -04:00
hobokenchicken f108971559 feat: add logout button 2026-04-22 14:04:34 -04:00
hobokenchicken 57b09b1f99 fix: socket reconnect and polling fallback 2026-04-22 14:02:40 -04:00
hobokenchicken 4b8a41d928 fix: persist auth across refresh 2026-04-22 14:00:19 -04:00
hobokenchicken f0b3338f08 fix: live update request status 2026-04-22 13:53:37 -04:00
hobokenchicken de275976ed feat: add dashboard request panels 2026-04-22 13:50:41 -04:00
hobokenchicken 7b07c7d04a feat: restore request flow in dashboard 2026-04-22 13:47:34 -04:00
hobokenchicken b7da2f2298 fix: wallet api auth after solana purge 2026-04-22 13:44:24 -04:00
hobokenchicken f944b1f9b4 chore: final solana purge 2026-04-22 13:37:22 -04:00
hobokenchicken 4bfcbb6b7e chore: remove solana wallet stack 2026-04-22 13:32:14 -04:00
hobokenchicken 8ec91acc25 refactor: db-only credits and admin controls
Remove blockchain dependence from credit flow:
- watch credits now DB-only
- webhook earnings now DB-only
- wallet balance now DB-only
- admin bonus/adjustment routes operate on DB totals

Add admin adjustment API for account control.
Keep Solana service file unused for now; safe to delete later.
2026-04-22 13:05:48 -04:00
hobokenchicken 86a8c7d89a feat(economy): tighten credit earning + deduct on request
Credit economy changes:
- creditsPerMinute: 10 -> 2 (45min episode = 90 COOP vs 450)
- movieRequestCost: 100 -> 500 (~5.5 episodes per movie)
- tvRequestCost: 200 -> 1000 (~11 episodes per season)
- tvPerSeasonCost: 50 -> 250

Race condition fix:
- Credits now deducted immediately at request time
- No more multiple requests before approval
- On DECLINED: automatic refund with ADJUSTMENT transaction
- On APPROVED: no extra deduction (already paid)

Updated schema defaults and all code fallbacks.
2026-04-21 15:50:18 -04:00
hobokenchicken fee4d8ce1b fix(balance): use database credits instead of on-chain balance
Balance checks were reading on-chain Solana token balance (0
during db-only mode). Now wallet and overseer routes return
user.totalEarned - user.totalSpent as the usable credit balance.
This makes credits spendable even when devnet faucet is dry.

- /wallet returns dbBalance, with onChainBalance as extra info
- /overseer/balance returns dbBalance for request eligibility
- /overseer/request checks dbBalance before approving spend
- /wallet/admin returns dbBalance
2026-04-21 15:37:06 -04:00
hobokenchicken 5dbee115ad chore(solana): silence devnet airdrop retry spam
Catch and swallow airdrop errors quietly. Logs were flooded with
429 retry messages. Now fails fast and lets DB-only credits take
over when devnet faucet is dry.
2026-04-21 15:31:19 -04:00
hobokenchicken 31d89f049b fix(solana): graceful fallback to DB-only credits when blockchain unavailable
Devnet airdrop faucet rate-limited. mintTokens() now returns a
db-only signature instead of failing when Solana is unreachable,
unfunded, or mint creation fails. This lets watch events and
backfill still credit users in the database. Blockchain minting
will resume automatically once SOL is available.
2026-04-21 15:25:21 -04:00
hobokenchicken 871c01c79e fix(solana): airdrop SOL to mint authority before creating mint
Mint authority had zero SOL balance on devnet, causing
'Attempt to debit an account but found no record of a prior
credit' error. Now getTokenMint() checks balance, airdrops 2 SOL
if needed, then creates the SPL token mint. Also added caching
so mint is only created once.
2026-04-21 15:18:45 -04:00
hobokenchicken 9b5d477852 fix(solana): auto-create token mint on devnet if not configured
getTokenMint() was a stub returning null. Now checks SOLANA_MINT_ADDRESS
env var first, then auto-creates a new SPL token mint on devnet using
the existing mint authority keypair. This enables actual token minting
for backfill and live watch events.
2026-04-21 15:13:56 -04:00
hobokenchicken a20927913f fix(docker): use host network mode for backend
Backend couldn't reach Tautulli (172.20.1.255) or Overseer
(172.20.1.225) from Docker bridge network. Switched to host
network mode so backend can access local network services.
Updated DATABASE_URL and REDIS_URL to use localhost.
2026-04-21 15:08:36 -04:00
hobokenchicken c38117fbe7 fix(backfill): map Plex username to Tautulli user ID before fetching history
Tautulli get_history requires internal user_id, not Plex ID.
Now queries get_users first, matches by username/email/friendly_name,
then uses matched user's ID for history fetch.
2026-04-21 15:00:28 -04:00
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 5db61212dc feat(theme): barnyard redesign with rustic crypto aesthetic
- New color palette: barn red primary, cream backgrounds, hay gold
- Added Abril Fatface display font for headlines
- Wood grain texture backgrounds via CSS gradients
- Barnyard personality in copy: 'Join the Flock', 'Enter the Coop'
- Replaced hardcoded slate colors with theme variables
- Updated landing, login, dashboard, onboarding, leaderboard
2026-04-21 14:14:48 -04:00
hobokenchicken 185018a42e fix(auth): prevent duplicate plex callback requests
React re-renders caused useEffect to fire twice. First
request succeeded, second consumed already-used PIN → 500.
Added useRef guard to dedupe.
2026-04-21 13:58:11 -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 175c368cfd fix(docker): align backend port with Caddy reverse proxy
Caddy routes /api/* to port 3002 but docker-compose exposed
backend on 3001. Changed backend port, healthcheck, and
frontend fallback to 3002 for consistency.
2026-04-21 13:30:59 -04:00
hobokenchicken 18e9f58c1a fix(docker): fix standalone output path in frontend Dockerfile
Next.js 16 standalone output preserves monorepo subdirectory
structure, placing server.js at frontend/server.js instead of
server.js. Updated COPY paths and CMD to match.
2026-04-21 11:58:10 -04:00
hobokenchicken 3e531580bd fix(auth): remove unused useSearchParams causing build fail
Next.js 16 prerender error on /auth/callback from
useSearchParams without Suspense. Removed unused import
to fix Docker build.
2026-04-21 11:45:33 -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 4fba61f83b UI: Re-theme app with coop-inspired colors 2026-04-18 02:07:03 +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 dabd1d5b18 UI: Update login page branding to CoopCoins 2026-04-18 01:34:11 +00:00
Your Name 4d6e36ec24 Fix: Improve Plex OAuth flow and initialization 2026-04-18 01:32:13 +00:00
Your Name 2c89bf3e18 Feat: Rebrand project to CoopCoins with friendly messaging 2026-04-18 01:20:38 +00:00
Your Name 61bbca2e5d Refactor: Improve error handling in authentication flow 2026-04-17 19:55:35 +00:00
hobokenchicken 7c5da339cb fix: Add root page.tsx to fix 404 on /
- Create app/page.tsx that redirects to /login
- Fixes 404 error when accessing root URL
2026-04-15 14:46:48 -04:00