Commit Graph

43 Commits

Author SHA1 Message Date
hobokenchicken 2134537523 feat: wire up listenarr and abs routes in index.ts 2026-07-01 08:42:01 -04:00
hobokenchicken 82e1f1b010 fix: handle isbn as array from Listenarr search results 2026-07-01 08:21:48 -04:00
hobokenchicken d5adc2f985 fix: 3 HIGH + 4 MEDIUM + 4 LOW bugs, env vars, security hardening
HIGH: garbled env vars in 5 files fixed (auth, admin, webhooks, tautulli)
HIGH: double /api prefix in frontend API client fixed
HIGH: committed Solana keypair removed from repo
MEDIUM: JWT_SECRET hardcoded fallback removed (now fails fast)
MEDIUM: admin settings update now validates numeric inputs
MEDIUM: wallet dead code removed from frontend API client
MEDIUM: backfill no longer blocks login (fire-and-forget)
LOW: vanity-keypair-coop.json added to .gitignore
LOW: SystemSettings.id default fixed (cuid -> 'default')
LOW: overseerClient in admin.ts made lazy-initialized
LOW: .env already in .gitignore (verified)
2026-04-30 14:41:48 -04:00
hobokenchicken d72cc63c7a feat: add Plivo SMS admin panel with rate limits 2026-04-23 15:22:00 -04:00
hobokenchicken 8b31045dcf feat: admin requests tab + 30s disk cache + sync all pending 2026-04-23 13:58:31 -04:00
hobokenchicken 70a1925c95 feat: add Ko-fi donations tab to admin dashboard 2026-04-23 13:29:15 -04:00
hobokenchicken 9f76a3c9dd fix: increase rate limit to 1000/15min, add WatchHistory error handling 2026-04-23 12:56:47 -04:00
hobokenchicken 2d897e45ed feat: dynamic pricing by disk space + episode count, total requests stat, disk bar graph 2026-04-23 12:36:50 -04:00
hobokenchicken 515dba07ac fix: explicitly encode overseer search query 2026-04-23 12:12:52 -04:00
hobokenchicken 3dcece5c67 feat: ko-fi integration for credit purchases 2026-04-23 11:59:05 -04:00
hobokenchicken 4a68cc85f3 fix: tautulli backfill use individual sessions, client-side date filter, actual watch time 2026-04-23 11:42:01 -04:00
hobokenchicken 3b9d709589 fix: use duration field, guard null started/stopped, cap 10h 2026-04-23 11:24:26 -04:00
hobokenchicken 29f3201fc5 fix: tautulli get_history use after=unix_ts not start_date 2026-04-23 11:08:08 -04:00
hobokenchicken 137bf19a02 fix: manual bigint casting in admin analytics 2026-04-23 10:55:31 -04:00
hobokenchicken 46984adda4 feat: manual backfill for admin 2026-04-23 10:36:34 -04:00
hobokenchicken ddeacb2543 fix: add requests to admin analytics 2026-04-23 10:21:58 -04:00
hobokenchicken 9be0b46e2f fix: global bigint serialization 2026-04-23 10:17:46 -04:00
hobokenchicken bf57169014 fix: sync pending requests from overseer 2026-04-23 09:14:44 -04:00
hobokenchicken fb32a66996 fix: log overseer webhook payload 2026-04-22 14:35:30 -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 f0b3338f08 fix: live update request status 2026-04-22 13:53:37 -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 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 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 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