Skip to content

Conversation

@maximedeprince
Copy link

Description

This PR implements a complete rewrite of the Chess.com presence.
The service has been renamed from Chess to Chess.com to match official branding. The codebase has been migrated from a monolithic file to a modular architecture using dedicated resolvers in sources/ for better maintainability and accuracy.

Key Changes:

  • Renaming: Service ID/Name changed to Chess.com.

  • Architecture: Split logic into specific resolvers (Game, Puzzle, TV, Analysis, etc.) instead of one large file.

  • Internationalization (i18n): Added full localization support via Chesscom.json, removing hardcoded English strings.

  • User Settings: Added new configurable options in the store:

  • Privacy Mode: Hides opponent details and specific game info.

  • Hide Buttons: Hides the "View Game" button.

  • Display Format: Customizes how names are shown (e.g., "Player vs Opponent").

  • Hide Rating: Hides ELO ratings from the presence.

  • Improved Detection: Now uses DOM-based scraping (checking for clocks, player names, game-over modals) rather than just URL detection to distinguish states like "Lobby", "Spectating", or "Playing".

  • Assets: Updated assets to high-resolution (512x512) standards.

Contributors:

  • @Linkredible

Acknowledgements

Screenshots

Proof showing the creation/modification is working as expected

♟️ Playing & Bots

Bot

🔍 Analysis & Variants

analysis variant analysis

🧩 Puzzles & Learning

puzzle

🎬 Media (Video)

video

🌐 Browsing & Social

Browsing friends

📜 Premid menu

image

## Summary
This PR performs a complete rewrite of the Chess.com presence. The service has been renamed from `Chess` to `Chess.com` to match the official branding. The code has been migrated from a monolithic `presence.ts` file to a modular architecture using dedicated resolvers for each section of the site.

## Key Changes

### 🏗 Architecture
- **Modular Structure:** Split logic into `sources/` (Game, Puzzles, TV, etc.) and `util/`.
- **TypeScript Interfaces:** Added strict typing for `AppStrings` and `Resolvers`.
- **DOM-based Detection:** Moved from simple URL detection to DOM scraping for more accurate states (e.g., distinguishing between "Playing", "Lobby", and "Spectating" on the same URL).

### ✨ New Features
- **User Settings:** Added configurable options in the store:
    - `Privacy Mode`: Hides opponent names and details.
    - `Hide Buttons`: Option to hide "View Game" buttons.
    - `Display Format`: Choose how player names are displayed (e.g., "Player vs Opponent").
    - `Hide Rating`: Option to hide ELO ratings.
- **Internationalization (i18n):** Full support for translations via `Chesscom.json` (replacing hardcoded strings).
- **Asset Updates:** Added high-resolution (512x512) assets for game modes and improved icons.

### 🎮 Enhanced Support
- **Live Games:** improved logic to detect game over, draws, and lobby states.
- **Puzzles:** Added support for Puzzle Rush (Survival/3min/5min) and Puzzle Battle with scores.
- **Computer:** Detects bot names, ratings, and player color (White/Black).
- **Media:** Better support for Chess TV (streamer name detection), Lessons, and Video library with timestamps.
- **Variants:** Dedicated resolver for 4 Player Chess and other variants.

## Contributors
- @Linkredible (Contributor)

## Notes
- The service ID/Name has been changed from `Chess` to `Chess.com`.
- This is a breaking change regarding the folder structure compared to the previous version.
Copilot AI review requested due to automatic review settings January 6, 2026 14:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a complete architectural rewrite of the Chess.com presence, transforming it from a monolithic structure to a modular resolver-based system. The service has been renamed from "Chess" to "Chess.com" to match official branding, with full internationalization support and new user privacy/customization settings.

Key Changes:

  • Modular architecture with dedicated resolver files for each feature area (Game, Puzzle, TV, Analysis, Computer, etc.)
  • Full i18n support via Chesscom.json localization file with 50+ translatable strings
  • New user settings: Privacy Mode, Hide Buttons, Display Format customization, and Hide Rating option

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
websites/C/Chess/presence.ts Deleted old monolithic implementation
websites/C/Chess.com/presence.ts New main presence entry point with resolver orchestration and settings integration
websites/C/Chess.com/metadata.json Updated service name to "Chess.com", added contributor, reset version to 1.0.0, and added user settings configuration
websites/C/Chess.com/Chesscom.json New i18n localization file with 50+ string keys for multilingual support
websites/C/Chess.com/util/index.ts Shared utilities including presence instance, asset URLs, player data extraction, and helper functions
websites/C/Chess.com/util/interfaces.ts TypeScript interfaces for AppStrings and Resolver pattern
websites/C/Chess.com/sources/analysis.ts Resolver for analysis board and game review detection
websites/C/Chess.com/sources/classroom.ts Resolver for classroom session detection
websites/C/Chess.com/sources/computer.ts Resolver for computer/bot games with side detection
websites/C/Chess.com/sources/friends.ts Resolver for friends list viewing
websites/C/Chess.com/sources/game.ts Core game resolver with state detection (playing, spectating, searching, etc.)
websites/C/Chess.com/sources/insights.ts Resolver for insights/statistics pages
websites/C/Chess.com/sources/learn.ts Resolver for lessons and courses
websites/C/Chess.com/sources/member.ts Resolver for user profile viewing
websites/C/Chess.com/sources/practice.ts Resolver for practice mode
websites/C/Chess.com/sources/puzzle.ts Resolver for puzzles, puzzle rush, and puzzle battle
websites/C/Chess.com/sources/tv.ts Resolver for Chess TV streaming with streamer name extraction
websites/C/Chess.com/sources/variants.ts Resolver for chess variants with game state detection
websites/C/Chess.com/sources/video.ts Resolver for video playback with timestamp tracking
Comments suppressed due to low confidence (3)

websites/C/Chess.com/metadata.json:70

  • The settings title fields use plain English strings rather than i18n keys. For consistency with PreMiD's multilanguage support, these should reference i18n keys (e.g., "chesscom.settings.privacy_mode") so they can be localized. The same applies to the "values" array in displayFormat setting.
    websites/C/Chess.com/metadata.json:24
  • The version has been reset from "1.3.0" to "1.0.0". Since this is a complete rewrite with breaking changes (service rename, new architecture), this version reset makes sense. However, be aware that users will need to reinstall the presence due to the service name change from "Chess" to "Chess.com".
    websites/C/Chess.com/metadata.json:26
  • Asset URLs in metadata.json still reference the old path "/C/Chess/assets/" but should be updated to "/C/Chess.com/assets/" to match the renamed directory structure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

maximedeprince and others added 2 commits January 6, 2026 16:03
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Maxime Deprince <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Maxime Deprince <[email protected]>
@theusaf theusaf changed the title feat(Chess.com): Rewrite, Rename & Modularization feat(Chess.com): rewrite and modularize Jan 10, 2026
I have addressed all the requested changes:

- **Assets**: Updated all asset links to use Imgur in `util/index.ts`.
- **Localization**: Renamed the localization file to `Chess.com.json` and corrected its structure to use `message` and `description` fields.
- **Code Optimization**:
  - Combined settings fetches using `Promise.all` in `presence.ts`.
  - Used generics for `getSetting` calls (e.g., `getSetting<boolean>`).
  - Used generics for `querySelector` calls (e.g., in `computer.ts`, `member.ts`, `tv.ts`) instead of type assertions.
- **Typing**: Added explicit `PresenceData` type annotation and handled the `clearActivity()` case when no details are present.
@maximedeprince
Copy link
Author

I have addressed all the requested changes:

  • Assets: Updated all asset links to use Imgur in util/index.ts.
  • Localization: Renamed the localization file to Chess.com.json and corrected its structure to use message and description fields.
  • Code Optimization:
    • Combined settings fetches using Promise.all in presence.ts.
    • Used generics for getSetting calls (e.g., getSetting<boolean>).
    • Used generics for querySelector calls (e.g., in computer.ts, member.ts, tv.ts) instead of type assertions.
  • Typing: Added explicit PresenceData type annotation and handled the clearActivity() case when no details are present.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Localization file should just be a dictionary of keys to message/description. There is no type, fileName, nor fullContent field.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants