Commit Graph

136 Commits

Author SHA1 Message Date
Michess
0b3228c9d7 feat: live game tiles on homepage + bot spectating
- GET /v1/games/live returns all active games with both players assigned,
  including current FEN (computed server-side via chess.js)
- LiveGames component on homepage: mini chessboard tiles (160px) that
  auto-refresh every 3s, clickable to join as spectator
- Tournament page: 'Zuschauen' button for non-players on ongoing rounds
  (bot vs bot, human vs human, human vs bot all spectatable)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 08:03:26 +02:00
Michess
86fbdd39ed fix: resolve all 3 open Gitea issues
Issue #1 - Bot vs Bot Turnierspiele:
- triggerBotMove ruft sich rekursiv selbst auf wenn der nächste Spieler
  auch ein Bot ist (bot vs bot läuft jetzt vollautomatisch durch)
- startNextRoundGames erstellt aktive Spiele für die nächste Runde wenn
  eine Runde endet; bot vs bot Spiele starten sofort ohne Spectator
- updateRoundResult gibt jetzt die nächste Runden-Daten zurück statt void
- Alle Handler (sendMove, claimAbandoned, claimTimeout, triggerBotMove)
  starten die nächste Runde automatisch

Issue #2 - Bot-Schwierigkeit zu hoch:
- randomChance zu StockfishLevel hinzugefügt: Level 1=80%, 2=50%,
  3=15%, 4=3%, 5-6=0% zufällige Züge statt Stockfish-Best-Move
- Gilt sowohl für Socket-Bot-Züge als auch /v1/ai/move REST-Endpoint

Issue #3 - Turnier beenden + Zurück-Button:
- POST /:code/cancel Endpoint (nur Host), setzt status='finished'
- Turnier-Seite: 'Turnier beenden' Button für Host (rot, outline)
- tournamentCode Feld im Game-Typ; wird beim Erstellen von Turnierspielen
  gesetzt (inkl. Folgerunden)
- GamePage zeigt '← Zur Turnierübersicht' Link wenn tournamentCode gesetzt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 07:46:40 +02:00
Michess
536160bba6 feat(elo): add ELO rating system
- DB: elo column on user table (default 1200, added via ALTER TABLE IF NOT EXISTS)
- ELO calculated after every game save (K=32, min 100)
- Bots use their fixed ELO values; only human players' ELO changes
- AI page games save with bot name (e.g. 'Holzpferd Heinz') instead of 'Stockfish'
- User profile shows ELO badge below name
- Header shows current ELO for logged-in users (links to profile)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 07:32:57 +02:00
Michess
157c14c11e feat(bots): add named bot profiles with ELO-based difficulty
- 5 bot profiles (Holzpferd Heinz to Meister Magnus, ELO 200-1400) in
  server/bots.ts and client/bots.ts with emoji + descriptions
- Bot users auto-created in DB on server startup (role='bot')
- AI page replaced difficulty buttons with bot profile cards
- Tournament host can add bots via dropdown (POST /:code/add-bot)
- Bot auto-moves triggered on joinLobby and after each human move
- Fixed clock start order so bot-as-white games initialize correctly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 13:32:43 +02:00
Michess
4825a57a54 feat: add real-time notification system and fix admin login bug
- Fix login: role field was missing from session (admin page inaccessible)
- Add onlineUsers map in socket/state.ts to track connected users
- Join personal user:${id} socket room on connect for targeted notifications
- Emit friendRequestReceived/friendRequestAccepted socket events from friends controller
- Add sendGameInvite socket event handler on server
- New NotificationContext: global socket provider for registered users
- New NotificationPanel: bell icon with unread badge and dropdown in header
- Friends page: inline game invite input per friend with sendGameInvite

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 12:35:09 +02:00
Michess
aeb5fe313e feat: add time controls, correspondence games, and tournament mode
**Zeitmodi (Blitz/Rapid):**
- 5, 10, 30 Min Zeitkontrolle bei Spielerstellung
- Server-seitige Uhren: Zeit wird bei jedem Zug abgezogen
- Timeout-Erkennung via claimTimeout Socket-Event
- Schachuhr-Anzeige in GamePage (rot bei < 30s)
- Turnierspiele erhalten automatisch Zeitkontrolle

**Tagespartien (Correspondence):**
- Neue DB-Tabelle correspondence_game
- REST API: erstellen, beitreten, Zug machen, aufgeben
- Seite /correspondence: Liste aktiver Tagespartien
- Seite /correspondence/[code]: Spielen mit interaktivem Brett
- Einladungslink teilen, Gegner tritt via Link bei

**Turniermodus (Round-Robin):**
- Neue DB-Tabellen: tournament, tournament_player, tournament_round
- Round-Robin Paarungen mit Circle-Methode
- Turnier erstellen: /tournament/create
- Turnierliste: /tournament
- Turnierseite /tournament/[code]: Standings, Runden, Spiele
- Automatische Aktivisierung der nächsten Runde
- Turnierspiele werden als normale activeGames erstellt
- Ergebnisse aktualisieren Punkte automatisch

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 09:44:35 +02:00
Michess
0cc5a8e99c fix(ai): fix database model mapping for AI matches and missing AI names 2026-04-13 15:06:45 +02:00
Michess
f7b87f2941 fix: use existsSync instead of require(fs) in ESM module 2026-04-13 14:25:31 +02:00
Michess
4bc6ea58e6 fix: handle stockfish process error, try /usr/games/stockfish path 2026-04-13 14:19:58 +02:00
Michess
ebbc8227fd fix: use native stockfish binary via debian image 2026-04-13 13:40:21 +02:00
Michess
6b676d3015 fix: use child_process to spawn stockfish via stdin/stdout 2026-04-13 13:33:26 +02:00
Michess
694177c108 feat: Vollständiges Rebranding zu MiChess, Copyright Tom Misch
- Alle @chessu/ → @michess/ (Package-Namen und Imports)
- Theme-Namen chessuDark/Light → michessDark/Light
- Alle Display-Texte: chessu/Michess → MiChess
- Autor: dotnize → Tom Misch
- Copyright: Nathaniel Tampus → Tom Misch
- README komplett neu (Deutsch, MiChess-spezifisch)
- CONTRIBUTING.md neu
- FUNDING.yml + CODE_OF_CONDUCT.md entfernt
- Fork-Hinweis auf chessu bleibt im README erhalten (MIT-Pflicht)
- pnpm-lock.yaml entfernt (wird beim Build neu generiert)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 10:47:16 +02:00
Michess
b79a442b0c fix: TypeScript-Fehler behoben (stockfish types, null-Typ) 2026-04-13 10:30:54 +02:00
Michess
50464981c2 fix: Stockfish via npm-Paket statt Alpine apk
- stockfish als npm dependency (kein apk add nötig, portabel)
- Dockerfile: nur noch git via apk, kein stockfish
- docker-compose.yml: version-Zeile entfernt (veraltet)
- Controller auf npm-Package-API umgeschrieben (postMessage/onmessage)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 10:23:33 +02:00
Michess
7dac042d73 feat: Michess – Initiales Setup auf Basis von chessu
- Rebranding: chessu → Michess (Header, Footer, Metadata, Session-Cookie)
- Stockfish KI-Integration: 6 Schwierigkeitsgrade (Anfänger bis Meister)
- Admin-Panel: Nutzerverwaltung, Sperren/Entsperren, Git-Pull-Update
- Freundessystem: Anfragen, Freundesliste, Nutzersuche
- DB-Schema: role, banned, friend_request, friendship Tabellen
- Docker: NAS-optimiertes docker-compose.yml mit PostgreSQL Healthcheck
- Stockfish binary via apk im Alpine-Image installiert
- .env.example für einfaches Deployment
- scripts/update.sh für manuelles NAS-Update
- Brain.md + Plan.md als Projekt-Gedächtnis

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 10:02:52 +02:00
Nathaniel Tampus
2ac873c5b1 update to node 20 & pnpm 9 2024-07-14 14:35:37 +08:00
Nathaniel Tampus
394644bc81 update deps 2024-01-15 19:54:50 +08:00
Nathaniel Tampus
d20ad3418a next 14, update deps 2023-11-20 17:30:40 +08:00
Nathaniel Tampus
7d8d8850c0 add isolated install scripts for each workspace 2023-10-09 12:15:50 +08:00
Nathaniel Tampus
93d991a9b2 fix scripts for workspace-specific installs 2023-10-09 11:59:53 +08:00
Nathaniel Tampus
50bdd80d07 update deps 2023-10-09 11:02:49 +08:00
Nathaniel Tampus
b4c1ee4db5 update deps 2023-09-29 23:13:27 +08:00
Nathaniel Tampus
7086ed0b56 update deps 2023-08-25 18:53:58 +08:00
Nathaniel Tampus
f245060075 update deps 2023-08-17 21:20:03 +08:00
Nathaniel Tampus
98d5490de6 update deps 2023-08-16 13:19:01 +08:00
Nathaniel Tampus
c591415e3d fix registration for empty email 2023-08-11 20:46:02 +08:00
Nathaniel Tampus
0dfb8bafd5 update deps 2023-08-08 13:46:54 +08:00
Nathaniel Tampus
efc2492275 add separate install scripts for each package 2023-07-27 18:07:01 +08:00
Nathaniel Tampus
2aea4af121 only run separate install scripts in root dir 2023-07-27 17:47:28 +08:00
Nathaniel Tampus
3e3b18b493 add install scripts for separate deployments 2023-07-27 17:33:27 +08:00
Nathaniel Tampus
2238038c95 update eslint configs 2023-07-27 15:02:34 +08:00
Nathaniel Tampus
a87cf86239 update deps 2023-07-27 14:53:25 +08:00
Nathaniel Tampus
0d9cfd8f61 update default session secret 2023-07-01 19:50:27 +08:00
Nathaniel Tampus
70637a384d add cleanup comment 2023-07-01 19:49:19 +08:00
Nathaniel Tampus
88c86025f4 update deps 2023-07-01 19:39:28 +08:00
Nathaniel Tampus
cf63f73280 fix registration for empty email 2023-06-19 21:57:03 +08:00
Nathaniel Tampus
dd48e3a890 update deps 2023-06-19 21:56:15 +08:00
Nathaniel Tampus
ad7bf5a989 update deps 2023-06-13 11:21:02 +08:00
Nathaniel Tampus
22f6bddd6a update deps 2023-05-19 19:58:40 +08:00
Nathaniel Tampus
c71ee3056d fix eslint config 2023-05-12 19:23:00 +08:00
Nathaniel Tampus
ace693044c update deps 2023-05-12 19:20:47 +08:00
Nathaniel Tampus
ee5c5d37a4 remove unused update query from game model 2023-05-06 20:23:58 +08:00
Nathaniel Tampus
3a03c37e1d cleanup 2023-05-06 20:19:53 +08:00
Nathaniel Tampus
08f004d5e9 update deps 2023-05-06 19:47:15 +08:00
Nathaniel Tampus
da7f88e790 remove log when joining nonexistent lobby 2023-05-01 21:08:51 +08:00
Nathaniel Tampus
da7b4c40a3 organize imports 2023-05-01 15:15:49 +08:00
Nathaniel Tampus
e38420c390 update deps 2023-05-01 15:01:24 +08:00
Nathaniel Tampus
6a0f2db718 use double quotes for tsc-watch onSuccess 2023-04-22 12:42:13 +08:00
Nathaniel Tampus
28152de22e replace ts-node with tsc-watch for server dev 2023-04-21 22:20:59 +08:00
Nathaniel Tampus
5cda61ede8 update deps 2023-04-21 21:45:42 +08:00