Commit graph

45 commits

Author SHA1 Message Date
b52d6b1a6f Queue concurrent uploads instead of rejecting with 503
Server: replace hard 503 rejection with a bounded queue (50 slots,
2min timeout) so requests wait for a processing slot instead of failing.

Client: upload files sequentially instead of via Promise.all, and
retry with exponential backoff on 503/504 responses.
2026-02-19 13:55:38 -07:00
4cbc3163de Fix ts errors 2026-02-03 09:13:00 -07:00
a00cc7e3aa Update docker file 2026-02-03 09:09:28 -07:00
c162c4bdde Implement host proof 2026-02-03 09:05:05 -07:00
b7126b0d07 Circuit breaker 2026-02-03 08:35:10 -07:00
70df689701 Sandboxing 2026-02-03 08:24:48 -07:00
cd04d34b23 Security audit #1 2026-02-03 06:59:07 -07:00
f7899f5df6
Fix db 2026-01-23 15:41:18 -07:00
f65aed9e34
Adjust prompt 2026-01-23 15:30:08 -07:00
b85970e168
Fix ppt 2026-01-23 15:23:54 -07:00
255497837b
Fix stuff 2026-01-23 15:04:49 -07:00
e301d9d1eb
Fix ppt 2026-01-23 14:57:49 -07:00
fa2ac3bdfd
Add ppt deps 2026-01-23 14:54:44 -07:00
cac058b643
Add more types 2026-01-23 14:24:06 -07:00
acfed861ab
Flesh out payment stuff 2026-01-22 12:21:12 -07:00
22b36f1259
Fix fk 2026-01-22 08:08:50 -07:00
c36095ffc5
Remove stripe index creation 2026-01-22 07:56:33 -07:00
15b76f330b
Remove decryption and api key storage 2026-01-22 07:32:11 -07:00
2e12edc249
Add Stripe payment integration for AI subscriptions
Implement subscription-based AI access with 250 generations/month at $5/month or $50/year.

Changes:
- Backend: Stripe service, payment routes, webhook handlers, generation tracking
- Frontend: Upgrade page with pricing, payment success/cancel pages, UI prompts
- Database: Add subscription fields to users, payments table, migrations
- Config: Stripe env vars to .env.example, docker-compose.prod.yml, PRODUCTION.md
- Tests: Payment route tests, component tests, subscription hook tests

Users without AI access see upgrade prompts; subscribers see remaining generation count.
2026-01-21 16:11:03 -07:00
1d234d6c0e
Make gemini compatible 2026-01-19 15:02:28 -07:00
b80254418b
Add more file formats 2026-01-19 15:00:25 -07:00
7a83557dc9
Add user name to share screen 2026-01-16 10:55:55 -07:00
1bfe7e3437
Fix blueprints 2026-01-16 09:10:19 -07:00
8a11275849
Add sharing 2026-01-16 08:49:21 -07:00
bfcc33cc50
Change pins to alphanumeric 2026-01-15 21:01:04 -07:00
1a7cd3e723
Add tests 2026-01-15 19:52:05 -07:00
a7ad1e9bba
System AI 2026-01-15 19:39:38 -07:00
4688a73559
Add api key and sorting on scoreboard 2026-01-15 14:49:10 -07:00
36b686bbd4
Add openrouter 2026-01-15 12:28:51 -07:00
e480ad06df
Add server security hardening and draft quiz persistence
Security:
- Add AES-256-GCM encryption for user PII (email, API keys, config)
- Add rate limiting (helmet + express-rate-limit)
- Require auth for file uploads

UX:
- Persist draft quizzes to sessionStorage (survives refresh)
- Add URL-based edit routes (/edit/draft, /edit/:quizId)
- Fix QuizEditor async defaultConfig race condition
- Fix URL param accumulation in Landing
2026-01-15 10:12:05 -07:00
3d6081823c
Fix UI jank a bit 2026-01-14 21:47:40 -07:00
73c7d3efed
Add gemini key ability 2026-01-14 21:04:58 -07:00
9363f643f0
Add cors stuff 2026-01-14 19:44:13 -07:00
035ea57274
Fix host reconnection losing player state and first-answer bonus
- Persist firstCorrectPlayerId to backend during state sync
- Restore full players array (not just host) on host reconnect
- Add default values to WELCOME payload for new/unmatched players
- Add migration for first_correct_player_id column in game_sessions
2026-01-14 10:04:51 -07:00
32696ad33d
Fix stuff 2026-01-14 09:07:20 -07:00
af21f2bcdc
feat: add comprehensive game configuration system
Add a centralized game configuration system that allows customizable
scoring mechanics and game rules. Users can now set default game
configurations that persist across sessions, and individual quizzes
can have their own configuration overrides.

## New Features

### Game Configuration Options
- Shuffle Questions: Randomize question order when starting a game
- Shuffle Answers: Randomize answer positions for each question
- Host Participates: Toggle whether the host plays as a competitor
  or spectates (host now shows as 'Spectator' when not participating)
- Streak Bonus: Multiplied points for consecutive correct answers,
  with configurable threshold and multiplier values
- Comeback Bonus: Extra points for players ranked below top 3
- Wrong Answer Penalty: Deduct percentage of max points for incorrect
  answers (configurable percentage)
- First Correct Bonus: Extra points for the first player to answer
  correctly on each question

### Default Settings Management
- New Settings icon in landing page header (authenticated users only)
- DefaultConfigModal for editing user-wide default game settings
- Default configs are loaded when creating new quizzes
- Defaults persist to database via new user API endpoints

### Reusable UI Components
- GameConfigPanel: Comprehensive toggle-based settings panel with
  expandable sub-options, tooltips, and suggested values based on
  question count
- DefaultConfigModal: Modal wrapper for editing default configurations

## Technical Changes

### Frontend
- New useUserConfig hook for fetching/saving user default configurations
- QuizEditor now uses GameConfigPanel instead of inline toggle checkboxes
- GameScreen handles spectator mode with disabled answer buttons
- Updated useGame hook with new scoring calculations and config state
- Improved useAuthenticatedFetch with deduped silent refresh and
  redirect-once pattern to prevent multiple auth redirects

### Backend
- Added game_config column to quizzes table (JSON storage)
- Added default_game_config column to users table
- New PATCH endpoint for quiz config updates: /api/quizzes/:id/config
- New PUT endpoint for user defaults: /api/users/me/default-config
- Auto-migration in connection.ts for existing databases

### Scoring System
- New calculatePoints() function in constants.ts handles all scoring
  logic including streaks, comebacks, penalties, and first-correct bonus
- New calculateBasePoints() for time-based point calculation
- New getPlayerRank() helper for comeback bonus eligibility

### Tests
- Added tests for DefaultConfigModal component
- Added tests for GameConfigPanel component
- Added tests for QuizEditor config integration
- Added tests for useUserConfig hook
- Updated API tests for new endpoints

## Type Changes
- Added GameConfig interface with all configuration options
- Added DEFAULT_GAME_CONFIG constant with sensible defaults
- Quiz type now includes optional config property
2026-01-14 01:43:23 -07:00
bc4b0e2df7
Add tests and edit works 2026-01-13 23:52:04 -07:00
028bab23fd
Add document AI gen support 2026-01-13 22:48:43 -07:00
1f88e291a9
Complete stage 7 2026-01-13 20:21:47 -07:00
3a22b42492
Phase 6 complete 2026-01-13 16:52:57 -07:00
93ea01525e
Phase 5 complete 2026-01-13 16:38:25 -07:00
66f15b49b2
Phase 4 complete 2026-01-13 15:39:02 -07:00
0cc099c00c
Fix tests 2026-01-13 15:27:46 -07:00
6d24f3c112
Phase 2 + 3 complete 2026-01-13 15:20:46 -07:00
9a3fc97a34
Phase 1 done 2026-01-13 14:14:30 -07:00