From cb70e4926453def637bc08cbc67a38b7111a5970 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Sat, 18 Jul 2026 14:19:35 +0700 Subject: [PATCH] fix --- web/Cargo.toml | 19 ++++++------------- web/rust-toolchain.toml | 4 ++++ web/src/lib.rs | 15 ++------------- 3 files changed, 12 insertions(+), 26 deletions(-) create mode 100644 web/rust-toolchain.toml diff --git a/web/Cargo.toml b/web/Cargo.toml index 5d45141..a3cd061 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -19,25 +19,18 @@ relay_auth = { path = "../crates/relay_auth" } gpui.workspace = true gpui_platform.workspace = true -gpui_tokio.workspace = true gpui_web = { git = "https://github.com/zed-industries/zed" } -nostr-connect.workspace = true nostr-sdk.workspace = true - -anyhow.workspace = true -serde.workspace = true -serde_json.workspace = true -itertools.workspace = true log.workspace = true -smallvec.workspace = true -smol.workspace = true -futures.workspace = true -oneshot.workspace = true -webbrowser.workspace = true -tracing-subscriber.workspace = true console_error_panic_hook = "0.1" tracing-wasm = "0.2" console_log = "1.0" wasm-bindgen = "0.2" + +[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom_0_2 = { package = "getrandom", version = "0.2", features = ["js"] } +getrandom_0_3 = { package = "getrandom", version = "0.3", features = ["wasm_js"] } +getrandom_0_4 = { package = "getrandom", version = "0.4", features = ["wasm_js"] } +tokio = { version = "1", default-features = false, features = ["sync", "macros", "io-util", "rt", "time"] } diff --git a/web/rust-toolchain.toml b/web/rust-toolchain.toml new file mode 100644 index 0000000..5fe1a59 --- /dev/null +++ b/web/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "nightly" +components = ["rustfmt", "clippy"] +targets = ["wasm32-unknown-unknown"] diff --git a/web/src/lib.rs b/web/src/lib.rs index 1eb55a8..98b82cc 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -15,21 +15,9 @@ pub fn run() -> Result<(), JsValue> { #[cfg(target_family = "wasm")] gpui_platform::web_init(); - #[cfg(not(target_family = "wasm"))] - let app = gpui_platform::application(); - - #[cfg(target_family = "wasm")] - let app = gpui_platform::single_threaded_web(); - - app.run(|cx| { + gpui_platform::application().run(|cx| { cx.open_window(WindowOptions::default(), |window, cx| { - // Bring the app to the foreground - cx.activate(true); - cx.new(|cx| { - // Initialize the tokio runtime - gpui_tokio::init(cx); - // Initialize components ui::init(cx); @@ -61,6 +49,7 @@ pub fn run() -> Result<(), JsValue> { }) }) .expect("Failed to open window. Please restart the application."); + cx.activate(true); }); Ok(())