Web version, stage 1: the interface as a library over a platform layer; apps/web

apps/desktop becomes a library (chesspenguin_app: the interface) and a thin
binary; apps/web starts the same interface in a page's canvas (eframe's
WebRunner). cfg(web) (build.rs) marks WebAssembly in a browser.

The platform layer (apps/desktop/src/platform): the program's folders, files,
background work, the files the user opens or saves, the clipboard and what
the platform offers (CAPS). On a computer it is the system as before; in a
browser the program's data lives in IndexedDB behind an in-memory file tree
loaded before the start, the files the user opens are read into it for the
session (only read), background jobs run on the page's thread after the
frame, the clipboard is read through the browser's API, sounds play through
audio elements, a game is saved as a download.

What a browser does not have is not built for it: updates, the online games
window and its probe, engine processes (analysis starts a Web Worker there;
the review and preparation jobs, Rodent and the judge are native), blocking
requests (engine, Maia and Rodent downloads report no download for the
platform, translation reports that it makes no requests). The desktop
program behaves as before; its build finds unused code (the web build
compiles parts it never shows).

apps/web: the entry point, the page /app/ (device check before anything large
is loaded: phones and tablets get the page about the apps in the site's nine
languages, keys app_* in website/site/i18n), build.sh (wasm-bindgen, profile
web), a static server and headless Firefox checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-30 15:09:17 +03:00
parent a4445d2c15
commit 3e69a5d57c
61 changed files with 2628 additions and 552 deletions

View file

@ -9,6 +9,16 @@ edition.workspace = true
rust-version.workspace = true
license.workspace = true
# The interface, shared with the web version (apps/web); src/main.rs starts it in a
# window.
[lib]
name = "chesspenguin_app"
path = "src/lib.rs"
[[bin]]
name = "chesspenguin"
path = "src/main.rs"
[dependencies]
chess-core.workspace = true
maia.workspace = true
@ -21,23 +31,15 @@ egui.workspace = true
eframe.workspace = true
egui_extras.workspace = true
image.workspace = true
rfd.workspace = true
arboard.workspace = true
rodio.workspace = true
directories.workspace = true
trainer.workspace = true
play.workspace = true
serde.workspace = true
serde_json.workspace = true
online-games.workspace = true
releases.workspace = true
# Downloading the official Stockfish on request (decision 14).
ureq = "3.4"
flate2 = "1.1"
tar = "0.4"
web-time.workspace = true
sha2 = "0.11"
zip = { version = "9.0.5", default-features = false, features = ["deflate-flate2-zlib-rs"] }
# The system language for the first start.
sys-locale = "0.3"
whatlang = "0.18.0"
@ -49,6 +51,37 @@ log = "0.4"
base64 = "0.22"
form_urlencoded = "1"
# The desktop program: native dialogs, the clipboard, sound, the network (updates,
# engines and Maia on request, online games, translation).
[target.'cfg(not(target_family = "wasm"))'.dependencies]
rfd.workspace = true
arboard.workspace = true
rodio.workspace = true
releases.workspace = true
# Downloading the official Stockfish on request (decision 14).
ureq = "3.4"
flate2 = "1.1"
tar = "0.4"
# The web version: the page, its files and storage (apps/web starts it).
[target.'cfg(target_family = "wasm")'.dependencies]
getrandom = { version = "0.3", features = ["wasm_js"] }
# The browser's languages for the first start.
sys-locale = { version = "0.3", features = ["js"] }
# Today's date from the browser's clock.
chrono = { version = "0.4", default-features = false, features = ["clock", "std", "wasmbind"] }
wasm-bindgen = "0.2.129"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
web-sys = { version = "0.3", features = [
"Window", "Document", "Element", "HtmlElement", "HtmlInputElement", "HtmlAnchorElement",
"File", "FileList", "Blob", "BlobPropertyBag", "Url", "Event", "Location", "Navigator",
"Storage", "UrlSearchParams", "EventTarget", "CssStyleDeclaration", "Clipboard",
"IdbFactory", "IdbDatabase", "IdbOpenDbRequest", "IdbRequest", "IdbTransaction",
"IdbTransactionMode", "IdbObjectStore", "DomStringList", "HtmlAudioElement",
"HtmlMediaElement", "HtmlCanvasElement", "console",
] }
[build-dependencies]
winresource = "0.1"