Web version: ChessBase databases of several files and folders, a 2 GB limit with a polite refusal, messages without the page's paths

A .cbh chosen alone brings a window: its folder (Chrome, Edge:
showDirectoryPicker opening beside the file, the folder remembered; others:
webkitdirectory) or all its files; the files are grouped into databases by
name (chess_import::group_chosen), the reader opens a ChessBase one with
open_chessbase_owned. The user's files stay the browser's File objects: the
worker reads them, the page never holds a database's bytes; a kept copy
takes the whole database. Over 2 GB of the files read: refused with the way
to the desktop program. A reader out of memory says so in the user's words.
Paths like /opened/... are no longer shown (platform::files::shown).

chess-core: detect_letter_substitution decodes the text a piece at a time;
it held the whole text as chars (four times its size): a 1 GB cp1251 PGN
could not be read in a browser (capacity overflow) and cost gigabytes on a
computer. Now 1.95 GB opens in Firefox and Chromium.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-30 20:42:18 +03:00
parent bda92c5675
commit bc104c55b4
21 changed files with 1337 additions and 341 deletions

View file

@ -6,11 +6,17 @@
use wasm_bindgen::JsCast;
use wasm_bindgen::prelude::*;
/// The reader worker's work (`page/import-worker.js`): the database in the file `name`,
/// read and indexed away from the page (or only its games counted).
/// The reader worker's work (`page/import-worker.js`): one more file of the database
/// to read (its own file first) …
#[wasm_bindgen]
pub fn read_database(name: String, bytes: Vec<u8>, count: bool) -> JsValue {
chesspenguin_app::read_database(&name, bytes, count)
pub fn reader_give(name: String, bytes: Vec<u8>) {
chesspenguin_app::reader_give(name, bytes);
}
/// … and the database read and indexed away from the page (or only its games counted).
#[wasm_bindgen]
pub fn reader_read(count: bool) -> JsValue {
chesspenguin_app::reader_read(count)
}
/// Starts ChessPenguin in the page's canvas `canvas_id`. Resolves once the interface