Commit Graph
265 Commits
Author SHA1 Message Date
DarkraiseandGitHub 1c80902fa1 Merge pull request #3 from darkraise/feature/domain-settings
Feature/domain settings
2026-02-05 16:38:49 +07:00
Darkraise a74bc8197d refactor: improve caching, cleanup jobs, and type safety
- Convert CachedSystemSettingsService to singleton pattern
- Add scheduled cleanup for login attempts (24h) and activity logs
- Add batch size limits (100) for favorites and playlist operations
- Enhance health check with game-service connectivity verification
- Add cache stampede prevention in GameSearchCache
- Fix N+1 query in RoleService.getRoles() with single JOIN query
- Consolidate domains migration into 001_complete_schema.sql
- Replace `any` types with `unknown` and explicit type parameters
- Extract MetadataUpdateCard and RuffleManagementCard components
- Fix race condition in PlayTrackingService duration calculation
2026-02-05 16:31:05 +07:00
Darkraise 996c17734b fix: harden security and improve code quality across services
fix: harden security and improve code quality across services

Add Zod validation schemas to backend routes, replace z.any() with
explicit types, and convert SQL string interpolation to parameterized
queries to prevent injection attacks.

Security improvements:
- Add SSRF protection with domain allowlist in CommunityPlaylistService
- Enforce JWT algorithm restriction and token type validation
- Sanitize error messages to prevent path leakage in game-service
- Add MIME type enforcement based on file extension, not server headers
- Add request timeouts with exponential backoff retry logic
- Prevent Flashpoint database writes (read-only enforcement)

Backend improvements:
- Use UPSERT for play tracking to avoid race conditions
- Add dispose() method to CachedSystemSettingsService for cleanup
- Use crypto.randomUUID() instead of custom UUID generator
- Batch fetch games in PlaylistService to fix N+1 query pattern
- Use centralized verifyPassword utility in UserService

Frontend improvements:
- Add PlayerErrorBoundary to prevent app crashes from Ruffle errors
- Add theme initialization script to prevent FOUC
- Add custom favicon.svg with Flashpoint branding
- Fix token refresh race condition with subscriber queue
- Add AbortSignal support to games search API
- Replace EventSource with fetch for authenticated SSE streams
- Improve error handling in UserForm and CreatePlaylistModal
- Stream large files instead of buffering in game-service
2026-02-05 10:29:03 +07:00
Darkraise af740d6dab fix: harden domain settings and share URL handling
- Add max domain limit (50) to prevent unbounded growth
- Auto-promote next domain as default when deleting current
  default inside a transaction
- Cache CORS allowed origins alongside domain cache
- Validate share URLs with URL constructor and restrict to
  http/https protocols
- Track per-domain delete state to avoid disabling all buttons
- Prevent domain selector reset after manual user selection
- Refetch domains after delete to reflect auto-promoted default
- Replace inline require() calls with top-level config import
- Add debug/warn logging for swallowed catch blocks
2026-02-04 22:48:42 +07:00
Darkraise 971b432d94 fix: code review issues 2026-02-04 16:57:48 +07:00
Darkraise 855cb8b38c refactor: convert DomainService to singleton pattern
Move cache state from module-level variables into instance
properties and use getInstance() to ensure a single shared
instance across routes and CORS configuration.
2026-02-04 11:23:20 +07:00
Darkraise afd835bbd9 refactor: update according to code review 2026-02-04 11:18:46 +07:00
DarkraiseandGitHub 932ca40309 Update docs/07-design-system/icons.md 2026-02-04 11:03:54 +07:00
DarkraiseandGitHub abdf2c5d93 Update docs/07-design-system/color-palette.md 2026-02-04 11:03:35 +07:00
DarkraiseandGitHub c5fdd0b43e Update docs/07-design-system/color-palette.md 2026-02-04 11:01:49 +07:00
Darkraise 5a9361c6d5 docs: remove duplicated docs section 2026-02-04 10:40:53 +07:00
Darkraise 12792db185 chore: apply consistent code formatting across codebase 2026-02-04 06:03:39 +07:00
Darkraise 5ca30044d6 refactor: use ternary expressions for conditional JSX
Replace `{condition && (<JSX>)}` pattern with
`{condition ? (<JSX>) : null}` across all frontend components.
This avoids potential falsy value rendering issues with
the logical AND operator.
2026-02-04 05:50:59 +07:00
Darkraise a263db1a2f feat: add admin-configurable domain settings 2026-02-04 05:34:01 +07:00
Darkraise 17f0cd93a7 chore: update github templates 2026-02-03 23:41:31 +07:00
Darkraise 8af54de927 feat: remove edition settings, use version.txt instead 2026-02-03 22:33:25 +07:00
Darkraise 6728cc3cff fix: edition checking 2026-02-03 19:44:38 +07:00
Darkraise fe75241cbe ci: update dockerfile 2026-02-03 19:06:47 +07:00
Darkraise 5b574a910a ci: update frontend build 2026-02-03 18:17:36 +07:00
Darkraise 67c3501b3e ci: fix build 2026-02-03 18:05:02 +07:00
Darkraise 5c81da06ac ci: update dockerfile 2026-02-03 17:43:57 +07:00
Darkraise 9e32d90c46 feat: add Flashpoint edition support (Infinity/Ultimate)
- Add edition config to backend, .env.example, and Docker
- Gate metadata sync and update checks on edition
- Conditionally select logoPath/screenshotPath in queries
- Add edition selector to General Settings (admin only)
- Hide metadata sync UI for Ultimate in Update Settings
- Add `metadata.flashpoint_edition` system setting with
  migration seed data
2026-02-03 16:33:33 +07:00
Darkraise d442c11f01 chore: code cleanup 2026-02-03 15:33:33 +07:00
Darkraise e41154ad6d chore: documents cleanup 2026-02-03 14:59:00 +07:00
Darkraise d8a0db6d23 chore: remove local claude settings 2026-02-03 10:43:01 +07:00
Darkraise da7c965491 chore: add readme and update documents 2026-02-03 10:42:28 +07:00
Darkraise 10d6e3a85c fix: normalize malformed URLs with single-slash protocol
Legacy Flash games sometimes emit URLs like /http:/domain.com/path
instead of /http://domain.com/path. Add normalization to detect
and fix these malformed URLs before parsing in both the proxy
handler and GameZip server.
2026-02-03 00:01:07 +07:00
Darkraise 4a697d124f fix: use entrypoint defaults for nginx env vars
The nginx envsubst command doesn't support the ${VAR:-default}
syntax. Move default values for BACKEND_HOST, BACKEND_PORT, and
GAME_SERVICE_HOST to docker-entrypoint.sh where they're properly
handled by bash before envsubst runs.
2026-02-02 23:45:45 +07:00
Darkraise 39f9957670 feat: add nginx proxy for game service in Docker
Routes game content through nginx instead of requiring direct
localhost:22500 access from browser. This enables proper Docker
networking where containers communicate internally.

Changes:
- Add /game-proxy and /gamezip-proxy locations to nginx config
- Add GAME_SERVICE_EXTERNAL_URL config for browser-facing URLs
- Update games route to use external URL config
- Add GAME_SERVICE_HOST env var to frontend container
- Add game-service dependency to frontend in docker-compose
2026-02-02 23:26:52 +07:00
Darkraise 74af2b8614 feat: derive game image paths from ID instead of DB columns
Remove logoPath and screenshotPath fields from Game interface
and database queries. Images are stored on disk with paths
derived from game ID (e.g., Logos/ab/cd/{game-id}.png).

- Add gameUtils.ts with path/URL derivation functions
- Update GameCard, GameListItem, GameDetailView, GamePlayerView
- Update GameService to exclude unused columns from queries
- Update tests with valid UUID format for image URL testing
- Update database schema docs to clarify image storage
2026-02-02 22:11:21 +07:00
Darkraise 8ab3dc1816 ci: update frontend docker 2026-02-02 17:42:38 +07:00
Darkraise 92c4e7187b ci: update frontend nginx config 2026-02-02 17:25:37 +07:00
Darkraise 58a48dfc91 ci: fix container permission error 2026-02-02 17:06:38 +07:00
Darkraise 77dc45700e ci: use node user by default 2026-02-02 16:54:05 +07:00
Darkraise ee30b40a03 fix: docker permission 2026-02-02 16:43:17 +07:00
Darkraise e495d0243c fix: build failed 2026-02-02 15:50:32 +07:00
Darkraise b5feb04604 refactor: simplify Docker config and add db optimizations
- Consolidate docker-compose files: dev.yml builds locally, main uses
  pre-built images; remove redundant prod.yml and images.yml
- Add docker-entrypoint.sh for database copy from network storage
- Add SQLite performance tuning (PRAGMA optimizations, mmap, cache)
- Add cache pre-warming for instant first page load
- Enhance logging with OTEL-compatible JSON format and trace context
- Simplify .env.example with clearer sections and fewer variables
- Remove EXTERNAL_IMAGE_URLS env var (auto-read from FP preferences)
- Hardcode container ports (use docker port mapping to customize)
- Add /api/errors/stats endpoint for admin dashboard
2026-02-02 15:43:31 +07:00
Darkraise 3321557229 ci: update nginx config 2026-02-01 12:23:34 +07:00
Darkraise d10c542b81 ci: update dockerfile 2026-02-01 11:52:40 +07:00
Darkraise f76f731efe chore: add config for logging and update dockerfile 2026-02-01 11:40:07 +07:00
Darkraise 9e9a116f7f fix: frontend nginx 2026-02-01 11:14:02 +07:00
Darkraise 9f5090b19f chore: update flashpoint preferences service 2026-02-01 02:02:35 +07:00
Darkraise 8ecdfbb26f chore: update gitignore 2026-02-01 01:21:28 +07:00
Darkraise 08117b4ddc feat: add initial setup page 2026-02-01 01:20:56 +07:00
Darkraise cbfd7c5e6d fix: migration issue 2026-01-31 19:39:24 +07:00
Darkraise 9da65982e1 ci: remove performance budget 2026-01-31 19:30:15 +07:00
Darkraise d5d902f584 fix: backend startup failed 2026-01-31 19:25:24 +07:00
Darkraise 0c58921b52 fix: health check endpoint of game service 2026-01-31 18:54:10 +07:00
Darkraise 516f160866 fix: build failed 2026-01-31 18:08:54 +07:00
Darkraise 08d76306fe chore: update dockerfile 2026-01-31 17:46:35 +07:00