Commit graph

73 commits

Author SHA1 Message Date
cb565b5ac8
Containerize frontend 2026-01-15 22:18:56 -07:00
92b3a5bc85
Fix caddy routing 2026-01-15 21:50:05 -07:00
e26662597a
Caddy 2026-01-15 21:29:57 -07:00
88c7350377
Add css 2026-01-15 21:05:49 -07:00
bfcc33cc50
Change pins to alphanumeric 2026-01-15 21:01:04 -07:00
a5f2f19898
Fix compose issues. Add host and end early 2026-01-15 20:51:20 -07:00
eee3e7e47b
Show host and early stop 2026-01-15 20:26:22 -07:00
1d8c08a680
Fix podium screen 2026-01-15 20:13:15 -07:00
1a7cd3e723
Add tests 2026-01-15 19:52:05 -07:00
a7ad1e9bba
System AI 2026-01-15 19:39:38 -07:00
e732256cbf
Stuff 2026-01-15 19:38:44 -07:00
68e5c0fac4
Cleanup params 2026-01-15 19:18:18 -07:00
7faf459e3c
Fix flow 2026-01-15 19:14:30 -07:00
14b65a2722
Fix groups 2026-01-15 18:55:09 -07:00
705119a297
Make user internal and default app kaboot 2026-01-15 18:33:50 -07:00
685b1fd414
Fix media files 2026-01-15 18:28:06 -07:00
0a26b696f4
Fix enrollment flow 2026-01-15 17:41:36 -07:00
89eda9c03a
Cache caddy stuff 2026-01-15 17:09:25 -07:00
97c054f67b
Update compose 2026-01-15 16:59:58 -07:00
1780efeea2
Update compose 2026-01-15 16:59:48 -07:00
131c744e59
Fix init script 2026-01-15 16:49:12 -07:00
ca74f9be09
Bump worker version 2026-01-15 16:35:15 -07:00
d40618996d
Fix blueprints 2026-01-15 16:03:00 -07:00
979af743bc
Fix docker compose 2026-01-15 15:51:29 -07:00
4cd6b2131e
Fix prod encryption key 2026-01-15 15:38:23 -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
7c03c594c1
Branding 2026-01-15 11:52:29 -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
75c496e68f
Add dns instructions 2026-01-15 08:55:07 -07:00
cdf5c2577e
Add info about admin user 2026-01-15 08:43:18 -07:00
c25cbf5101
Add better prod setup 2026-01-15 08:40:40 -07:00
279dc7f2c3
Scoreboard ui stuff 2026-01-15 08:21:38 -07:00
f0d177feeb
Fix game settings scrolling 2026-01-15 07:12:52 -07:00
5974134ad8
Add more tests 2026-01-15 07:08:50 -07:00
62281e1124
Fix client answer validation bug and improve scoreboard UX
Bug Fix:
- Fix stale closure bug in client answer validation where correct answers
  were sometimes marked incorrect. The issue occurred when players answered
  quickly after a question started - React's async state updates meant
  currentCorrectShape could hold the previous question's value. Added
  currentCorrectShapeRef to ensure the latest value is always used.

Scoreboard Improvements:
- Unified desktop/mobile layout: avatar, name, and points on first line;
  progress bar on second line; bonus pills on third line
- Removed 5-player limit to show all players
- Added vertical scrolling when player list exceeds viewport
- Fixed layout to prevent content overflow issues
2026-01-14 22:21:10 -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
560c974bf3
Try fix mobile 2026-01-14 16:34:59 -07:00
1506210a2e
Add Authentik blueprints for automated OAuth2/OIDC setup
Automate the manual Authentik configuration process using native YAML blueprints
that are applied on container startup.

Changes:
- Add kaboot-setup.yaml blueprint for local development
- Add kaboot-setup-production.yaml.example for production with configurable domains
- Update docker-compose.yml and docker-compose.prod.yml to mount blueprints
- Add AUTHENTIK_BOOTSTRAP_PASSWORD/TOKEN env vars for automated admin setup
- Update setup.sh to generate bootstrap credentials and display admin password
- Update Caddyfile.example with proper proxy headers for Authentik
- Add Caddyfile to .gitignore (user-specific config)
- Update docs with Quick Start sections for automated setup

The blueprints create:
- OAuth2/OIDC provider (public client, client_id: kaboot-spa)
- Kaboot application with redirect URIs
- kaboot-users group with application binding
- Enrollment flow with sign-up capability
- Password complexity policy
- Test user and service account (passwords set manually)
2026-01-14 16:20:10 -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
fc270d437f
Redesign scoreboard 2026-01-14 01:55:49 -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
90fba17a1e
Add shuffle options 2026-01-14 00:16:23 -07:00
683cd039e7
Fix modal scrolling 2026-01-13 23:56:21 -07:00
bc4b0e2df7
Add tests and edit works 2026-01-13 23:52:04 -07:00
bfbba7b5ab
Add ability to edit AI generated content 2026-01-13 23:37:08 -07:00
846ba2a69c
Add time sync 2026-01-13 22:56:56 -07:00