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
+2
View File
@@ -3,8 +3,10 @@ use std::collections::HashMap;
use anyhow::{Error, anyhow};
#[cfg(not(target_arch = "wasm32"))]
use browser_signer_proxy::prelude::*;
#[cfg(not(target_arch = "wasm32"))]
use common::config_dir;
use gpui::{App, AppContext, Context, Entity, EventEmitter, Global, Task, Window};
#[cfg(not(target_arch = "wasm32"))]
use gpui_tokio::Tokio;
use instant::Duration;
use nostr_connect::prelude::*;
+3 -2
View File
@@ -14,15 +14,16 @@ chat = { path = "../chat" }
chat_ui = { path = "../chat_ui" }
settings = { path = "../settings" }
person = { path = "../person" }
auto_update = { path = "../auto_update" }
gpui.workspace = true
nostr-sdk.workspace = true
instant.workspace = true
nostr-connect.workspace = true
browser-signer-proxy = { path = "../browser-signer-proxy" }
anyhow.workspace = true
serde.workspace = true
log.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>) {
self.loading = status;
cx.notify();
@@ -266,7 +271,7 @@ impl Render for ImportIdentity {
this.login(window, cx);
})),
)
.child(divider(cx))
.when(cfg!(target_arch = "wasm32"), |this| this.child(divider(cx)))
.when(!is_wasm, |this| {
this.child(
Button::new("proxy")
+34 -17
View File
@@ -2,6 +2,7 @@ use std::sync::Arc;
use ::settings::AppSettings;
use anyhow::Error;
#[cfg(not(target_arch = "wasm32"))]
use auto_update::AutoUpdater;
use chat::{ChatEvent, ChatRegistry};
use common::{CoopImageCache, download_dir};
@@ -379,6 +380,7 @@ impl Workspace {
Command::ImportEncryption => {
self.import_encryption(window, cx);
}
#[cfg(not(target_arch = "wasm32"))]
Command::Update => {
let auto_updater = AutoUpdater::global(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 name = name.clone();
this.min_w(px(256.))
let menu = this
.min_w(px(256.))
.item(PopupMenuItem::element(move |_window, cx| {
h_flex()
.gap_1p5()
@@ -593,24 +599,27 @@ impl Workspace {
IconName::Sun,
Box::new(Command::ToggleTheme),
)
.separator()
.menu_with_icon(
"Check for Updates",
IconName::Device,
Box::new(Command::Update),
)
.menu_with_icon(
"Settings",
IconName::Settings,
Box::new(Command::ShowSettings),
)
.separator();
// Auto-update is a desktop-only feature; there is no updater in the browser.
#[cfg(not(target_arch = "wasm32"))]
let menu = menu.menu_with_icon(
"Check for Updates",
IconName::Device,
Box::new(Command::Update),
);
menu.menu_with_icon(
"Settings",
IconName::Settings,
Box::new(Command::ShowSettings),
)
}),
)
})
}
fn titlebar_right(&mut self, cx: &mut Context<Self>) -> impl IntoElement {
let updater = AutoUpdater::global(cx);
let chat = ChatRegistry::global(cx);
let nip4e_enabled = AppSettings::get_nip4e(cx);
let nostr = NostrRegistry::global(cx);
@@ -622,15 +631,23 @@ impl Workspace {
let persons = PersonRegistry::global(cx);
let profile = persons.read(cx).get(&public_key, cx);
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())
.gap_2()
.when(!updater_idle, |this| {
.gap_2();
// 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);
this.child(div().text_xs().italic().child(status))
})
};
titlebar
.when(nip4e_enabled, |this| {
this.child(
Button::new("key")