IDK, it's working and we're moving on

This commit is contained in:
cottongin
2025-11-02 16:06:31 -05:00
parent 6308d99d33
commit 2a75237e90
26 changed files with 5231 additions and 45 deletions

View File

@@ -34,6 +34,18 @@ A full-stack web application that helps groups pick games to play from various J
- Automatically matches votes to games based on timestamps
- Updates popularity scores across sessions
- **Live Voting API**: Real-time vote processing from external bots
- Accept live votes via REST API
- Automatic deduplication (1-second window)
- Timestamp-based game matching
- JWT authentication for security
- **Webhook System**: Notify external services of events
- Send notifications when games are added to sessions
- HMAC-SHA256 signature verification
- Webhook management (CRUD operations)
- Delivery logging and testing
### Public Features
- View active session and games currently being played
- Browse session history
@@ -174,9 +186,13 @@ The manifest is automatically generated during the build process, so you don't n
│ │ ├── games.js # Game CRUD and management
│ │ ├── sessions.js # Session management
│ │ ├── picker.js # Game picker algorithm
│ │ ── stats.js # Statistics endpoints
│ │ ── stats.js # Statistics endpoints
│ │ ├── votes.js # Live voting endpoint
│ │ └── webhooks.js # Webhook management
│ ├── middleware/ # Express middleware
│ │ └── auth.js # JWT authentication
│ ├── utils/ # Utility functions
│ │ └── webhooks.js # Webhook trigger and signature
│ ├── database.js # SQLite database setup
│ ├── bootstrap.js # Database initialization
│ ├── server.js # Express app entry point
@@ -242,6 +258,18 @@ The manifest is automatically generated during the build process, so you don't n
### Statistics
- `GET /api/stats` - Get overall statistics
### Live Votes
- `POST /api/votes/live` - Submit real-time vote (admin)
### Webhooks
- `GET /api/webhooks` - List all webhooks (admin)
- `GET /api/webhooks/:id` - Get single webhook (admin)
- `POST /api/webhooks` - Create webhook (admin)
- `PATCH /api/webhooks/:id` - Update webhook (admin)
- `DELETE /api/webhooks/:id` - Delete webhook (admin)
- `POST /api/webhooks/test/:id` - Test webhook (admin)
- `GET /api/webhooks/:id/logs` - Get webhook logs (admin)
## Usage Guide
### Starting a Game Session
@@ -303,21 +331,40 @@ The system will:
3. Update the game's popularity score (+1 for ++, -1 for --)
4. Store the chat log in the database
## Bot Integration
For integrating external bots (e.g., for live voting and game notifications), see **[BOT_INTEGRATION.md](BOT_INTEGRATION.md)** for detailed documentation including:
- Live voting API usage
- **WebSocket integration (recommended)** for real-time game notifications
- Webhook setup and verification (alternative to WebSocket)
- Example implementations in Node.js and Go
- Security best practices
## Database Schema
### games
- id, pack_name, title, min_players, max_players, length_minutes
- has_audience, family_friendly, game_type, secondary_type
- play_count, popularity_score, enabled, created_at
- play_count, popularity_score, upvotes, downvotes, enabled, created_at
### sessions
- id, created_at, closed_at, is_active, notes
### session_games
- id, session_id, game_id, played_at, manually_added
- id, session_id, game_id, played_at, manually_added, status
### chat_logs
- id, session_id, chatter_name, message, timestamp, parsed_vote
- id, session_id, chatter_name, message, timestamp, parsed_vote, message_hash
### live_votes
- id, session_id, game_id, username, vote_type, timestamp, created_at
### webhooks
- id, name, url, secret, events, enabled, created_at
### webhook_logs
- id, webhook_id, event_type, payload, response_status, error_message, created_at
## Game Selection Algorithm