Commit Graph

62 Commits

Author SHA1 Message Date
d610fa08fb fix: GM login - include GM in dropdown, auto-fill password, fix session validation regex 2026-06-23 15:18:33 +02:00
5b022a6426 Save mission 'The Hunt for Fabius Bile' to DB
- 10 scenes, 59 enemies, High threat, 4 players
- Includes all combat encounters, social, investigation, puzzle, epilogue
2026-06-23 14:52:34 +02:00
bfe3489060 Update player sheets with proper Deathwatch data
- All players: Adept renown (1 RP), 15 wounds, fate=1, full characteristics
- anders: Blood Angels Devastator, Heavy Bolter + Bolt Pistol
- christoffer: Ultramarines Chaplain (Hero, 3 RP), Crozius Arcanum + Bolt Pistol
- claes: Ultramarines Sergeant, Bolter + Chainsword + Power Fist + Bolt Pistol
- phillip: Ultramarines Space Marine, Bolter + Chainsword + Bolt Pistol
2026-06-23 14:48:26 +02:00
254ba5bd1d Fix login UI: add user dropdown selector, fix build syntax error
- Replace username text input with dropdown selector for player login
- Fix unescaped apostrophe in MissionSimTab.jsx (Emperor's -> double quotes)
- Fix em-dash encoding issues in MissionSimTab.jsx
- Update player password to 1234 in .env
2026-06-23 14:43:51 +02:00
182afab282 Add mobile responsiveness to App.js
- Tab navigation wraps on small screens (flex-wrap)
- Smaller padding and font on mobile (px-4, text-xl)
- Responsive main content padding (px-4 sm:px-6)
- Tighter spacing on login row (gap-3, mb-3)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-23 14:27:58 +02:00
fb019057bb Restructure Mission tab: Mission for all, Mission Sim for GM only
- Rename MissionTab to MissionSimTab (combat simulation, GM only)
- New MissionTab shows mission history (all users)
- Mission Sim tab added to GM-only navigation
- MissionSimTab.jsx moved to src/components/

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-23 10:16:35 +02:00
fe1b77ec68 Add mission persistence: missions table, API routes, and history UI
- MariaDB missions table with scenes JSON
- /api/missions CRUD routes
- MissionTab saves completed missions to DB
- Mission history panel in UI

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-23 10:07:46 +02:00
dbb79c2537 Remove unused hitsFromDoS from MissionTab
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-23 08:52:16 +02:00
a054293ef9 Clean up MissionTab: remove unused imports and state variables
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-23 08:51:00 +02:00
ca4c8068f8 Add Mission Tab: combat simulation for GM mission planning
- New MissionTab component with scene-based combat simulation
- Enemy roster from DeathwatchRoller (12 enemy types)
- Scene progression (4-6 scenes) with threat levels
- Combat log and results tracking
- Added to App.js navigation

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-23 08:47:40 +02:00
42dd4cfb53 Fix App.js: guard list.find against non-array response
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 22:58:19 +02:00
3248180617 Fix PlayerManagement tests: wrap async state updates in waitFor
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 19:40:29 +02:00
f01eef297f Fix XPBar test: enable automatic JSX transform in babel
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 19:23:58 +02:00
a4cabbd2b8 Clean rules database and add documentation
- Remove OCR noise, credits, and duplicates from rules-database.json (288→255 rules)
- Add clean_rules.py script for rule cleanup
- Add CLAUDE.md, docs/, and update README with documentation links

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 17:35:36 +02:00
e511bff882 Add weapon images, full rule scraping, and expanded quick reference
- scripts/generate-weapon-images.js: AI image generation for weapon cards
  supporting HuggingFace FLUX.1-schnell, OpenAI DALL-E 3, and Gemini Imagen;
  images served from public/weapon-images/ via new static route in server.js
- public/cards.html: load manifest.json and show AI art on weapon cards
- scripts/scrape-rules-from-pdfs.py: PyMuPDF scraper extracting full rule
  text from all five rulebook PDFs with bold-span heading detection
- scripts/tag-and-dedup-rules.js: standalone dedup helper (JS-side grouping)
- database/routes/rulesRoutes.js: remove content truncation in search/random,
  add admin dedup endpoint (JS-side, fast), fix RulesTab to fetch full content
- src/components/RulesTab.jsx: fetch full rule content on modal open
- public/print.html: expanded quick reference with pre-gen character stat
  blocks (Sepheran + Lucian), Astartes traits sheet with correct derived SBs
  and TBs, full Critical Hit Tables for all 4 locations × 4 damage types

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 22:50:50 +01:00
dc1c13620f Add Kort and Print links to main navigation
Both open in a new tab (target=_blank) since they are standalone
HTML pages outside the React app.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 21:25:19 +01:00
83a1aeaebe Refine card layout: smaller art box, bigger stats text, footer bar
- Art box reduced from 32mm to 26mm height, icon enlarged to 22pt
- Stats font increased from 6pt to 7pt with more line spacing
- Replaced floating source pip with proper footer bar showing
  renown requirement (left) and source book (right)
- Footer bar colour-coded by weapon category to match title bar

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 21:22:32 +01:00
373b7f5333 Add printable weapon card sheets at /cards.html
Poker-card sized (63×88mm) cards matching the physical Deathwatch card format:
- Req cost badge top-left
- Title bar with weapon name
- Dark art box with category icon and class label
- Type line (Weapon – Melee, Weapon – Ranged, Equipment, etc.)
- Stats block (Dmg, Pen, Range, RoF, Clip, Rld, Special, Renown)
- Source abbreviation bottom-right

9 cards per A4 sheet, cut-ready.
Filter by category (Melee/Ranged/Grenade/Armour/Other).
Data loaded live from /api/weapons.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 21:08:03 +01:00
f94095b22f Add printable quick reference page at /print.html
5 printable sheets for the Deathwatch RPG:
- Sheet 1: Core Mechanics (tests, DoS/DoF, damage formula, hit locations)
- Sheet 2: Combat Actions (half/full actions, ranged/melee modifiers)
- Sheet 3: Weapons (melee, ranged, grenades - loaded live from /api/weapons)
- Sheet 4: Squad Mode & Cohesion rules
- Sheet 5: Weapon Special Qualities (Tearing, Power Field, Blast, etc.)

Print-optimised CSS with page-break-after per sheet.
Weapons table fetches live from the API for up-to-date data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 20:58:13 +01:00
7d41ec8205 Fix public/index.html template - remove hardcoded script tags
The template had a stale hardcoded <script> tag from a previous build
output, causing react-scripts to inject a second script reference on
every new build. Restored to proper CRA template with %PUBLIC_URL%
placeholders.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 20:09:50 +01:00
ea0ce62290 Add Weapons tab showing all 73 weapons from rulebooks
Adds a new WeaponsTab component with:
- Filterable table of all 73 weapons from scrape-rulebooks.py
- Filter by category: Ranged, Melee, Grenade, Armour, Other
- Text search across name, damage, special rules, source
- Click-to-expand detail panel with full stats
- Parses both ranged (semicolon-separated) and melee (structured) stat formats

Tab is visible to all users (not GM-restricted).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 19:43:19 +01:00
585584d6c2 Add comprehensive rulebook scraper for all Deathwatch PDFs
Extracts from CR, FF, RoB, MoX, HtC:
- 36+ weapons (ranged + melee) from Core Rulebook
- 37 talents, 16 traits, 11 weapon qualities
- 89 psychic powers
- 99+ bestiary entries from Mark of the Xenos
- 1100+ lore/chapter entries across all books
- 123 speciality entries
- Total: 3415 rules, 228 bestiary entries in DB

Uses PyMuPDF (fitz) for text blocks and pdfplumber for table extraction.
PDFs are stored on NFS and not in git.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 19:37:12 +01:00
91bd25fbac Ignore rulebook PDFs from git (stored on NFS)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 19:18:22 +01:00
40fdd113e8 Add missing items to shop: Heavy Bolter, Crozius Arcanum, Servo-arm, Mechadendrite, Rosarius
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 18:43:00 +01:00
768fdfd419 Add PM2 restart_delay and max_restarts to prevent crash-loop spam
When DB_PASSWORD is missing on startup, server exits and PM2 was
restarting every ~660ms flooding backend.log with ER_ACCESS_DENIED_ERROR.
Now waits 5s between restarts and caps at 10 attempts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 18:31:32 +01:00
6c9bde7710 Remove obsolete one-shot import scripts
import-rules.js, import-armour.js, import-all.js were used once during
initial data import and have been superseded by the scripts/ directory.
All hardcoded wrong passwords (dwroller2025).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 18:27:47 +01:00
1e361301ad Fix rules search ranking and import clean skills/talents from Core Rulebook
- Add search relevance scoring: exact title > title prefix > title contains > Core Rulebook source > content match
- Add DB_PASSWORD env var to pm2.config.js so server can connect to MariaDB
- Add update-rules-from-sources.py: imports 45 skills from CSV and 44 talents from CR.txt, removes garbage advance-table entries
- Add fix-talent-titles.py: normalises OCR-garbled talent titles, removes 28 duplicates, fixes 65 entries
- Add cleanup-skill-dupes.py: removes duplicate skills from csv-import/fandom/sanitized sources, recategorises 55 lore entries

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 18:25:08 +01:00
43d0becdf6 Fix missing DB table, rules column, GM endpoints, and logout
- Add rules table to createTables() with auto-seed from rules-database.json
- Fix page_num → page column mapping in rulesRoutes.js
- Fix INSERT column names in rulesHelpers.create() and stagingHelpers
- Add POST /api/sessions/logout endpoint
- Add GM endpoints: set-xp, set-xp-spent, set-rp, set-renown,
  add-or-update, reset-password, DELETE gm/delete/:name
- All GM endpoints require x-gm-secret header (403 otherwise)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 18:08:30 +01:00
96d471b2f8 Add attacker selection from enemies list
Allow selecting an attacker from the bestiary/enemies list to
automatically populate BS and WS values. This enables using player
characters (added as enemies) as attackers in combat rolls.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-01 18:08:29 +01:00
4130ab7766 Update MariaDB config to use remote database server
Switch from localhost to Synology NAS (192.168.1.113:3307) for
centralized database hosting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-01 18:08:29 +01:00
alexpolo1
bf98d44a45 security: remove hardcoded database credentials and auth secrets
- Replace hardcoded DB_PASSWORD 'dwroller2025' with process.env.DB_PASSWORD
- Replace hardcoded GM_SECRET 'bongo' with process.env.GM_SECRET
- Replace hardcoded GM_PASSWORD with process.env.GM_PASSWORD
- Replace hardcoded PLAYER_PASSWORD '1234' with process.env.PLAYER_PASSWORD
- Update .env.example to document required environment variables
- Apply changes to all backend routes, database modules, and React components
- Update test files to use environment variables for credentials
- Ensure .env remains in .gitignore for production safety

This fix addresses critical security vulnerabilities where database
credentials and authentication secrets were exposed in source code.
2026-03-01 09:24:24 +01:00
35335a32d3 Refactor UI components for improved styling and consistency
- Updated RequisitionShop component styles for a cohesive dark theme.
- Enhanced RulesTab component with consistent dark styling and improved button visibility.
- Modified XPBar component to align with new dark theme aesthetics.
- Adjusted global styles in index.css to support the new design.
- Added comprehensive DEVELOPMENT_GUIDE.md for project setup, deployment, and maintenance instructions.
2025-12-11 21:15:14 +01:00
d84ca39e61 refactor: Migrate database from SQLite to MariaDB
Database Migration:
- Add MariaDB connection configuration and initialization (mariadb.js)
- Create MariaDB schema update script (mariadb-schema-update.sql)
- Add migration scripts for SQLite to MariaDB transition:
  * migrate-sqlite-to-mariadb.js: Main migration script
  * migrate-inventory-to-gear.js: Inventory schema migration
- Remove SQLite-specific implementation files and databases

Route Updates:
- Update all route handlers to use MariaDB instead of SQLite
- Migrate routes: playerRoutes, sessionRoutes, shopRoutes, bestiaryRoutes, rulesRoutes, rulesStagingRoutes, weaponsRoutes
- Remove SQLite-specific route files (playerRoutes-sqlite.js, sessionRoutes-sqlite.js)
- Update server.js to initialize MariaDB and register new weapon routes

Backend Scripts:
- Remove old SQLite migration scripts (migrate-to-sqlite.js, server-sqlite.js)
- Delete obsolete database utility scripts from backup-scripts/

Frontend Updates:
- Update logger utility for improved error handling and debugging
- Enhance PlayerManagement component with better state management
- Improve RequisitionShop component for MariaDB integration
- Update DeathwatchRoller with performance improvements
- Add login test suite (login.test.js)
- Add XP progression utility (xpProgression.js)
- Update dependencies in package.json and package-lock.json

This migration improves:
- Database scalability and performance
- Transaction support for complex operations
- Better data integrity and ACID compliance
- Simplified deployment and backup procedures
2025-12-11 19:20:44 +01:00
0aa3fd0c30 feat: Add Minecraft-style XP progress bar to character sheets
- Create new XPBar component with green progress bar visualization
- Add XPSummary card showing total XP, available XP, and current level
- Integrate XP bar into PlayerTab character sheet display
- Add reference guide showing Deathwatch advancement costs
- Add GM controls for quick XP adjustment (+100, +200, -50 XP buttons)
- Set default XP threshold to 500 (customizable per characteristic)
- Supports tracking both total XP and spent XP separately

This enables faster XP progression visualization for monthly play sessions.
2025-12-11 17:12:37 +01:00
a5a6b963fa feat: Add PlayerManagement GM interface and clean repository
- Add comprehensive PlayerManagement component for GMs
- Add all GM API endpoints for player CRUD operations
- Add comprehensive test suite with 14 tests
- Clean up .gitignore to exclude logs, backups, core dumps
- Update README with setup instructions and documentation
- Add setup.sh script for easy project initialization

This provides a complete GM interface for managing players without
the large files that were blocking the previous push.
2025-09-05 11:05:53 +02:00
alexpolo1
c8c7e3936e Merge pull request #2 from alexpolo1/copilot/fix-eb4aa1e1-d958-4a31-8ac2-2662db7bf339
Fix CI pipeline by separating unit and integration tests
2025-08-24 23:11:08 +02:00
copilot-swe-agent[bot]
0f44d56c63 Fix CI pipeline by separating unit and integration tests
Co-authored-by: alexpolo1 <14327609+alexpolo1@users.noreply.github.com>
2025-08-24 20:40:59 +00:00
copilot-swe-agent[bot]
b7df2c1e49 Initial analysis of CI pipeline issues
Co-authored-by: alexpolo1 <14327609+alexpolo1@users.noreply.github.com>
2025-08-24 20:35:40 +00:00
copilot-swe-agent[bot]
ec3952ba67 Initial plan 2025-08-24 20:30:50 +00:00
8c280bdacc feat: Update package.json scripts and add new dependencies for improved functionality 2025-08-21 22:46:12 +02:00
fc4d4f0dc7 Ignore .env and environment files 2025-08-20 15:33:08 +02:00
b6135640e1 Refactor code structure for improved readability and maintainability 2025-08-20 15:29:22 +02:00
9d53410aab Add migration script to import JSON data into SQLite database
- Created a new script `migrate-to-sqlite.js` to migrate data from JSON files into a SQLite database.
- Implemented functions to read JSON files safely and handle errors.
- Established database schema with tables for armour, weapons, bestiary, and rules.
- Added logic to insert data from JSON files into the corresponding database tables.
- Included backup functionality for the existing database before migration.
- Logged import totals and sample data from each table for verification.
- Added a new script `check-shop-stats.js` to fetch and log item statistics from the database.
2025-08-17 19:14:29 +02:00
4c1b19fb8c feat: Implement bestiary routes for data retrieval and management
- Added bestiaryRoutes.js to handle API endpoints for fetching enemies, full bestiary data, and statistics.
- Implemented caching mechanism for bestiary data with a 5-minute expiration.
- Created transformation functions for bestiary entries to standardize data format for the dice roller.
- Added admin-only endpoint to force reload bestiary data with GM authentication.

chore: Create scripts for analyzing and cleaning bestiary data

- Developed analyze-bestiary-quality.js to review data quality and identify duplicates or inconsistencies.
- Implemented clean-bestiary-fields.js to extract and clean specific fields from bestiary entries, reducing text duplication.
- Created clean-corrupted-bestiary.js to remove corrupted entries based on defined patterns.
- Generated a comprehensive database-cleanup-report.md summarizing the cleaning process and results.

build: Add fast build script for streamlined deployment

- Introduced fast-build.sh to facilitate quick builds and PM2 reloads without reinstalling dependencies.

test: Add GM authentication logic test

- Created test-gm-auth.js to verify the correctness of GM authentication logic with various test cases.
2025-08-17 18:15:39 +02:00
caf8a03553 feat: Add scripts for upserting and validating bestiary data
- Implemented `upsert-allewis-from-5001.js` to fetch and update Allewis data from API.
- Created `upsert-missing-movement-from-5001.js` to fill missing movement and wounds data from API.
- Developed `upsert-missing-movement-from-pdfs.js` to extract movement and wounds from PDF text.
- Added `upsert-missing-profiles-from-pdfs.js` to fill missing profiles from PDF data.
- Introduced `upsert-missing-wounds-from-pdfs.js` to update wounds data from PDF sources.
- Created `validate-bestiary.js` to validate the structure of the bestiary JSON.
- Updated `BestiaryTab.jsx` component to display bestiary data with improved structure and search functionality.
- Added tests for `BestiaryTab` to ensure proper rendering and functionality.
2025-08-17 16:21:00 +02:00
671865d100 feat: enhance build process and testing workflow
- Updated package.json scripts to include separate unit and integration tests before building.
- Added a new script `test-build-test` to run tests before and after the build process.
- Introduced a new local CI/CD script for streamlined local development and testing.
- Refactored PlayerTab component to normalize skills data structure and added tooltips for Space Marine and Power Armour abilities.
- Added named export for Tooltip in DeathwatchRoller for reuse in other components.
2025-08-16 15:14:28 +02:00
b6320ceff6 Remove MongoDB; add PM2 scripts, CI, tests; fix PlayerTab hooks; add pm2 smoke-test 2025-08-16 13:01:30 +02:00
fe3a57a9c9 feat: Enhance player validation by using hashed passwords and update player routes to avoid storing plaintext passwords 2025-08-16 12:24:14 +02:00
dde3abda55 feat: Add validation and normalization utilities for player records
- Implemented `validatePlayer` and `normalizeTabInfo` functions in `database/validate.js` for player data validation and normalization.
- Added error handling for required fields and enforced data types and constraints.
- Introduced standardization for characteristics and skills.

feat: Create script for extracting rules from PDF files

- Developed `extract-rules.js` to extract text from PDF rulebooks and categorize rules.
- Integrated `pdftotext` for PDF processing and created a searchable rules database.
- Implemented rule categorization and indexing for efficient searching.

feat: Implement RulesTab component for rule searching

- Created `RulesTab.jsx` for searching and displaying rules with filtering options.
- Added recent searches and quick reference buttons for user convenience.
- Integrated API calls for fetching rules and displaying results dynamically.

feat: Add test script for Rules API

- Created `test-rules.js` to test the functionality of the Rules API endpoints.
- Included tests for search and stats endpoints to ensure proper response handling.
2025-08-16 12:15:32 +02:00
ec487b0614 Enhance session management and player data handling
- Updated `requireSession.js` to ensure `req.body` and `req.query` are always objects before access, improving robustness against malformed requests.
- Changed API endpoint for login from `/api/sessions/login` to `/api/players/login` in `App.js`, updating related logging and state management to reflect the new structure.
- Enhanced player fetching logic in `PlayerTab.jsx` to handle cases where GM is logged in, ensuring all players are fetched from the API. Added debug logging for better traceability.
- Implemented fallback to stored player data if API fetch fails, ensuring a smoother user experience for regular players.
- Updated local storage handling to accommodate changes in player data structure.
2025-08-16 00:06:50 +02:00