Skip to content

Feature/multi-user & knowledge base - #6

Merged
BYLinMou merged 19 commits into
mainfrom
feature/local-database
Oct 25, 2025
Merged

BYLinMou merged 19 commits into
mainfrom
feature/local-database

Conversation

@BYLinMou

Copy link
Copy Markdown
Owner

This pull request introduces user authentication support, improves configuration management, and enhances deployment options for the application. The main changes include adding a frontend authentication system, updating API helpers to handle authentication tokens, restructuring the documentation for clearer setup and configuration, introducing a PostgreSQL service to the Docker Compose setup, and centralizing game-related configuration.

Authentication and User Management:

  • Added a new auth.js module to the frontend that manages user registration, login, logout, and profile updates, supporting both authenticated and guest modes based on server configuration. It synchronizes authentication state with localStorage and provides error messages with i18n support.
  • Updated the API helper (api-helper.js) to automatically include authentication tokens in API requests when available, supporting both authenticated and guest users. [1] [2]

Configuration and Documentation Improvements:

  • Restructured the README.md to clarify configuration steps, emphasizing copying and editing server/config.js for all deployment methods, and consolidated repeated instructions for better readability. [1] [2] [3] [4] [5]
  • Added a new config.js module in the frontend for centralized game and API endpoint configuration, improving maintainability and clarity of game settings.

Deployment and Infrastructure:

  • Enhanced the Docker Compose setup by adding a PostgreSQL service for persistent database storage, configuring environment variables, health checks, and volume management for both the database and application services. [1] [2]
  • Updated Docker run instructions in the documentation to mount persistent data and uploads directories, supporting better data management in containerized deployments.

Continuous Integration:

  • Enabled manual workflow dispatch in GitHub Actions for more flexible CI/CD pipeline triggering.

Bumped the package version to 0.0.8 and updated the publish date to 2025-10-22 for the transculturalist project.
Introduces a localStorage-based authentication system with login/register modal and guest login prompt banner. Adds centralized gold color theme CSS and updates all major HTML pages to include authentication scripts and gold theme styles. Localization files are extended with authentication-related strings in all supported languages.
Frontend now fetches server config to determine if authentication is enabled, updating UI and logic accordingly. Added new /api/config endpoint to provide safe config values to the frontend. UI elements and banners now reflect auth state, and localization strings for 'authDisabled' were added.
1. Introduces PostgreSQL service to docker-compose and adds SQL initialization scripts for multiple dialects.
2. Refactors frontend authentication to use async API calls for login and registration.
3. Updates settings page with global save/reset functionality and enhances localization files with new settings-related keys.
…s integration

1. modularized API routes into separate files for general, auth, ai, user, game, and upload modules.
2. Added authentication middleware and shared helpers for config and package loading.
3. Frontend settings page now syncs preferences and profile with backend, supports reset and load from database, and uses explicit element IDs for settings controls.
1. Introduced a reusable GameTimer module for consistent timing across games.
2. Integrated timer display and logic into matching, MCQ, roleplay, and story games, replacing previous ad-hoc timer implementations.
3. Timer now supports start, pause, reset, and periodic sync to the backend for playtime statistics.
1. Improves the Settings page statistics display with dynamic loading, minute formatting, and accurate average score.
2. Refines game completion logic for MCQ, Matching, Roleplay, and Story games so only explicit completion counts toward statistics.
3. Adds new i18n keys for 'Finish Game' and 'Game saved!' in all supported languages.
4. Updates backend to support new playtime and game result endpoints, and centralizes config for timer and statistics.
5. Enhances user experience and ensures statistics reflect true completed games.
1. Introduces guest game statistics and session-based storage for non-logged-in users using sessionStorage.
2. Adds guest-game-storage.js for tracking playtime and results, and guest-game-display.js for UI display of guest stats.
3. Updates timer.js and all game HTML files to support guest mode, including auto-saving results locally.
4. Enhances settings.html to show guest stats, and updates i18n files and score info tooltips for clarity.
5. Also fixes average score precision (increase from 1dp to 2dp) in server-side stats.
1. Introduces leaderboard-manager.js for dynamic leaderboard rendering and auto-refresh.
2. Adds new forum pages for discussion, contribution, ranking, and verification, with localized UI and navigation.
3. Updates i18n locale files for leaderboard and forum features.
4. Adds backend leaderboard service and updates game route for leaderboard API integration.
Update package version from 0.0.8 to 0.0.9 in preparation for a new release.
Added mounting of 'data' and 'uploads' directories to Docker run examples in README for both PowerShell and absolute path options. This clarifies how to persist application data and uploads outside the container.
1. Dispatch a custom 'i18n:languageChanged' event when the language is changed in i18n.js.
2. Update leaderboard-manager.js to listen for this event and re-render tables on language change.
3. Simplify getTranslatedUnit to use i18n directly and remove fallback logic.
…stration

1. Introduces a privacy policy modal to the authentication flow and requires users to agree to the privacy policy before registering.
2. Adds frontend UI for viewing and agreeing to the privacy policy, updates translations, serves the privacy policy from the server, and enforces agreement validation in both frontend and backend registration logic.
3. Also adds privacy policy access from settings.
Update package version from 0.0.9 to 0.0.10 in preparation for a new release.
1. Implemented database tables and initial data for culture tags and shares in both SQLite and PostgreSQL.
2. Added new API modules for forum culture sharing and tag retrieval.
3. Updated frontend culture-selection page to dynamically load and filter culture shares and tags via API, replacing static cards with interactive UI.
1. Enhanced internationalization by supporting data-i18n-key attributes and dynamic localization of tag and share names, titles, and descriptions.
2. Improved tag button rendering to include icons and localized text, and updated event handling for language changes to reload content accordingly.
…ed data

1. Game pages now pass shareId and description between steps for improved context.
2. Localization files add 'selectAll' translations.
3. Culture selection and game selection HTML updated to use i18n and localStorage for theme/description.
4. Story game config template expanded.
5. Database seed data adds new culture shares (Egyptian hieroglyphs, Hong Kong Dragon Crisp Candy, Sugar Figurine) and updates multi-language fields and tag associations.
Updated package version to 0.1.0 and changed publishDate to 2025-10-23 in package.json.
1. Implemented inline detail view for shared cultural resources in the forum, including localized display of resource data and file lists.
2. Refactored upload form into a separate iframe for improved UX and modularity.
3. Added new i18n keys for resource-related UI elements and extracted localization helper to a shared JS module.
4. Updated game selection to reflect selected resource theme and improved i18n event handling.
5. Minor UI and logic improvements across forum and game pages.
@BYLinMou
BYLinMou merged commit 5cf122b into main Oct 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant