try fix build
Some checks failed
Pipeline: Test, Lint, Build / Get version info (push) Has been cancelled
Pipeline: Test, Lint, Build / Lint Go code (push) Has been cancelled
Pipeline: Test, Lint, Build / Test Go code (push) Has been cancelled
Pipeline: Test, Lint, Build / Test Go code (Windows) (push) Has been cancelled
Pipeline: Test, Lint, Build / Test JS code (push) Has been cancelled
Pipeline: Test, Lint, Build / Lint i18n files (push) Has been cancelled
Pipeline: Test, Lint, Build / Check Docker configuration (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (push) Has been cancelled
Pipeline: Test, Lint, Build / Push to GHCR (push) Has been cancelled
Pipeline: Test, Lint, Build / Push to Docker Hub (push) Has been cancelled
Pipeline: Test, Lint, Build / Cleanup digest artifacts (push) Has been cancelled
Pipeline: Test, Lint, Build / Build Windows installers (push) Has been cancelled
Pipeline: Test, Lint, Build / Package/Release (push) Has been cancelled
Pipeline: Test, Lint, Build / Upload Linux PKG (push) Has been cancelled

This commit is contained in:
Philip Peterson 2026-08-25 13:54:27 -08:00
parent 5696727a50
commit cee31c1e2c
4 changed files with 12 additions and 47 deletions

View file

@ -71,7 +71,10 @@ jobs:
shell: bash shell: bash
run: | run: |
cd ui cd ui
npm ci # --ignore-scripts skips the workbox postinstall (bin/update-workbox.sh),
# a bash script that fails under cmd.exe on Windows. It's only needed
# for the PWA service worker, which the desktop app doesn't use.
npm ci --ignore-scripts
npm run build npm run build
- name: Build Navidrome server binary - name: Build Navidrome server binary

View file

@ -2302,7 +2302,6 @@ checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
dependencies = [ dependencies = [
"bitflags 2.13.1", "bitflags 2.13.1",
"block2", "block2",
"libc",
"objc2", "objc2",
"objc2-core-foundation", "objc2-core-foundation",
] ]
@ -2745,7 +2744,6 @@ dependencies = [
"libc", "libc",
"objc2", "objc2",
"objc2-app-kit", "objc2-app-kit",
"objc2-foundation",
"objc2-web-kit", "objc2-web-kit",
"serde_json", "serde_json",
"tauri", "tauri",

View file

@ -24,9 +24,8 @@ libc = "0.2"
[target.'cfg(target_os = "macos")'.dependencies] [target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.6" objc2 = "0.6"
objc2-app-kit = { version = "0.3", features = ["NSApplication", "NSEvent", "NSWindow", "NSView"] } objc2-app-kit = { version = "0.3", features = ["NSApplication", "NSEvent"] }
objc2-web-kit = { version = "0.3", features = ["WKWebView"] } objc2-web-kit = { version = "0.3", features = ["WKWebView"] }
objc2-foundation = { version = "0.3", features = ["NSString", "NSArray"] }
block2 = "0.6" block2 = "0.6"
[features] [features]

View file

@ -135,44 +135,6 @@ fn layout(app: &tauri::AppHandle) {
} }
} }
/// Evaluates `js` on every WKWebView in the key window's view hierarchy. This
/// reaches the Web Inspector (devtools) webview too — which is not a
/// Tauri-managed webview — so select-all/undo/redo work in the console.
#[cfg(target_os = "macos")]
fn eval_js_on_focused_webviews(js: &str) {
use objc2::MainThreadMarker;
use objc2_app_kit::NSApplication;
use objc2_foundation::NSString;
let Some(mtm) = MainThreadMarker::new() else {
return;
};
let app = NSApplication::sharedApplication(mtm);
let Some(window) = app.keyWindow() else {
return;
};
let Some(content) = window.contentView() else {
return;
};
let js = NSString::from_str(js);
walk_and_eval(&content, &js);
}
#[cfg(target_os = "macos")]
fn walk_and_eval(view: &objc2_app_kit::NSView, js: &objc2_foundation::NSString) {
use objc2_web_kit::WKWebView;
if let Some(webview) = view.downcast_ref::<WKWebView>() {
unsafe {
webview.evaluateJavaScript_completionHandler(js, None);
}
}
for subview in view.subviews().iter() {
walk_and_eval(&subview, js);
}
}
/// Installs a local NSEvent monitor that intercepts Cmd+X/C/V/A/Z and /// Installs a local NSEvent monitor that intercepts Cmd+X/C/V/A/Z and
/// dispatches the matching native editing selector to the first responder. /// dispatches the matching native editing selector to the first responder.
/// ///
@ -181,7 +143,7 @@ fn walk_and_eval(view: &objc2_app_kit::NSView, js: &objc2_foundation::NSString)
/// this is the only reliable way to make cut/copy/paste work in the devtools /// this is the only reliable way to make cut/copy/paste work in the devtools
/// console. /// console.
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
fn install_edit_shortcut_monitor() { fn install_edit_shortcut_monitor(handle: &tauri::AppHandle) {
use objc2::runtime::{AnyObject, Sel}; use objc2::runtime::{AnyObject, Sel};
use objc2::MainThreadMarker; use objc2::MainThreadMarker;
use objc2_app_kit::{NSApplication, NSEvent, NSEventMask, NSEventModifierFlags}; use objc2_app_kit::{NSApplication, NSEvent, NSEventMask, NSEventModifierFlags};
@ -191,6 +153,7 @@ fn install_edit_shortcut_monitor() {
return; return;
}; };
let app = NSApplication::sharedApplication(mtm); let app = NSApplication::sharedApplication(mtm);
let handle = handle.clone();
let block = block2::RcBlock::new(move |event: NonNull<NSEvent>| -> *mut NSEvent { let block = block2::RcBlock::new(move |event: NonNull<NSEvent>| -> *mut NSEvent {
let event = unsafe { event.as_ref() }; let event = unsafe { event.as_ref() };
@ -232,7 +195,7 @@ fn install_edit_shortcut_monitor() {
} }
// selectAll:/undo:/redo: don't dispatch through the responder chain in // selectAll:/undo:/redo: don't dispatch through the responder chain in
// WKWebView, so drive the focused webview(s) via execCommand too — but // WKWebView, so drive the content webview via execCommand too — but
// only when an editable element is actually focused, otherwise we'd // only when an editable element is actually focused, otherwise we'd
// select the whole document. // select the whole document.
let js = match key.as_str() { let js = match key.as_str() {
@ -246,7 +209,9 @@ fn install_edit_shortcut_monitor() {
_ => None, _ => None,
}; };
if let Some(js) = js { if let Some(js) = js {
eval_js_on_focused_webviews(js); if let Some(content) = handle.get_webview("content") {
let _ = content.eval(js);
}
} }
std::ptr::null_mut() std::ptr::null_mut()
@ -321,7 +286,7 @@ pub fn run() {
enable_swipe_navigation(app.handle()); enable_swipe_navigation(app.handle());
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
install_edit_shortcut_monitor(); install_edit_shortcut_monitor(app.handle());
if let Some(toolbar) = app.get_webview("main") { if let Some(toolbar) = app.get_webview("main") {
let _ = toolbar.emit("url-changed", mask.mask(&navidrome_url)); let _ = toolbar.emit("url-changed", mask.mask(&navidrome_url));