197 lines
8.9 KiB
TOML
197 lines
8.9 KiB
TOML
[package]
|
||
name = "thing"
|
||
version = "26.9.3"
|
||
description = "A Tauri App"
|
||
authors = ["you"]
|
||
edition = "2021"
|
||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||
|
||
[lib]
|
||
# The `_lib` suffix may seem redundant but it is necessary
|
||
# to make the lib name unique and wouldn't conflict with the bin name.
|
||
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
|
||
name = "thing_lib"
|
||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||
|
||
[build-dependencies]
|
||
tauri-build = { version = "2", features = [] }
|
||
|
||
[dependencies]
|
||
tauri = { version = "2", features = ["tray-icon"] }
|
||
tauri-plugin-opener = "2"
|
||
tauri-plugin-dialog = "2"
|
||
tauri-plugin-snap-layout = "1"
|
||
tauri-plugin-global-shortcut = "2"
|
||
tauri-plugin-notification = "2"
|
||
# 翻译引擎抽象:TranslateEngine 需要 Box<dyn> 动态分派(多源在运行期决定),
|
||
# 原生 async fn in trait 在 dyn 场景下不可用
|
||
async-trait = "0.1"
|
||
serde = { version = "1", features = ["derive"] }
|
||
serde_json = "1"
|
||
regex = "1"
|
||
serde_yaml = "0.9"
|
||
specta = { version = "=2.0.0-rc.25", features = ["derive", "function", "serde_json"] }
|
||
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"] }
|
||
futures-util = "0.3"
|
||
tokio = { version = "1", features = ["io-util", "time", "rt-multi-thread", "macros", "sync", "fs", "net"] }
|
||
axum = "0.7"
|
||
url = "2"
|
||
zip = "2"
|
||
dirs = "5"
|
||
# ===== 终端模块 =====
|
||
# 字符编码转换:老服务器(CentOS 6/7 默认 LANG=zh_CN.GBK)输出 GBK 字节,
|
||
# 直接按 UTF-8 解码会得到乱码。encoding_rs 是 Firefox 的实现抽出,比 iconv 绑定
|
||
# 干净(纯 Rust、无 C 依赖),且本项目依赖树里已存在(reqwest → encoding_rs 0.8.35),
|
||
# 提升为直接依赖不会新增编译单元。
|
||
encoding_rs = "0.8"
|
||
# SSH 客户端:纯 Rust + 原生 async,与项目 tokio 运行时契合。
|
||
# 选 russh 而非 ssh2(libssh2 绑定)的理由见 terminal/ssh/mod.rs 模块注释。
|
||
# 注意:实施时核实该 crate 已到 0.63.x(规划文档中的 0.5 已过时)。
|
||
russh = "0.63"
|
||
# SSH 密钥的生成/解析/加密统一走 `russh::keys::ssh_key` re-export。
|
||
#
|
||
# **不要**声明与 russh 钉住版本不同的 `ssh-key`——若声明 0.6 会引入第二个不兼容
|
||
# 版本,两边的 PrivateKey/PublicKey 无法互转(这是 P0 踩过的坑)。
|
||
#
|
||
# 唯一的例外是下面这一行:必须声明**完全相同**的版本号 `=0.7.0-rc.11`。
|
||
# 原因是 russh 的 `[features]` **没有向 ssh-key 转发 `ppk`**
|
||
# (只有 dsa / rsa / serde 三个转发项),而 P2 要支持 PuTTY `.ppk` 导入,
|
||
# 只能由我们自己打开 `ssh-key/ppk`。
|
||
#
|
||
# Cargo 会把「russh 的 `=0.7.0-rc.11`」与「这里的 `=0.7.0-rc.11`」**合并为同一个
|
||
# 依赖节点**(版本要求完全相同,不存在二选一),因此不会产生分叉。
|
||
# 已用 `cargo tree -i ssh-key` 复核:图中只有 `ssh-key v0.7.0-rc.11` 一个节点。
|
||
#
|
||
# 注意:改这里之后必须重跑 `cargo tree -i ssh-key` 确认仍只有一个节点。
|
||
ssh-key = { version = "=0.7.0-rc.11", default-features = false, features = ["ppk", "encryption", "alloc"] }
|
||
|
||
# 系统随机源:ssh-key 0.7 的 `getrandom` feature 默认**未启用**(russh 没开,
|
||
# 我们上面的 ssh-key 声明也没开),故 `ssh_key::getrandom::SysRng` 不可见。
|
||
# 这里直接依赖 getrandom 0.4 ——它与 ssh-key 共用同一份 `rand_core 0.10`,
|
||
# `UnwrapErr(SysRng)` 能直接满足 ssh-key 的 `CryptoRng`/`TryCryptoRng` 约束
|
||
# (见 terminal/keys.rs 的 sys_rng)。
|
||
getrandom = "0.4"
|
||
# SFTP 客户端。**russh 本身不含 SFTP**——只是一个 SSH 传输层,SFTP 协议
|
||
# (OPEN/READ/WRITE/READDIR 等报文)由独立的 russh-sftp 实现。
|
||
# 版本配套:russh-sftp 3.0.0 的依赖是 `russh ^0.63.2`,与上面的 0.63 同源,
|
||
# 共用同一份 russh 实例类型 —— 这一点关键:SFTP 通道必须从**已认证的同一个
|
||
# Session** 上开(`request_subsystem(true, "sftp")`),跨版本是做不到的。
|
||
# 另注:3.0.0 把 `russh` 列为 dev-dependency,故不会重复引入第二个 russh。
|
||
russh-sftp = "3.0"
|
||
# ConPTY 之外还需要窗口/进程相关 API;Win32_System_Console 为 CreatePseudoConsole 所在 feature
|
||
# 终端会话并发注册表:读多写少(每次输出批次都查表),分片锁避免各会话 I/O 互相等待
|
||
dashmap = "6"
|
||
# 音频标签解析(本地曲库元数据:标题/歌手/专辑/时长/内嵌封面)
|
||
lofty = "0.22"
|
||
sysinfo = "0.32"
|
||
rusqlite = { version = "0.32", features = ["bundled"] }
|
||
base64 = "0.22"
|
||
sha2 = "0.10"
|
||
md-5 = "0.10"
|
||
hmac = "0.12"
|
||
aes = "0.8"
|
||
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"] }
|
||
walkdir = "2"
|
||
notify = { version = "6", features = [] }
|
||
librqbit = "9"
|
||
bytes = "1"
|
||
windows-capture = "2.0.1"
|
||
# HDR 截图说明:windows-capture 的 Windows Graphics Capture 后端在 HDR 显示器上
|
||
# 可能输出 scRGB / rgba16F 或 HDR10(PQ) 格式的帧,与项目其余截图路径
|
||
# (GDI BitBlt,sRGB 8bit)色彩空间不一致。capture 层统一转成 sRGB 8bit
|
||
# 后再交给编码器,否则 HDR 屏上截出的图会整体偏灰 / 过曝。
|
||
|
||
[target.'cfg(windows)'.dependencies]
|
||
winreg = "0.52"
|
||
# WebDAV 凭据加密存储(Windows 凭据管理器,DPAPI 保护)
|
||
keyring = { version = "3", features = ["windows-native"] }
|
||
raw-window-handle = "0.6"
|
||
windows-sys = { version = "0.52", features = [
|
||
"Win32_Networking_WinInet",
|
||
"Win32_Foundation",
|
||
"Win32_Globalization",
|
||
"Win32_Security",
|
||
"Win32_System_Threading",
|
||
"Win32_System_Ole",
|
||
"Win32_System_Memory",
|
||
"Win32_System_DataExchange",
|
||
"Win32_System_SystemInformation",
|
||
"Win32_UI_WindowsAndMessaging",
|
||
"Win32_UI_Shell",
|
||
"Win32_UI_HiDpi",
|
||
"Win32_UI_Input_KeyboardAndMouse",
|
||
"Win32_Graphics_Gdi",
|
||
"Win32_Graphics_Dwm",
|
||
"Win32_Storage_Xps",
|
||
"Win32_Storage_FileSystem",
|
||
"Win32_Devices_Display",
|
||
# 终端模块:ConPTY(CreatePseudoConsole / ResizePseudoConsole / ClosePseudoConsole)
|
||
"Win32_System_Console",
|
||
# 终端模块:CreatePipe(ConPTY 的输入/输出管道)
|
||
"Win32_System_Pipes",
|
||
# 终端模块:ReadFile / CancelIoEx / GetOverlappedResult(ConPTY 输出读取)
|
||
# 注意:0.52 起 ReadFile 定义在 Storage_FileSystem 但被 Win32_System_IO 特性门控,
|
||
# 两个特性必须同时开启,否则导入会解析失败。
|
||
"Win32_System_IO",
|
||
] }
|
||
# Explorer ShellWindows COM:用于枚举已打开的资源管理器窗口并取当前路径
|
||
# (快速面板「用资源管理器打开」联动)。依赖 Win32_System_Com 特性。
|
||
windows = { version = "0.52", features = [
|
||
"Win32_Foundation",
|
||
"Win32_System_Com",
|
||
"Win32_System_Ole",
|
||
"Win32_System_Variant",
|
||
"Win32_UI_Shell",
|
||
"Win32_UI_WindowsAndMessaging",
|
||
# 翻译模块:Windows.Media.Ocr 本地识别(WinRT)
|
||
# Foundation_Collections:OcrResult.Lines / OcrEngine.AvailableRecognizerLanguages 返回 IVectorView
|
||
# Security_Cryptography:用 CryptographicBuffer 从内存字节构造 IBuffer(不落盘)
|
||
"Foundation",
|
||
"Foundation_Collections",
|
||
"Globalization",
|
||
"Graphics_Imaging",
|
||
"Media_Ocr",
|
||
"Security_Cryptography",
|
||
# 划词取词的智能路径:UIA 直读焦点元素选区(IUIAutomation / ITextProvider)
|
||
"Win32_UI_Accessibility",
|
||
"Storage_Streams",
|
||
# HDR 探测:DXGI 的 advanced color 查询用于判断显示器是否处于 HDR / WCG 状态,
|
||
# 并读取其色域与传递函数(G2084/PQ 表示 HDR10)。截图前据此决定是否做色调映射。
|
||
# 对应 feature:Win32_Graphics_Dxgi / Win32_Graphics_Dxgi_Common。
|
||
"Win32_Graphics_Dxgi_Common",
|
||
"Win32_Graphics_Gdi",
|
||
] }
|
||
|
||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||
tauri-plugin-autostart = "2"
|
||
|
||
# ===== 编译配置 =====
|
||
# dev profile:日常 `tauri dev` 的取舍。
|
||
# - incremental = true:增量编译,改一行代码只需重编受影响的 crate
|
||
# - debug = "line-tables-only":只保留行号表,去掉完整 DWARF,交付期
|
||
# target/ 目录因此从数 GB 降到数百 MB,而 panic 回溯仍能定位到源码行。
|
||
# 注意:这里没开 opt-level。依赖 crate(尤其 tauri/wry/windows-sys)
|
||
# 在 opt-level=0 下开销明显;若 dev 下界面卡顿,可只给依赖提优化。
|
||
|
||
[profile.dev]
|
||
incremental = true
|
||
debug = "line-tables-only"
|
||
|
||
# release profile:交付构建。
|
||
# - strip = true:剥离符号信息,显著缩小产物体积
|
||
# - lto = true:全程序链接时优化,跨 crate 内联,通常带来 10~20% 性能提升,
|
||
# 代价是链接时间从秒级升到分钟级。只在 release 构建付出这个代价。
|
||
# 未开 codegen-units=1:会再压榨约 5% 性能,但编译时间翻倍,不值得。
|
||
[profile.release]
|
||
strip = true
|
||
lto = true
|
||
|