Web version: the engine's location as a type, the browser's history and Back, the question on leaving, the draft of an unsaved game

EngineLocation: an engine starts from its program on a computer, from the
address of its Web Worker's script in a browser; analysis, the review job,
the judge and the settings take it instead of a path.

platform::page: a game on the screen is an entry of the browser's history,
so Back is «← Library» (with the same questions); unsaved changes or a
running review make the browser ask before the page is left. The draft of an
unsaved game is written every 5 s while it has changes and offered at the
next start (Open / Delete); a saved or left game takes it away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-30 17:35:30 +03:00
parent 3afeee09c7
commit 000821887f
15 changed files with 338 additions and 42 deletions

View file

@ -53,22 +53,22 @@ impl EngineConfig {
/// Executable to start; `None` if ChessPenguin's Stockfish is neither bundled nor
/// downloaded yet (it is offered for download then).
pub fn executable(&self) -> Option<PathBuf> {
pub fn executable(&self) -> Option<crate::engines::EngineLocation> {
if self.builtin {
crate::engines::own_stockfish()
} else {
Some(self.path.clone())
// A browser runs no engine programs: there are none but its own.
#[cfg(not(web))]
return Some(crate::engines::EngineLocation::Program(self.path.clone()));
#[cfg(web)]
None
}
}
/// Whether the engine can be started: ChessPenguin's Stockfish is there (in a
/// browser: downloaded into it), or the file of another engine.
pub fn present(&self) -> bool {
if self.builtin {
crate::engines::own_stockfish().is_some()
} else {
self.path.is_file()
}
self.executable().is_some_and(|l| l.present())
}
}