fix build

This commit is contained in:
2026-08-31 17:23:59 +07:00
parent ff20e51729
commit 963a641f39
6 changed files with 106 additions and 83 deletions
Generated
-1
View File
@@ -8929,7 +8929,6 @@ version = "1.0.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"auto_update", "auto_update",
"browser-signer-proxy",
"chat", "chat",
"chat_ui", "chat_ui",
"common", "common",
+61 -62
View File
@@ -1,62 +1,61 @@
[workspace] [workspace]
resolver = "2" resolver = "2"
members = ["crates/*", "desktop", "web"] members = ["crates/*", "desktop", "web"]
default-members = ["desktop"] default-members = ["desktop"]
[workspace.package] [workspace.package]
version = "1.0.0" version = "1.0.0"
edition = "2024" edition = "2024"
publish = false publish = false
[workspace.dependencies] [workspace.dependencies]
# GPUI # GPUI
gpui = { git = "https://github.com/zed-industries/zed" } gpui = { git = "https://github.com/zed-industries/zed" }
gpui_platform = { git = "https://github.com/zed-industries/zed", features = ["font-kit", "x11", "wayland"] } gpui_platform = { git = "https://github.com/zed-industries/zed", features = ["font-kit", "x11", "wayland"] }
gpui_linux = { git = "https://github.com/zed-industries/zed" } gpui_linux = { git = "https://github.com/zed-industries/zed" }
gpui_windows = { git = "https://github.com/zed-industries/zed" } gpui_windows = { git = "https://github.com/zed-industries/zed" }
gpui_macos = { git = "https://github.com/zed-industries/zed" } gpui_macos = { git = "https://github.com/zed-industries/zed" }
gpui_tokio = { git = "https://github.com/zed-industries/zed" } gpui_tokio = { git = "https://github.com/zed-industries/zed" }
reqwest_client = { git = "https://github.com/zed-industries/zed" } reqwest_client = { git = "https://github.com/zed-industries/zed" }
# Nostr # Nostr
nostr-lmdb = { git = "https://github.com/rust-nostr/nostr" } nostr-lmdb = { git = "https://github.com/rust-nostr/nostr" }
nostr-memory = { git = "https://github.com/rust-nostr/nostr" } nostr-memory = { git = "https://github.com/rust-nostr/nostr" }
nostr-blossom = { git = "https://github.com/rust-nostr/nostr" } nostr-blossom = { git = "https://github.com/rust-nostr/nostr" }
nostr-gossip-memory = { git = "https://github.com/rust-nostr/nostr" } nostr-gossip-memory = { git = "https://github.com/rust-nostr/nostr" }
nostr-connect = { git = "https://github.com/rust-nostr/nostr" } nostr-connect = { git = "https://github.com/rust-nostr/nostr" }
nostr-sdk = { git = "https://github.com/rust-nostr/nostr" } nostr-sdk = { git = "https://github.com/rust-nostr/nostr" }
nostr = { git = "https://github.com/rust-nostr/nostr", features = [ "nip59", "nip49", "nip44" ] } nostr = { git = "https://github.com/rust-nostr/nostr", features = [ "nip59", "nip49", "nip44" ] }
# Others # Others
anyhow = "1.0.44" anyhow = "1.0.44"
chrono = { version = "0.4.38", features = ["wasmbind"] } chrono = { version = "0.4.38", features = ["wasmbind"] }
futures = "0.3" futures = "0.3"
itertools = "0.13.0" itertools = "0.13.0"
log = "0.4" log = "0.4"
oneshot = "0.1.10" oneshot = "0.1.10"
flume = { version = "0.11.1", default-features = false, features = ["async", "select"] } flume = { version = "0.11.1", default-features = false, features = ["async", "select"] }
rust-embed = { version = "8.5", features = ["include-exclude"] } rust-embed = { version = "8.5", features = ["include-exclude"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
schemars = "1" schemars = "1"
smallvec = "1.14.0" smallvec = "1.14.0"
smol = "2" smol = "2"
webbrowser = "1.0.4" webbrowser = "1.0.4"
tracing-subscriber = { version = "0.3.18", features = ["fmt"] } tracing-subscriber = { version = "0.3.18", features = ["fmt"] }
errno = { version = "0.3.14", default-features = false } instant = "0.1"
instant = "0.1"
[patch.crates-io]
[patch.crates-io] # Use stacker's psm version which may have better WASM support
# Use stacker's psm version which may have better WASM support psm = { git = "https://github.com/rust-lang/stacker", branch = "master" }
psm = { git = "https://github.com/rust-lang/stacker", branch = "master" }
[profile.release]
[profile.release] strip = true
strip = true opt-level = "z"
opt-level = "z" lto = true
lto = true codegen-units = 1
codegen-units = 1 panic = "abort"
panic = "abort"
[profile.profiling]
[profile.profiling] inherits = "release"
inherits = "release" debug = true
debug = true
+2
View File
@@ -3,8 +3,10 @@ use std::collections::HashMap;
use anyhow::{Error, anyhow}; use anyhow::{Error, anyhow};
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use browser_signer_proxy::prelude::*; use browser_signer_proxy::prelude::*;
#[cfg(not(target_arch = "wasm32"))]
use common::config_dir; use common::config_dir;
use gpui::{App, AppContext, Context, Entity, EventEmitter, Global, Task, Window}; use gpui::{App, AppContext, Context, Entity, EventEmitter, Global, Task, Window};
#[cfg(not(target_arch = "wasm32"))]
use gpui_tokio::Tokio; use gpui_tokio::Tokio;
use instant::Duration; use instant::Duration;
use nostr_connect::prelude::*; use nostr_connect::prelude::*;
+3 -2
View File
@@ -14,15 +14,16 @@ chat = { path = "../chat" }
chat_ui = { path = "../chat_ui" } chat_ui = { path = "../chat_ui" }
settings = { path = "../settings" } settings = { path = "../settings" }
person = { path = "../person" } person = { path = "../person" }
auto_update = { path = "../auto_update" }
gpui.workspace = true gpui.workspace = true
nostr-sdk.workspace = true nostr-sdk.workspace = true
instant.workspace = true instant.workspace = true
nostr-connect.workspace = true nostr-connect.workspace = true
browser-signer-proxy = { path = "../browser-signer-proxy" }
anyhow.workspace = true anyhow.workspace = true
serde.workspace = true serde.workspace = true
log.workspace = true log.workspace = true
smallvec.workspace = true smallvec.workspace = true
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
auto_update = { path = "../auto_update" }
+6 -1
View File
@@ -172,6 +172,11 @@ impl ImportIdentity {
}); });
} }
// The "Connect via Web Extension" button is hidden on wasm (`is_wasm`),
// so this stub is never invoked in the browser.
#[cfg(target_arch = "wasm32")]
fn proxy(&mut self, _cx: &mut Context<Self>) {}
fn set_loading(&mut self, status: bool, cx: &mut Context<Self>) { fn set_loading(&mut self, status: bool, cx: &mut Context<Self>) {
self.loading = status; self.loading = status;
cx.notify(); cx.notify();
@@ -266,7 +271,7 @@ impl Render for ImportIdentity {
this.login(window, cx); this.login(window, cx);
})), })),
) )
.child(divider(cx)) .when(cfg!(target_arch = "wasm32"), |this| this.child(divider(cx)))
.when(!is_wasm, |this| { .when(!is_wasm, |this| {
this.child( this.child(
Button::new("proxy") Button::new("proxy")
+34 -17
View File
@@ -2,6 +2,7 @@ use std::sync::Arc;
use ::settings::AppSettings; use ::settings::AppSettings;
use anyhow::Error; use anyhow::Error;
#[cfg(not(target_arch = "wasm32"))]
use auto_update::AutoUpdater; use auto_update::AutoUpdater;
use chat::{ChatEvent, ChatRegistry}; use chat::{ChatEvent, ChatRegistry};
use common::{CoopImageCache, download_dir}; use common::{CoopImageCache, download_dir};
@@ -379,6 +380,7 @@ impl Workspace {
Command::ImportEncryption => { Command::ImportEncryption => {
self.import_encryption(window, cx); self.import_encryption(window, cx);
} }
#[cfg(not(target_arch = "wasm32"))]
Command::Update => { Command::Update => {
let auto_updater = AutoUpdater::global(cx); let auto_updater = AutoUpdater::global(cx);
auto_updater.update(cx, |this, cx| { auto_updater.update(cx, |this, cx| {
@@ -387,6 +389,9 @@ impl Workspace {
}); });
}); });
} }
// Auto-update is a desktop-only feature; no-op in the browser.
#[cfg(target_arch = "wasm32")]
Command::Update => {}
} }
} }
@@ -563,7 +568,8 @@ impl Workspace {
let avatar = avatar.clone(); let avatar = avatar.clone();
let name = name.clone(); let name = name.clone();
this.min_w(px(256.)) let menu = this
.min_w(px(256.))
.item(PopupMenuItem::element(move |_window, cx| { .item(PopupMenuItem::element(move |_window, cx| {
h_flex() h_flex()
.gap_1p5() .gap_1p5()
@@ -593,24 +599,27 @@ impl Workspace {
IconName::Sun, IconName::Sun,
Box::new(Command::ToggleTheme), Box::new(Command::ToggleTheme),
) )
.separator() .separator();
.menu_with_icon(
"Check for Updates", // Auto-update is a desktop-only feature; there is no updater in the browser.
IconName::Device, #[cfg(not(target_arch = "wasm32"))]
Box::new(Command::Update), let menu = menu.menu_with_icon(
) "Check for Updates",
.menu_with_icon( IconName::Device,
"Settings", Box::new(Command::Update),
IconName::Settings, );
Box::new(Command::ShowSettings),
) menu.menu_with_icon(
"Settings",
IconName::Settings,
Box::new(Command::ShowSettings),
)
}), }),
) )
}) })
} }
fn titlebar_right(&mut self, cx: &mut Context<Self>) -> impl IntoElement { fn titlebar_right(&mut self, cx: &mut Context<Self>) -> impl IntoElement {
let updater = AutoUpdater::global(cx);
let chat = ChatRegistry::global(cx); let chat = ChatRegistry::global(cx);
let nip4e_enabled = AppSettings::get_nip4e(cx); let nip4e_enabled = AppSettings::get_nip4e(cx);
let nostr = NostrRegistry::global(cx); let nostr = NostrRegistry::global(cx);
@@ -622,15 +631,23 @@ impl Workspace {
let persons = PersonRegistry::global(cx); let persons = PersonRegistry::global(cx);
let profile = persons.read(cx).get(&public_key, cx); let profile = persons.read(cx).get(&public_key, cx);
let announcement = profile.announcement(); let announcement = profile.announcement();
let updater_idle = updater.read(cx).idle(cx);
h_flex() let titlebar = h_flex()
.when(!cx.theme().platform.is_mac(), |this| this.pr_2()) .when(!cx.theme().platform.is_mac(), |this| this.pr_2())
.gap_2() .gap_2();
.when(!updater_idle, |this| {
// Auto-update is a desktop-only feature; there is no updater in the browser.
#[cfg(not(target_arch = "wasm32"))]
let titlebar = {
let updater = AutoUpdater::global(cx);
let updater_idle = updater.read(cx).idle(cx);
titlebar.when(!updater_idle, |this| {
let status = updater.read(cx).status(cx); let status = updater.read(cx).status(cx);
this.child(div().text_xs().italic().child(status)) this.child(div().text_xs().italic().child(status))
}) })
};
titlebar
.when(nip4e_enabled, |this| { .when(nip4e_enabled, |this| {
this.child( this.child(
Button::new("key") Button::new("key")