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:
parent
a4445d2c15
commit
3e69a5d57c
61 changed files with 2628 additions and 552 deletions
|
|
@ -162,7 +162,7 @@ pub fn options(mode: Mode) -> WgpuConfiguration {
|
|||
/// and to stderr: a window that stops drawing says why there. One message repeated (a
|
||||
/// dropped frame each frame) is written once a minute with how many times it came.
|
||||
struct LibraryLog {
|
||||
last: std::sync::Mutex<Option<(String, std::time::Instant, u32)>>,
|
||||
last: std::sync::Mutex<Option<(String, web_time::Instant, u32)>>,
|
||||
/// `CP_LOG_FRAMES=1`: also how each frame reaches the screen (egui_wgpu's debug and
|
||||
/// trace messages: a frame skipped as "occluded" is said only there).
|
||||
frames: bool,
|
||||
|
|
@ -194,7 +194,7 @@ impl log::Log for LibraryLog {
|
|||
}
|
||||
eprintln!("{text}");
|
||||
log(&text);
|
||||
*last = Some((text, std::time::Instant::now(), 0));
|
||||
*last = Some((text, web_time::Instant::now(), 0));
|
||||
}
|
||||
|
||||
fn flush(&self) {}
|
||||
|
|
@ -227,8 +227,8 @@ pub fn log(line: &str) {
|
|||
if std::fs::metadata(&f).is_ok_and(|m| m.len() > 1 << 20) {
|
||||
let _ = std::fs::remove_file(&f);
|
||||
}
|
||||
let now = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
let now = web_time::SystemTime::now()
|
||||
.duration_since(web_time::UNIX_EPOCH)
|
||||
.map_or(0, |d| d.as_secs());
|
||||
if let Ok(mut file) = std::fs::OpenOptions::new()
|
||||
.create(true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue