diff --git a/package.json b/package.json index b6788ac..caa7ad6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "thing", "private": true, - "version": "26.9.3", + "version": "26.9.4", "type": "module", "scripts": { "dev": "vite", diff --git a/scripts/musicshow.ps1 b/scripts/musicshow.ps1 new file mode 100644 index 0000000..a420555 --- /dev/null +++ b/scripts/musicshow.ps1 @@ -0,0 +1,91 @@ +# SMTC full info query script (must run in Windows PowerShell 5.1) +# Output: EVERY session (not only GetCurrentSession), full media properties + +Add-Type -AssemblyName System.Runtime.WindowsRuntime -ErrorAction SilentlyContinue + +$null = [Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager, Windows.Media.Control, ContentType=WindowsRuntime] +$null = [Windows.Media.Control.GlobalSystemMediaTransportControlsSessionMediaProperties, Windows.Media.Control, ContentType=WindowsRuntime] +$null = [Windows.Storage.Streams.IInputStream, Windows.Storage.Streams, ContentType=WindowsRuntime] + +function Await($WinRtTask, $ResultType) { + $asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | + Where-Object { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0] + $asTaskGeneric = $asTask.MakeGenericMethod($ResultType) + $netTask = $asTaskGeneric.Invoke($null, @($WinRtTask)) + $netTask.Wait(-1) | Out-Null + $netTask.Result +} + +$mgr = Await ([Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager]::RequestAsync()) ([Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager]) +$current = $mgr.GetCurrentSession() + +# IVectorView 用 Size/GetAt 枚举:foreach 在 PS 5.1 上经常拿不到元素 +$sessions = New-Object System.Collections.ArrayList +try { + $raw = $mgr.GetSessions() + if ($null -ne $raw) { + $n = $raw.Size + for ($i = 0; $i -lt $n; $i++) { + [void]$sessions.Add($raw.GetAt($i)) + } + } +} catch { + Write-Host "GetSessions failed: $_" -ForegroundColor Red +} + +Write-Host "===== SMTC Sessions ($($sessions.Count)) =====" -ForegroundColor Cyan +$currentId = if ($current) { $current.SourceAppUserModelId } else { '' } +Write-Host "CurrentSession : $(if ($currentId) { $currentId } else { '(none)' })" -ForegroundColor Yellow +Write-Host "" + +if ($sessions.Count -eq 0) { + if ($current) { [void]$sessions.Add($current) } + else { + Write-Host "No SMTC media sessions found." -ForegroundColor Yellow + return + } +} + +$index = 0 +foreach ($session in $sessions) { + $index++ + $appId = $session.SourceAppUserModelId + $isCurrent = $currentId -and ($appId -eq $currentId) + $mark = if ($isCurrent) { " [CURRENT]" } else { "" } + + $props = $null + try { + $props = Await ($session.TryGetMediaPropertiesAsync()) ([Windows.Media.Control.GlobalSystemMediaTransportControlsSessionMediaProperties]) + } catch { + $props = $null + } + $playback = $session.GetPlaybackInfo() + $timeline = $session.GetTimelineProperties() + + $position = $timeline.Position + $duration = $timeline.EndTime - $timeline.StartTime + $progress = if ($duration.TotalSeconds -gt 0) { [math]::Round(($position.TotalSeconds / $duration.TotalSeconds) * 100, 1) } else { 0 } + + Write-Host ("----- Session #{0}{1} -----" -f $index, $mark) -ForegroundColor Cyan + Write-Host "App ID : $appId" + if ($props) { + Write-Host "Playback Type : $($props.PlaybackType)" + Write-Host "Title : $($props.Title)" + Write-Host "Subtitle : $($props.Subtitle)" + Write-Host "Artist : $($props.Artist)" + Write-Host "AlbumArtist : $($props.AlbumArtist)" + Write-Host "AlbumTitle : $($props.AlbumTitle)" + Write-Host "TrackNumber : $($props.TrackNumber)" + Write-Host "Genres : $($props.Genres -join ', ')" + $thumbnail = $props.Thumbnail + if ($thumbnail) { Write-Host "Thumbnail : (present)" } + else { Write-Host "Thumbnail : No thumbnail" } + } else { + Write-Host "MediaProperties: (failed to read)" + } + Write-Host "Playback Status: $($playback.PlaybackStatus)" + Write-Host "Progress : $position / $duration ($progress%)" + Write-Host "" +} + +Write-Host "===================================" -ForegroundColor Cyan diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 24f9f2a..36e9a43 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -104,6 +104,28 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "alsa" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812947049edcd670a82cd5c73c3661d2e58468577ba8489de58e1a73c04cbd5d" +dependencies = [ + "alsa-sys", + "bitflags 2.13.2", + "cfg-if", + "libc", +] + +[[package]] +name = "alsa-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad7569085a265dd3f607ebecce7458eaab2132a84393534c95b18dcbc3f31e04" +dependencies = [ + "libc", + "pkg-config", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -1153,6 +1175,50 @@ dependencies = [ "libc", ] +[[package]] +name = "coreaudio-rs" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5d7dca3ebcf65a035582c9ad4385371a9d9ee6537474d2a278f4e1e475bb58" +dependencies = [ + "bitflags 2.13.2", + "libc", + "objc2-audio-toolbox", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", +] + +[[package]] +name = "cpal" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f02e8d0327b42d3e2e4ab2119af397344eb9fc54a34bf0ddeaa1277af8681f1" +dependencies = [ + "alsa", + "block2", + "coreaudio-rs", + "dasp_sample", + "jni 0.22.4", + "js-sys", + "libc", + "mach2", + "ndk", + "ndk-context", + "num-derive", + "num-traits", + "objc2", + "objc2-audio-toolbox", + "objc2-avf-audio", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation", + "web-sys", + "windows 0.62.2", + "windows-core 0.62.2", +] + [[package]] name = "cpubits" version = "0.1.1" @@ -1430,6 +1496,12 @@ dependencies = [ "serde", ] +[[package]] +name = "dasp_sample" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" + [[package]] name = "data-encoding" version = "2.11.1" @@ -1940,6 +2012,12 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "extended" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365" + [[package]] name = "fallible-iterator" version = "0.3.0" @@ -3043,9 +3121,22 @@ checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" dependencies = [ "bytemuck", "byteorder-lite", + "image-webp", "moxcms", "num-traits", "png 0.18.1", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" +dependencies = [ + "byteorder-lite", + "quick-error", ] [[package]] @@ -3866,6 +3957,12 @@ dependencies = [ "uuid", ] +[[package]] +name = "mach2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b" + [[package]] name = "markup5ever" version = "0.38.0" @@ -4076,6 +4173,12 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + [[package]] name = "ndk-sys" version = "0.6.0+11769913" @@ -4181,7 +4284,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" dependencies = [ - "num-complex", + "num-complex 0.2.4", "num-integer", "num-iter", "num-rational", @@ -4226,12 +4329,32 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + [[package]] name = "num-conv" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.118", +] + [[package]] name = "num-integer" version = "0.1.47" @@ -4317,6 +4440,32 @@ dependencies = [ "objc2-foundation", ] +[[package]] +name = "objc2-audio-toolbox" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6948501a91121d6399b79abaa33a8aa4ea7857fe019f341b8c23ad6e81b79b08" +dependencies = [ + "bitflags 2.13.2", + "libc", + "objc2", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-avf-audio" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13a380031deed8e99db00065c45937da434ca987c034e13b87e4441f9e4090be" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-foundation", +] + [[package]] name = "objc2-cloud-kit" version = "0.3.2" @@ -4328,6 +4477,29 @@ dependencies = [ "objc2-foundation", ] +[[package]] +name = "objc2-core-audio" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1eebcea8b0dbff5f7c8504f3107c68fc061a3eb44932051c8cf8a68d969c3b2" +dependencies = [ + "dispatch2", + "objc2", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-audio-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a89f2ec274a0cf4a32642b2991e8b351a404d290da87bb6a9a9d8632490bd1c" +dependencies = [ + "bitflags 2.13.2", + "objc2", +] + [[package]] name = "objc2-core-data" version = "0.3.2" @@ -4345,7 +4517,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ "bitflags 2.13.2", + "block2", "dispatch2", + "libc", "objc2", ] @@ -5016,6 +5190,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "primal-check" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0d895b311e3af9902528fbb8f928688abbd95872819320517cc24ca6b2bd08" +dependencies = [ + "num-integer", +] + [[package]] name = "primefield" version = "0.14.0" @@ -5126,6 +5309,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + [[package]] name = "quick-xml" version = "0.41.0" @@ -5423,6 +5612,12 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "regex-lite" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" + [[package]] name = "regex-syntax" version = "0.8.11" @@ -5438,6 +5633,7 @@ dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", + "futures-channel", "futures-core", "futures-util", "h2", @@ -5764,6 +5960,20 @@ dependencies = [ "semver", ] +[[package]] +name = "rustfft" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21db5f9893e91f41798c88680037dba611ca6674703c1a18601b01a72c8adb89" +dependencies = [ + "num-complex 0.4.6", + "num-integer", + "num-traits", + "primal-check", + "strength_reduce", + "transpose", +] + [[package]] name = "rustix" version = "1.1.4" @@ -6621,6 +6831,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.9.0" @@ -6668,6 +6884,192 @@ dependencies = [ "serde_json", ] +[[package]] +name = "symphonia" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7edef6a96b696d4e0cab5ee9ebb7ca155ed95f30a6b45bbb8b97d2727f02424" +dependencies = [ + "lazy_static", + "symphonia-bundle-flac", + "symphonia-bundle-mp3", + "symphonia-codec-aac", + "symphonia-codec-adpcm", + "symphonia-codec-alac", + "symphonia-codec-pcm", + "symphonia-codec-vorbis", + "symphonia-core", + "symphonia-format-isomp4", + "symphonia-format-mkv", + "symphonia-format-ogg", + "symphonia-format-riff", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-bundle-flac" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6405d5c34ff6f8f7ca08a4101efe66d21e180f7322ef9359900a0e55698a7892" +dependencies = [ + "log", + "symphonia-common", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-bundle-mp3" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98ea5ffc8716bff677dfb3b01b420c7b758de901a72b8c330bf2040ab74b4add" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-aac" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5bf8e39552d34a3c4c98333370e62f48c92456d2e814f273b5c3ad7c4a5f45c" +dependencies = [ + "lazy_static", + "log", + "symphonia-common", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-adpcm" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445932ecb0c59362fde9c082dd63a75380650c5077fdb8b80b8cac850442a74c" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-alac" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "920a78f96f3cf62932d0c497959c0cc2100ef36b03c7ca1417b260f432a482d8" +dependencies = [ + "log", + "symphonia-common", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-pcm" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e04ba75686acbe43542fdd374571195f0530c0b7785ca25cc6840e9c6c4b6eea" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-vorbis" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73d90b4fcf796137cc683c538282804ff9629f8ad9dbfd881fcbba331ac4e986" +dependencies = [ + "log", + "symphonia-common", + "symphonia-core", +] + +[[package]] +name = "symphonia-common" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acc3fcc18ec9b8cdd48614e259c4cf0d27b71d41e5d9b120b42c5adab12d7c4" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-core" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c412864d599d4750d0c3d684d7e093ec05e5309681ef5252cc1096a437f6e0" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "lazy_static", + "log", + "num-complex 0.4.6", + "rustfft", + "smallvec", +] + +[[package]] +name = "symphonia-format-isomp4" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e681a70e1870d34e02abf1dbc51e4267c3f1827801474e8870be8c689fc4dc3" +dependencies = [ + "log", + "symphonia-common", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-format-mkv" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d015c5c0558864665894b3f4cbd95e10abb01b9c868e751c72670f326a56360e" +dependencies = [ + "lazy_static", + "log", + "symphonia-common", + "symphonia-core", +] + +[[package]] +name = "symphonia-format-ogg" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5495e7f7e3c7035328d82b6d6e377eef289bb0c4105bdeb557fc93a833f994" +dependencies = [ + "log", + "symphonia-common", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-format-riff" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ff70929083a8c1a5f6cd7c904b6071c7914ad04739b510c2f7239dfc9b7dabe" +dependencies = [ + "extended", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-metadata" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83713a97705d77bdef7cdbc0768fd6e5a54e4cd7e48d60a806ae85639e2c87c6" +dependencies = [ + "lazy_static", + "log", + "regex-lite", + "smallvec", + "symphonia-core", +] + [[package]] name = "syn" version = "1.0.109" @@ -7241,7 +7643,7 @@ dependencies = [ [[package]] name = "thing" -version = "26.9.3" +version = "26.9.4" dependencies = [ "aes 0.8.4", "async-trait", @@ -7250,6 +7652,7 @@ dependencies = [ "bytes", "cbc 0.1.2", "chrono", + "cpal", "dashmap", "dirs 5.0.1", "encoding_rs", @@ -7277,6 +7680,7 @@ dependencies = [ "specta", "specta-typescript", "ssh-key", + "symphonia", "sysinfo", "tauri", "tauri-build", @@ -7688,6 +8092,16 @@ dependencies = [ "once_cell", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "tray-icon" version = "0.24.1" @@ -9263,6 +9677,21 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "zune-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] + [[package]] name = "zvariant" version = "5.13.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 7cd1784..d6177cb 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thing" -version = "26.9.3" +version = "26.9.4" description = "A Tauri App" authors = ["you"] edition = "2021" @@ -35,7 +35,10 @@ specta = { version = "=2.0.0-rc.25", features = ["derive", "function", "serde_js specta-typescript = "0.0.12" tauri-specta = { version = "=2.0.0-rc.25", features = ["typescript"] } chrono = "0.4" -reqwest = { version = "0.12", features = ["json", "stream", "multipart"] } +# blocking:音乐播放引擎在**独立 std 线程**上解码(symphonia 的 MediaSource 是同步 +# Read+Seek),需要同步 HTTP 客户端去按 Range 拉 NAS 音频流。放在 std 线程上用 +# blocking 是安全的(在 tokio 运行时线程里用才会 panic)。 +reqwest = { version = "0.12", features = ["json", "stream", "multipart", "blocking"] } futures-util = "0.3" tokio = { version = "1", features = ["io-util", "time", "rt-multi-thread", "macros", "sync", "fs", "net"] } axum = "0.7" @@ -98,12 +101,22 @@ cbc = "0.1" rsa = { version = "0.9", features = ["pem"] } rand = "0.8" tokio-tungstenite = "0.24" -image = { version = "0.25", default-features = false, features = ["png"] } +image = { version = "0.25", default-features = false, features = ["png", "jpeg", "webp"] } walkdir = "2" notify = { version = "6", features = [] } librqbit = "9" bytes = "1" windows-capture = "2.0.1" +# 音频解码(纯 Rust)。**默认特性不含 mp3/aac/alac/isomp4**——0.6 起这几项被移出 +# default,必须显式打开,否则 mp3 与 m4a 直接报「不支持的格式」。 +# default 已含:flac / wav / ogg / vorbis / pcm / adpcm / mkv + 全部元数据。 +# 注意:`ape` 只是**元数据**特性(symphonia-metadata/ape),没有 APE 解码器; +# 也没有 opus 特性(ogg 里若是 Opus 轨道无法解码)。这两点已与用户确认接受。 +symphonia = { version = "0.6", features = ["mp3", "aac", "alac", "isomp4"] } +# 音频输出。Windows 走 WASAPI:cpal 的共享模式输出带 +# AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | SRC_DEFAULT_QUALITY,因此**可以用源采样率 +# 直接建流**,由 Windows 自己转换到设备混音格式 —— 不需要额外引入重采样库。 +cpal = "0.18" # HDR 截图说明:windows-capture 的 Windows Graphics Capture 后端在 HDR 显示器上 # 可能输出 scRGB / rgba16F 或 HDR10(PQ) 格式的帧,与项目其余截图路径 # (GDI BitBlt,sRGB 8bit)色彩空间不一致。capture 层统一转成 sRGB 8bit @@ -159,9 +172,19 @@ windows = { version = "0.52", features = [ "Globalization", "Graphics_Imaging", "Media_Ocr", + # 音乐模块:系统媒体传输控件(SMTC)。Windows.Media 提供 + # SystemMediaTransportControls / DisplayUpdater / MusicDisplayProperties / + # TimelineProperties;Win32_System_WinRT 提供桌面应用唯一的取用入口 + # ISystemMediaTransportControlsInterop::GetForWindow。 + # 之所以不用前端 navigator.mediaSession 当唯一通道:WebView2 只转发标题/歌手/进度, + # 专辑与封面不送达,且会话挂在浏览器进程 AUMID 上只显示「未知应用」。 + "Media", + "Win32_System_WinRT", "Security_Cryptography", # 划词取词的智能路径:UIA 直读焦点元素选区(IUIAutomation / ITextProvider) "Win32_UI_Accessibility", + # OCR:CryptographicBuffer / SoftwareBitmap::CreateCopyFromBuffer 的 IBuffer 属于 + # Windows.Storage.Streams,缺这个 feature 会 E0599 找不到 CreateFromByteArray "Storage_Streams", # HDR 探测:DXGI 的 advanced color 查询用于判断显示器是否处于 HDR / WCG 状态, # 并读取其色域与传递函数(G2084/PQ 表示 HDR10)。截图前据此决定是否做色调映射。 diff --git a/src-tauri/resources/thing-extension/background.js b/src-tauri/resources/thing-extension/background.js index 0f89417..cef8a7b 100644 --- a/src-tauri/resources/thing-extension/background.js +++ b/src-tauri/resources/thing-extension/background.js @@ -379,21 +379,95 @@ async function shouldIntercept(downloadItem) { } /** - * 判断是否为"历史下载"(安装插件之前就已存在、随后被浏览器恢复的旧下载) + * 判断是否为"历史下载"(本次浏览器会话开始之前就存在、浏览器重启/恢复后才重新触发的下载) * 这类下载一律不接管,交给浏览器原生处理,实现"只接管以后的下载,历史都不管" + * + * 三重判据(任一命中即视为历史下载): + * 1. canResume=true:已存在有效的部分文件,说明浏览器在恢复旧下载 + * 2. 开始时间早于插件首次安装时间 + * 3. 开始时间早于**本次浏览器会话**起点:浏览器重启时会恢复上次未完成的下载, + * 这些下载的 startTime 仍是上次会话的时间,因此一定会落在会话起点之前。 + * (只靠 1/2 不够:上次会话启动的下载若被浏览器重新排队,canResume 可能为 false, + * 而 startTime 又晚于安装时间 —— 这正是"关掉浏览器后莫名多出历史下载"的成因) */ async function isHistoricalDownload(item) { // 1) canResume=true 表示已存在有效的部分文件,说明浏览器在恢复旧下载 if (item.canResume) return true + + const start = item.startTime ? new Date(item.startTime).getTime() : 0 + // 2) 开始时间早于插件首次安装时间(浏览器重启后恢复的旧下载会保留原来的开始时间) try { - const start = item.startTime ? new Date(item.startTime).getTime() : 0 - if (start > 0) { - const stored = await chrome.storage.local.get('installTime') - const installTime = stored.installTime || 0 - if (installTime > 0 && start < installTime) return true + const stored = await chrome.storage.local.get('installTime') + const installTime = stored.installTime || 0 + if (installTime > 0 && start > 0 && start < installTime) return true + } catch { /* ignore */ } + + // 3) 开始时间早于本次浏览器会话起点(含 5s 宽限,避免刚启动时误判新下载) + const sessionStart = await ensureSessionStart() + if (start > 0 && start < sessionStart - RESTORE_GRACE_MS) return true + + return false +} + +/** 浏览器会话起点(chrome.storage.session 在浏览器关闭后自动清空) */ +const SESSION_START_KEY = 'sessionStart' +/** 会话起点宽限:会话刚建立时新下载的 startTime 可能略早于起点记录时刻 */ +const RESTORE_GRACE_MS = 5000 +let sessionStartCache = 0 + +/** + * 取本次浏览器会话的起点时间戳(首次调用时写入 storage.session)。 + * 用 storage.session 而非 storage.local 的原因:它随浏览器关闭而清空, + * "存在"本身就等价于"本次会话已开始",无需自己判断重启。 + */ +async function ensureSessionStart() { + if (sessionStartCache) return sessionStartCache + try { + const s = await chrome.storage.session.get(SESSION_START_KEY) + if (s[SESSION_START_KEY]) { + sessionStartCache = s[SESSION_START_KEY] + return sessionStartCache } } catch { /* ignore */ } + sessionStartCache = Date.now() + try { + await chrome.storage.session.set({ [SESSION_START_KEY]: sessionStartCache }) + } catch { /* ignore */ } + return sessionStartCache +} + +/** 已处理过的下载 guid(持久化,浏览器重启后仍能认出同一条下载) */ +const SEEN_GUIDS_KEY = 'seenDownloadGuids' +/** 记录上限:只用于识别"同一条下载被重复通知",不需要长期留存 */ +const SEEN_GUIDS_MAX = 300 +let seenGuidsCache = null + +async function loadSeenGuids() { + if (seenGuidsCache) return seenGuidsCache + try { + const s = await chrome.storage.local.get(SEEN_GUIDS_KEY) + seenGuidsCache = Array.isArray(s[SEEN_GUIDS_KEY]) ? s[SEEN_GUIDS_KEY] : [] + } catch { + seenGuidsCache = [] + } + return seenGuidsCache +} + +/** + * 记录 guid 并返回它此前是否已见过。 + * `true` 表示这条下载我们处理过/见过,本次是重复通知(浏览器恢复旧下载时会复用原 guid), + * 必须跳过,否则会把历史下载重新丢进 Thing。 + */ +async function markGuidSeen(guid) { + const seen = await loadSeenGuids() + if (seen.includes(guid)) return true + seen.push(guid) + if (seen.length > SEEN_GUIDS_MAX) seen.splice(0, seen.length - SEEN_GUIDS_MAX) + seenGuidsCache = seen + try { + await chrome.storage.local.set({ [SEEN_GUIDS_KEY]: seen }) + } catch { /* ignore */ } return false } @@ -417,6 +491,10 @@ async function hasExistingTask(url) { async function handleDownloadCreated(downloadItem) { const url = downloadItem.finalUrl || downloadItem.url + // 同一条下载只处理一次:浏览器重启后恢复的旧下载会带着原 guid 再次触发 onCreated, + // 不拦下来就会把「早已看过/已完成」的下载重新丢进 Thing(表现为莫名弹出历史下载) + if (downloadItem.guid && await markGuidSeen(downloadItem.guid)) return + // 回退下载:我们自己用 chrome.downloads.download 创建的,直接跳过,避免无限循环 const fbExp = fallbackUrls.get(url) if (fbExp && Date.now() < fbExp) { diff --git a/src-tauri/resources/thing-extension/manifest.json b/src-tauri/resources/thing-extension/manifest.json index 5c52d51..8b069f7 100644 --- a/src-tauri/resources/thing-extension/manifest.json +++ b/src-tauri/resources/thing-extension/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Thing Extension", - "version": "0.30", + "version": "0.31", "description": "发送浏览器下载到 Thing 下载引擎,嗅探网页资源。", "icons": { "16": "icons/icon-16.png", diff --git a/src-tauri/resources/thing-extension/thing-extension.zip b/src-tauri/resources/thing-extension/thing-extension.zip index ec1f80d..a7d8016 100644 Binary files a/src-tauri/resources/thing-extension/thing-extension.zip and b/src-tauri/resources/thing-extension/thing-extension.zip differ diff --git a/src-tauri/src/constants.rs b/src-tauri/src/constants.rs index 84665d6..cfe8686 100644 --- a/src-tauri/src/constants.rs +++ b/src-tauri/src/constants.rs @@ -102,6 +102,10 @@ pub mod events { pub const TERMINAL_SETTINGS: &str = "terminal-settings"; // 音乐模块:下载任务事件(桥接事件行 → 前端,负载见 bridge.py _emit_event) pub const MUSIC_DOWNLOAD_EVENT: &str = "music-download-event"; + // 音乐模块:Rust 侧播放引擎(music/audio)。曲目自然播完(缓冲也放完)后发出,无负载 + pub const MUSIC_AUDIO_ENDED: &str = "music-audio-ended"; + /// 音乐模块:Rust 侧播放失败(音源打不开 / 解码失败 / 输出设备异常),负载为错误文本 + pub const MUSIC_AUDIO_ERROR: &str = "music-audio-error"; // 后端自动切换节点完成(前端据以刷新节点列表并提示) pub const PROXY_AUTO_SWITCH: &str = "proxy-auto-switch"; // 应用更新进度 diff --git a/src-tauri/src/download_engine/engine.rs b/src-tauri/src/download_engine/engine.rs index c2e42d4..a4f6399 100644 --- a/src-tauri/src/download_engine/engine.rs +++ b/src-tauri/src/download_engine/engine.rs @@ -235,7 +235,12 @@ impl DownloadEngine { let use_proxy = self.inner.use_proxy.load(Ordering::SeqCst); self.ensure_mihomo_proxy().await; - let probe = self.inner.http.probe(url, headers, use_proxy).await; + // 交互式校验(「添加下载」对话框):用户在等结果,保留探测超时避免界面卡死 + let probe = self + .inner + .http + .probe(url, headers, use_proxy, Some(super::http_dl::PROBE_TIMEOUT)) + .await; let settings = self.inner.settings.lock().unwrap_or_else(|e| e.into_inner()).clone(); let task_dir = dir.map(|d| d.to_string()).unwrap_or_else(|| settings.download_dir.clone()); @@ -390,13 +395,17 @@ impl DownloadEngine { /// 生成不冲突的文件名(同名时追加 (1)、(2)...) /// 冲突来源:磁盘已有同名最终文件、已存在同名临时文件(其他任务正在下载该名)、 /// 以及任务列表中已有任务占用同名(即使最终文件尚未落盘,避免共用同一 .thingdl 临时文件) - fn generate_unique_filename(&self, dir: &str, filename: &str) -> String { + /// + /// `exclude_id`:把某个任务排除在「已占用」之外。探测完成后用真实文件名重命名时 + /// 必须传自己的 id —— 否则会与**自己**的占位文件名相撞,把每一个下载都改名成 + /// `xxx (1).ext`(探测文件名与 URL 推导名一致时必现)。 + fn generate_unique_filename(&self, dir: &str, filename: &str, exclude_id: Option<&str>) -> String { // 任务列表中已占用的文件名(同一目录下) let taken: std::collections::HashSet = { let tasks = self.inner.tasks.lock().unwrap_or_else(|e| e.into_inner()); tasks .values() - .filter(|t| t.dir == dir) + .filter(|t| t.dir == dir && Some(t.id.as_str()) != exclude_id) .map(|t| t.filename.clone()) .collect() }; @@ -487,7 +496,7 @@ impl DownloadEngine { .unwrap_or_else(|| format!("download_{}", chrono::Utc::now().timestamp())) }); if auto_rename { - task_filename = self.generate_unique_filename(&task_dir, &task_filename); + task_filename = self.generate_unique_filename(&task_dir, &task_filename, None); } // 3) 立即插入占位任务:Queued(未探测完成前 schedule 会跳过),未知大小单段 @@ -536,7 +545,13 @@ impl DownloadEngine { let use_proxy = self.inner.use_proxy.load(Ordering::SeqCst); tauri::async_runtime::spawn(async move { engine.ensure_mihomo_proxy().await; - let probe = engine.inner.http.probe(&raw_url, &raw_headers, use_proxy).await; + // 后台探测不设超时:服务器慢就继续等(与下载路径一致), + // 只有真正失败才置 Error;用户暂停/取消走任务的取消标志。 + let probe = engine + .inner + .http + .probe(&raw_url, &raw_headers, use_proxy, None) + .await; // 探测结束,解除 pending 门控 engine @@ -591,10 +606,11 @@ impl DownloadEngine { } }; - // 释放 tasks 锁后,若探测返回了真实文件名,重新做唯一化并写回 + // 释放 tasks 锁后,若探测返回了真实文件名,重新做唯一化并写回。 + // 必须排除自己(`&rid`):占位名往往与探测名相同,不排除就会和自己相撞而改名成 (1) if let Some((dir_owned, Some(real_name))) = rename_from { let final_name = if auto_rename { - engine.generate_unique_filename(&dir_owned, &real_name) + engine.generate_unique_filename(&dir_owned, &real_name, Some(&rid)) } else { real_name }; diff --git a/src-tauri/src/download_engine/http_dl.rs b/src-tauri/src/download_engine/http_dl.rs index a993a7a..aff3c6e 100644 --- a/src-tauri/src/download_engine/http_dl.rs +++ b/src-tauri/src/download_engine/http_dl.rs @@ -13,11 +13,49 @@ use tokio::task::JoinSet; use super::rate_limit::RateLimiter; use super::task::{ProbeResult, Segment}; -/// 请求超时:连接 + 响应头必须在 30s 内就绪(分段请求若无超时, -/// 服务器挂死时任务将永久卡在 Active,pause→resume 会出现新旧任务并发写同一临时文件) -const REQUEST_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(30); -/// 分块读取停滞超时:30s 内无任何数据视为连接挂死,主动中断(配合取消标志及时退出) -const READ_STALL_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(30); +/// 取消轮询间隔。 +/// +/// **这不是下载超时**:下载路径不再因「长时间无数据/无响应头」中断,服务器慢就继续等, +/// 只有用户暂停/取消或真正报错才结束。这个 200ms 轮询的唯一作用是让暂停/取消在 +/// 「连接挂死、`stream.next()` 一直 pending」时也能及时被感知—— +/// 否则等待 future 永不返回,取消标志就永远读不到。 +const CANCEL_POLL_INTERVAL: std::time::Duration = std::time::Duration::from_millis(200); + +/// 交互式探测超时(仅用于「添加下载」校验等用户正盯着界面等结果的场景: +/// 无限等待等于界面卡死)。真正的下载/后台探测路径不设超时。 +pub const PROBE_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(30); + +/// 等待一个 future 完成,期间每 200ms 检查一次取消标志;**不设超时**。 +/// +/// 返回 `Err("已取消")` 表示用户暂停/取消(调用方据此把任务置为 Paused 而非 Error)。 +async fn wait_cancellable(fut: F, cancel: &AtomicBool) -> Result +where + F: std::future::Future, +{ + tokio::pin!(fut); + loop { + if cancel.load(Ordering::SeqCst) { + return Err("已取消".to_string()); + } + tokio::select! { + biased; + _ = tokio::time::sleep(CANCEL_POLL_INTERVAL) => continue, + out = &mut fut => return Ok(out), + } + } +} + +/// 按需给「发送请求」加超时:`None` 表示不设超时(服务器慢就继续等)。 +/// `Err(())` 只表示超时,这样调用方能把它与「请求失败」区分开(后者要回退 HEAD)。 +async fn send_with_optional_timeout( + req: reqwest::RequestBuilder, + timeout: Option, +) -> Result, ()> { + match timeout { + Some(d) => tokio::time::timeout(d, req.send()).await.map_err(|_| ()), + None => Ok(req.send().await), + } +} /// HTTP/HTTPS 下载器 #[derive(Clone)] @@ -97,19 +135,23 @@ impl HttpDownloader { /// 探测下载资源信息(大小、是否支持 Range、文件名) /// 优先用 GET + Range: bytes=0-0(返回 206 + Content-Range),回退到 HEAD。 - /// 代理降级:use_proxy=true 时先走系统代理,失败则回退 no_proxy 直连重试一次 + /// 代理降级:use_proxy=true 时先走系统代理,失败则回退 no_proxy 直连重试一次。 + /// + /// `timeout`:`Some` 用于交互式探测(用户正等界面结果);`None` 表示不设超时 + /// (后台探测,如更新包下载,服务器慢就继续等)。 pub async fn probe( &self, url: &str, headers: &HashMap, use_proxy: bool, + timeout: Option, ) -> Result { let first = self.client(use_proxy); - match self.probe_with_client(&first, url, headers).await { + match self.probe_with_client(&first, url, headers, timeout).await { Ok(r) => return Ok(r), Err(e) if use_proxy => { let direct = self.client(false); - self.probe_with_client(&direct, url, headers) + self.probe_with_client(&direct, url, headers, timeout) .await .map_err(|e2| format!("代理探测失败({}),直连重试也失败({})", e, e2)) } @@ -123,6 +165,7 @@ impl HttpDownloader { client: &Client, url: &str, headers: &HashMap, + timeout: Option, ) -> Result { // 先尝试 Range 请求(能同时判断 Accept-Ranges 和获取大小) let mut req = client @@ -133,10 +176,14 @@ impl HttpDownloader { req = req.header(k, v); } - match tokio::time::timeout(REQUEST_TIMEOUT, req.send()) - .await - .map_err(|_| "探测超时(30s 内未收到响应头)".to_string())? - { + // 先拿到「发送结果」:超时(仅交互式探测会有)直接上抛, + // 发送失败则回退 HEAD。注意不能把发送失败也上抛——那会让 HEAD 回退失效。 + let first = match send_with_optional_timeout(req, timeout).await { + Err(()) => return Err("探测超时(未收到响应头)".to_string()), + Ok(r) => r, + }; + + match first { Ok(resp) => { let status = resp.status(); let headers_map = resp.headers().clone(); @@ -185,9 +232,9 @@ impl HttpDownloader { for (k, v) in headers { head_req = head_req.header(k, v); } - let resp = tokio::time::timeout(REQUEST_TIMEOUT, head_req.send()) + let resp = send_with_optional_timeout(head_req, timeout) .await - .map_err(|_| "探测超时(HEAD 30s 内未收到响应头)".to_string())? + .map_err(|_| "探测超时(HEAD 未收到响应头)".to_string())? .map_err(|e| format!("探测失败(GET 和 HEAD 均失败): {}", e))?; let headers_map = resp.headers().clone(); let total_size = headers_map @@ -421,9 +468,10 @@ async fn download_segment_with_client( req = req.header(k, v); } - let resp = tokio::time::timeout(REQUEST_TIMEOUT, req.send()) - .await - .map_err(|_| "请求超时(30s 内未收到响应头)".to_string())? + // 等响应头:不设超时(服务器慢就继续等),但期间轮询取消标志, + // 保证用户暂停/取消时能立刻中断这次请求。 + let resp = wait_cancellable(req.send(), &cancel) + .await? .map_err(|e| format!("请求失败: {}", e))?; let status = resp.status(); @@ -453,50 +501,53 @@ async fn download_segment_with_client( return Err("已取消".to_string()); } - // 停滞超时:30s 无数据即中断,确保 cancel 标志能及时被感知(配合代际句柄防并发写) - match tokio::time::timeout(READ_STALL_TIMEOUT, stream.next()).await { - Ok(Some(Ok(chunk))) => { - buf.extend_from_slice(&chunk); - // 接收到数据立即更新进度(避免监控周期内进度无变化导致速度显示为 0) - local_completed += chunk.len() as u64; - progress.store(local_completed, Ordering::Relaxed); - // 积累到 64KB 再写入(减少 I/O 次数) - if buf.len() >= 64 * 1024 { - file.write_all(&buf) - .await - .map_err(|e| format!("写入文件失败: {}", e))?; - // 限速 - limiter.consume(buf.len() as u64).await; - buf.clear(); + // 读数据:**不做停滞超时**——30s 无数据不代表失败(慢速源、网络抖动很常见), + // 只要用户没暂停就继续等。select 里那个 200ms 计时器只负责周期性回到循环头 + // 读一次取消标志:否则 `stream.next()` 一直 pending 时暂停/取消永远感知不到。 + tokio::select! { + biased; + _ = tokio::time::sleep(CANCEL_POLL_INTERVAL) => continue, + next = stream.next() => match next { + Some(Ok(chunk)) => { + buf.extend_from_slice(&chunk); + // 接收到数据立即更新进度(避免监控周期内进度无变化导致速度显示为 0) + local_completed += chunk.len() as u64; + progress.store(local_completed, Ordering::Relaxed); + // 积累到 64KB 再写入(减少 I/O 次数) + if buf.len() >= 64 * 1024 { + file.write_all(&buf) + .await + .map_err(|e| format!("写入文件失败: {}", e))?; + // 限速 + limiter.consume(buf.len() as u64).await; + buf.clear(); + } } - } - Ok(Some(Err(e))) => { - return Err(format!("读取数据失败: {}", e)); - } - Ok(None) => { - // 流结束,写入剩余数据 - if !buf.is_empty() { - file.write_all(&buf) - .await - .map_err(|e| format!("写入文件失败: {}", e))?; - // local_completed 和 progress 已在接收 chunk 时更新 - limiter.consume(buf.len() as u64).await; - buf.clear(); + Some(Err(e)) => { + return Err(format!("读取数据失败: {}", e)); } - // 校验:已知大小的分段若流提前结束(收到的字节数不足分段长度), - // 说明服务器提前断开或返回不完整内容,不能标记为完成,否则文件会被截断 - if !unknown_size && local_completed < seg.len() { - return Err(format!( - "文件不完整:已接收 {} / {} 字节,服务器提前结束连接", - local_completed, - seg.len() - )); + None => { + // 流结束,写入剩余数据 + if !buf.is_empty() { + file.write_all(&buf) + .await + .map_err(|e| format!("写入文件失败: {}", e))?; + // local_completed 和 progress 已在接收 chunk 时更新 + limiter.consume(buf.len() as u64).await; + buf.clear(); + } + // 校验:已知大小的分段若流提前结束(收到的字节数不足分段长度), + // 说明服务器提前断开或返回不完整内容,不能标记为完成,否则文件会被截断 + if !unknown_size && local_completed < seg.len() { + return Err(format!( + "文件不完整:已接收 {} / {} 字节,服务器提前结束连接", + local_completed, + seg.len() + )); + } + break; } - break; - } - Err(_) => { - return Err("读取超时(30s 无数据,已中断下载)".to_string()); - } + }, } } diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 25840eb..e281708 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -51,12 +51,16 @@ use music::{ feiniu_list_connections, feiniu_list_audio_files, feiniu_list_tracks, feiniu_login, feiniu_logout, feiniu_lyric, feiniu_media_prefix, feiniu_save_connection, feiniu_scan_local, feiniu_test_connection, + music_audio_play, music_audio_seek, music_audio_set_playing, music_audio_set_volume, + music_audio_state, music_audio_stop, music_cancel_runtime_install, music_download, music_download_cancel, music_env_status, music_get_settings, music_get_sources, music_install_runtime, music_parse_playlist, music_ping, music_resolve, music_save_settings, music_search, music_secret_get, music_secret_set, + music_smtc_clear, music_smtc_update_metadata, music_smtc_update_playback_state, + music_smtc_update_position, music_stop_bridge, music_update_musicdl, webdav_delete, webdav_get_secret, webdav_save_secret, webdav_test, - webdav_upload, MusicManager, + webdav_upload, AudioEngine, MusicManager, SmtcController, }; use network_monitor::network_status; use osd_window::{ @@ -226,6 +230,9 @@ fn export_bindings() { // music(6,豁免 3:music_ping / music_get_sources / music_search 返回 serde_json::Value) music_env_status, music_install_runtime, music_cancel_runtime_install, music_stop_bridge, music_get_settings, music_save_settings, + // music 播放引擎(Rust 侧播放,取代前端