diff --git a/.gitignore b/.gitignore index c2416a1..f5d7b95 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,5 @@ __pycache__/ !release/0.1.3/Squid-Setup-0.1.3-win-x64.exe !release/0.1.4/Squid-0.1.4-macOS-universal.dmg !release/0.1.4/Squid-Setup-0.1.4-win-x64.exe +!release/0.1.5/Squid-0.1.5-macOS-universal.dmg +!release/0.1.5/Squid-Setup-0.1.5-win-x64.exe diff --git a/Cargo.lock b/Cargo.lock index 09f2908..540eb74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -967,7 +967,7 @@ checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" [[package]] name = "squid-cli" -version = "0.1.4" +version = "0.1.5" dependencies = [ "anyhow", "chrono", @@ -986,7 +986,7 @@ dependencies = [ [[package]] name = "squid-core" -version = "0.1.4" +version = "0.1.5" dependencies = [ "anyhow", "chrono", @@ -1005,7 +1005,7 @@ dependencies = [ [[package]] name = "squid-engine" -version = "0.1.4" +version = "0.1.5" dependencies = [ "anyhow", "chrono", @@ -1025,7 +1025,7 @@ dependencies = [ [[package]] name = "squid-platform" -version = "0.1.4" +version = "0.1.5" dependencies = [ "dirs", "libc", @@ -1042,7 +1042,7 @@ dependencies = [ [[package]] name = "squid-rules" -version = "0.1.4" +version = "0.1.5" dependencies = [ "globset", "serde", @@ -1054,7 +1054,7 @@ dependencies = [ [[package]] name = "squid-stats" -version = "0.1.4" +version = "0.1.5" dependencies = [ "chrono", "libc", @@ -1066,7 +1066,7 @@ dependencies = [ [[package]] name = "squid-tui" -version = "0.1.4" +version = "0.1.5" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index f74687b..2f712ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = ["crates/*"] exclude = ["src-tauri"] [workspace.package] -version = "0.1.4" +version = "0.1.5" edition = "2021" rust-version = "1.80" license = "GPL-3.0-only" diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..0a66660 --- /dev/null +++ b/README.en.md @@ -0,0 +1,283 @@ +# Squid + +[简体中文](README.zh-CN.md) · [Bilingual home](README.md) + +**Give your computer a bath.** + +Squid is a local system-care app for macOS and Windows. It cleans rebuildable caches and system junk, uninstalls apps with their leftovers, removes project build artefacts, maps disk usage, and shows live system health. + +The desktop app, CLI, and TUI share one Rust scan-and-delete engine. Cleaning rules, safety boundaries, the deletion ledger, and settings live in one place. Squid requires no cloud service and no root access. + +## Product surfaces + +| Surface | Stack | Binary | +| --- | --- | --- | +| Desktop app | Tauri 2 + React 19 + TypeScript + Vite 6 | `squid-desktop` | +| CLI | Rust + clap | `squid` | +| TUI | Rust + ratatui + crossterm | `squid state` | + +The desktop app supports macOS 12+ and Windows 10/11 x64. The CLI and TUI share the same Rust workspace. + +## Features + +| Feature | Description | +| --- | --- | +| Computer overview | Disk health, common actions, and CPU, memory, and storage summaries | +| Daily cleanup | 38 built-in rules on macOS and 30 on Windows, covering app and browser caches, logs, crash reports, developer caches, Trash, and more | +| Uninstall apps | Finds an app by name and builds one plan containing the app bundle plus preferences, caches, containers, or AppData leftovers | +| Deep Clean | Finds rebuildable build output such as `node_modules`, disk images, installers, and stale downloads while protecting recently used projects | +| Storage | Measures folders level by level, with the largest children and files | +| Real-time monitor | Samples CPU, memory, network, disk, battery, volumes, and high-usage processes every two seconds; processes can be ended after confirmation | +| History and undo | Every real deletion is recorded in a local ledger; items still in Trash or the Recycle Bin can be restored | +| System updates | Checks, verifies, downloads, and installs new versions from the release channel | + +Language settings offer only Simplified Chinese and English, with the current system language selected by default. A manual choice is saved as the interface language for this computer. + +## Desktop app + +### Sidebar + +- **Maintenance**: Computer overview, Daily cleanup, Uninstall apps, Deep Clean +- **Insights**: Storage, Real-time monitor +- **Bottom**: History, Settings + +Use `⌘1`–`⌘8` on macOS or `Ctrl+1`–`Ctrl+8` on Windows to switch pages. + +### Menu bar / tray + +Closing the main window only hides it; Squid keeps running. The tray menu offers: + +- Open Squid +- Daily cleanup +- Uninstall apps +- Deep Clean +- Quit Squid + +The tray follows the active interface language. Reopening the app, double-clicking the app icon, or triggering the single-instance handler restores and focuses the main window. Only **Quit Squid** ends the process. + +### Software updates + +- The system information panel always shows the current OS version, architecture, and Squid version. +- Version changes, release notes, and actions appear only when a newer version exists; there is no duplicate "up to date" message. +- After a verified download, install and restart, or use the neutral outlined **Discard** button that matches Shift to remove the downloaded file. +- Automatic checks are enabled by default and run at most once per day. +- Installers must match the manifest's size and SHA256. Builds with a release public key also verify the manifest's Ed25519 signature. + +### Permissions and privacy + +- On first launch, Squid shows an optional Full Disk Access check once. It does not force the macOS permission prompt and never blocks startup. +- **Settings → System permissions** provides a status check and a shortcut to **System Settings → Privacy & Security → Full Disk Access**. +- Without Full Disk Access, TCC-protected locations are skipped and every other feature remains available. +- Storage analysis and Deep Clean read only user-selected or configured folders; file contents are never uploaded. +- The app makes no network requests other than update checks and installer downloads. + +### Launch at login + +**Settings → Startup** includes a launch-at-login switch. When enabled, Squid starts automatically after the current user signs in and keeps its tray entry available. The setting is user-level and requires no administrator access. + +See [`docs/DESKTOP.md`](docs/DESKTOP.md) for details. + +## Quick start + +### Desktop development + +Requirements: + +- Node.js 20+ and pnpm +- Stable Rust +- macOS: Xcode Command Line Tools +- Windows: MSVC Build Tools and WebView2 Runtime + +```bash +pnpm install +pnpm desktop:dev +``` + +A plain Vite page cannot call Tauri commands. Use `pnpm desktop:dev` when testing scans, deletion, system data, or updates. + +### CLI / TUI + +```bash +cargo install --path crates/squid-cli +# or +cargo build --release -p squid-cli + +squid state # TUI +squid status # system snapshot +squid clean --dry-run # preview cleanable items +squid uninstall --list # installed apps +squid purge ~/code # project build artefacts +squid analyze ~/Library/Caches # storage analysis +squid history # deletion ledger +squid undo # restore the latest Trash session +``` + +Common commands: + +| Command | Purpose | +| --- | --- | +| `clean` | Clean caches, logs, browser and developer junk, crash reports, and Trash by rule | +| `uninstall [NAME]` | Locate an app and build an app-plus-leftovers uninstall plan | +| `purge [PATHS…]` | Remove project build folders, disk images, installers, and stale downloads | +| `state` | Open the TUI with cleanup, uninstall, deep clean, storage, system, and history panels | +| `status` | Print a CPU, memory, network, disk, battery, and process snapshot | +| `analyze [PATH]` | Print a directory-size tree and the largest files | +| `history` / `undo [ID]` | Review history or restore a Trash session | +| `whitelist add\|list\|remove` | Maintain protected paths that are never selected | +| `rules` | List active rules | +| `doctor` | Check permissions, configuration, history, and effective paths | + +Every delete command supports `--dry-run`; non-interactive environments require `-y/--yes`. Run `squid --help` for complete options. + +## Architecture + +```text +crates/ +├── squid-core models, paths, safety policy, settings, deletion ledger, progress, cancellation +├── squid-platform macOS / Linux / Windows adapters: apps, leftovers, volumes, Trash, processes +├── squid-rules TOML rule engine: expansion, anchors, protection, age, and risk flags +├── squid-stats sysinfo sampling, trends, battery, network, and disk activity +├── squid-engine clean / uninstall / purge / analyze and the single deletion path +├── squid-tui ratatui terminal interface +└── squid-cli clap command-line entry point + +src/ React desktop interface +src-tauri/ Tauri shell, commands, tray, permission checks, and updater +scripts/ development, verification, and dual-platform release scripts +docs/ architecture, design, desktop, and release specifications +``` + +`src-tauri` is separate from the root Cargo workspace, but depends directly on `squid-core`, `squid-platform`, `squid-stats`, and `squid-engine`. The desktop app does not maintain a second cleanup implementation. + +See [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for architecture details and [`docs/DESIGN.md`](docs/DESIGN.md) for the shared Nex color, typography, component, and language rules. + +## Safety model + +1. **Index-based deletion**: the desktop UI can only submit indexes from a scan, never arbitrary paths. +2. **Revalidation before execution**: the Rust layer rebuilds each item and rechecks ownership, safety anchors, protected locations, the whitelist, and lock state. +3. **Trash by default**: deletion mode defaults to `trash`; files are removed directly only when permanent deletion is explicitly selected. +4. **Hard boundaries**: system roots, `/usr`, `/System`, `/Applications`, and similar locations cannot be recursively deleted. Symlinks are never followed. +5. **Rule brakes**: rules support `protect`, `min_age_days`, `skip_if_running`, and `risky`. +6. **Ledger and undo**: real deletions are recorded in a local JSON ledger; files still in Trash can be restored. +7. **Process protection**: the process is sampled again before termination; Squid itself, PID 1, and critical system processes are refused. + +The GUI and CLI use the same `squid-engine::delete` path, so behavior, locks, and audit results stay consistent. + +## Data and configuration + +| Purpose | macOS | Windows | +| --- | --- | --- | +| Configuration and rules | `~/Library/Application Support/squid/` | `%APPDATA%\squid\` | +| History ledger | `~/Library/Application Support/squid/history/` | `%APPDATA%\squid\history\` | +| Delete destination | `~/.Trash` or permanent deletion | Recycle Bin or permanent deletion | + +Linux uses XDG directories. The desktop app and CLI/TUI share configuration and history, so a cleanup from either surface is visible in the other. + +Common configuration: + +```toml +delete_mode = "trash" +history_keep = 60 +purge_min_age_days = 7 +purge_max_entries = 200000 +show_allocated = true +# Empty or omitted means "follow system"; set "en" or "zh" to override +language = "" +whitelist = ["~/Library/Caches/ImportantApp"] +disabled_rules = ["user-trash"] +purge_roots = ["~/code", "~/Projects", "~/Desktop"] +``` + +Main environment variables: + +| Variable | Purpose | +| --- | --- | +| `SQUID_CONFIG_DIR` | Override the configuration directory | +| `SQUID_STATE_DIR` | Override the state and history directory | +| `SQUID_LANG` | Force the CLI/TUI language to `zh` or `en` | +| `SQUID_UPDATE_URL` | Override the desktop update manifest URL for staging | +| `SQUID_TRUECOLOR` / `NO_COLOR` | Control TUI color | +| `SQUID_SYMBOL_CELLS` / `SQUID_CONSOLE_TRACE` | Diagnose Windows console character width and layout | + +`SQUID_LANG` is a CLI override. The desktop app's default language comes from the system and can be changed in the app. + +## Development and verification + +Frontend: + +```bash +pnpm check +pnpm build +``` + +Rust workspace: + +```bash +cargo fmt --all -- --check +cargo clippy --workspace --all-targets -- -D warnings +cargo test --workspace --no-fail-fast +``` + +Tauri: + +```bash +cargo fmt --manifest-path src-tauri/Cargo.toml -- --check +cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings +cargo test --manifest-path src-tauri/Cargo.toml --lib +``` + +The TUI uses a real-pty smoke test; Windows consoles also have a capture, replay, and frame-check test: + +```bash +python3 -m pip install --user pyte +python3 scripts/tui_smoke.py +python3 scripts/tui-frame-check.py --selftest +``` + +CI runs workspace tests, an MSVC target cross-check, the desktop frontend build, and the Tauri Rust check. + +## Build and release + +Keep the version identical in all four places: + +- `Cargo.toml` workspace version +- `src-tauri/Cargo.toml` +- `src-tauri/tauri.conf.json` +- `package.json` + +Build installers: + +```bash +scripts/build-macos-release.sh +scripts/build-windows-release.sh +``` + +Artifacts: + +```text +artifacts/Squid--macOS-universal.dmg +artifacts/Squid-Setup--win-x64.exe +artifacts/SHA256SUMS.txt +``` + +Publish to the update channel: + +```bash +scripts/publish-release.sh --notes /path/to/release-notes.md +``` + +The publish script rebuilds the `releases` branch with `squid-update.json`, both installers, and an optional `squid-update.sig`. The manifest records exact size and SHA256, which the client verifies again after download. + +See [`docs/RELEASE.md`](docs/RELEASE.md) for the full release, signing, and manifest process. + +## Platform status + +| Platform | Status | +| --- | --- | +| macOS | Full desktop and CLI/TUI support; universal DMG | +| Windows x64 | Desktop and CLI/TUI support; NSIS installer | +| Linux | Platform layer and basic CLI/TUI support; built-in rules and desktop installers are not yet provided | + +## License + +Squid is licensed under **GNU General Public License v3.0 only** (`GPL-3.0-only`). See [`LICENSE`](LICENSE). diff --git a/README.md b/README.md index bc2dade..659e342 100644 --- a/README.md +++ b/README.md @@ -1,279 +1,49 @@ # Squid -**给你的电脑洗个澡。** +**给你的电脑洗个澡。** · **Give your computer a bath.** -Squid 是面向 macOS 与 Windows 的本地系统维护工具:清理可重建的缓存与系统垃圾、卸载应用并处理残留、清理项目构建产物、分析磁盘占用,以及实时查看系统状态。 +[简体中文](README.zh-CN.md) · [English](README.en.md) -桌面端、命令行与 TUI 共用同一套 Rust 扫描和删除引擎。清理规则、安全边界、删除账本与配置只维护一份,不依赖云端服务,也不需要 root。 +Squid is a local system-care app for macOS and Windows. It cleans rebuildable caches and system junk, uninstalls apps with their leftovers, removes project build artefacts, maps disk usage, and monitors live system health. -## 产品组成 +Squid 是面向 macOS 与 Windows 的本地系统维护工具。桌面端、CLI 与 TUI 共用同一套 Rust 扫描和删除引擎,不依赖云端服务,也不需要 root。 -| 入口 | 技术栈 | 二进制 | -| --- | --- | --- | -| 桌面应用 | Tauri 2 + React 19 + TypeScript + Vite 6 | `squid-desktop` | -| 命令行 | Rust + clap | `squid` | -| 终端界面 | Rust + ratatui + crossterm | `squid state` | +## Highlights / 功能 -桌面端支持 macOS 12+ 与 Windows 10/11 x64;CLI/TUI 使用同一个 Rust workspace。 +- **Daily cleanup / 日常清理** — 38 macOS rules and 30 Windows rules for caches, logs, crash reports, developer data, and Trash. +- **Uninstall apps / 应用卸载** — One plan for the app and its preferences, caches, containers, or AppData leftovers. +- **Deep Clean / 深度清理** — Rebuildable build output, disk images, installers, and stale downloads with project-age protection. +- **Storage & monitor / 存储与监控** — Folder-level disk analysis, live CPU, memory, network, disk, battery, and process views. +- **History & updates / 历史与更新** — Restorable Trash sessions and a size- and SHA256-verified update channel. -## 功能 +The interface follows the system language by default and can be switched to Simplified Chinese or English in Settings. -| 功能 | 说明 | -| --- | --- | -| 电脑概览 | 磁盘健康、常用操作入口与 CPU、内存、存储摘要 | -| 日常清理 | macOS 38 条 / Windows 30 条内置规则,覆盖应用与浏览器缓存、日志、崩溃报告、开发缓存与废纸篓等 | -| 应用卸载 | 按名称定位应用,把应用本体与偏好、缓存、容器或 AppData 残留组成同一个卸载计划 | -| 深度清理 | 查找 `node_modules` 等可重建构建产物、磁盘镜像、安装包和陈旧下载,并保护近期仍在使用的项目 | -| 存储空间 | 逐层测量目录、查看最大子项与最大文件 | -| 实时监控 | 每两秒采样 CPU、内存、网络、磁盘、电池、卷和高占用进程,可确认后结束进程 | -| 历史与撤销 | 每次真实删除写入本地账本;仍在废纸篓或回收站中的内容可以还原 | -| 系统更新 | 从发布分支检查、校验、下载并安装新版本 | +界面默认跟随系统语言,可在设置中切换简体中文或 English。 -界面支持中文和英文,跟随 Squid 的语言设置与系统语言。 - -## 桌面应用 - -### 左侧菜单 - -- **维护**:电脑概览、日常清理、应用卸载、深度清理 -- **洞察**:存储空间、实时监控 -- **底部**:历史记录、设置 - -`⌘1`–`⌘8`(macOS)或 `Ctrl+1`–`Ctrl+8`(Windows)可以直接切换页面。 - -### 常驻托盘 - -关闭主窗口只会隐藏窗口,Squid 进程继续运行。托盘菜单提供: - -- 打开 Squid -- 日常清理 -- 应用卸载 -- 深度清理 -- 退出 Squid - -再次打开应用、双击应用图标或通过单实例唤起时,会恢复并聚焦主窗口。只有选择“退出 Squid”才会结束进程。 - -### 软件更新 - -- 设置中的系统信息面板始终显示当前系统版本、架构与 Squid 版本。 -- 只有检测到更高版本时,才显示版本变化和更新说明;已经是最新版本时不显示额外提示。 -- 自动检查默认开启,每天最多检查一次。 -- 安装包必须通过 SHA256 与文件大小校验;带发布公钥的构建还会校验清单的 Ed25519 签名。 - -### 权限与隐私 - -- 首次启动会显示一次可选的全盘访问检查,不会强制弹出 macOS 权限窗口,也不会阻止应用启动。 -- “设置 → 系统权限”提供权限状态检查和打开“系统设置 → 隐私与安全性 → 全盘访问”的入口。 -- 没有全盘访问时,受 TCC 保护的位置会被跳过,其余功能仍然可用。 -- 存储分析与深度清理只在用户选择或配置目录后读取;文件内容不会上传。 -- 除更新检查和安装包下载外,应用不发起网络请求。 - -完整说明见 [`docs/DESKTOP.md`](docs/DESKTOP.md)。 - -## 快速开始 - -### 桌面端开发 - -环境要求: - -- Node.js 20+ 与 pnpm -- Rust stable -- macOS:Xcode Command Line Tools -- Windows:MSVC Build Tools 与 WebView2 Runtime +## Start / 开始 ```bash pnpm install pnpm desktop:dev ``` -仅运行 Vite 页面时无法调用 Tauri 命令;需要验证扫描、删除、系统数据或更新流程时请使用 `pnpm desktop:dev`。 - -### CLI / TUI +CLI / TUI: ```bash cargo install --path crates/squid-cli -# 或 -cargo build --release -p squid-cli - -squid state # TUI -squid status # 系统快照 -squid clean --dry-run # 预览可清理内容 -squid uninstall --list # 已安装应用 -squid purge ~/code # 深度清理项目构建产物 -squid analyze ~/Library/Caches # 存储分析 -squid history # 历史账本 -squid undo # 还原最近一次废纸篓会话 +squid state +squid clean --dry-run ``` -常用命令: +## Documentation / 文档 -| 命令 | 作用 | -| --- | --- | -| `clean` | 按规则清理缓存、日志、浏览器与开发者垃圾、崩溃报告和废纸篓 | -| `uninstall [NAME]` | 定位应用并生成“本体 + 残留”卸载计划 | -| `purge [PATHS…]` | 清理项目构建目录、磁盘镜像、安装包与陈旧下载 | -| `state` | 打开包含清理、卸载、深度清理、存储、系统和历史面板的 TUI | -| `status` | 输出 CPU、内存、网络、磁盘、电池与进程快照 | -| `analyze [PATH]` | 输出目录体积树与最大文件 | -| `history` / `undo [ID]` | 查看历史或还原废纸篓会话 | -| `whitelist add\|list\|remove` | 维护永不选中的保护路径 | -| `rules` | 列出当前生效的规则 | -| `doctor` | 检查权限、配置、历史文件和生效路径 | +- [中文完整说明](README.zh-CN.md) +- [Full English guide](README.en.md) +- [Architecture / 架构](docs/ARCHITECTURE.md) +- [Nex design standard / 设计规范](docs/DESIGN.md) +- [Desktop / 桌面端](docs/DESKTOP.md) +- [Release and updates / 发布与更新](docs/RELEASE.md) -所有删除命令都支持 `--dry-run`;非交互环境必须使用 `-y/--yes`。完整参数请运行 `squid --help`。 +## License / 许可证 -## 架构 - -```text -crates/ -├── squid-core 模型、路径、安全策略、设置、删除账本、进度与取消 -├── squid-platform macOS / Linux / Windows 平台适配:应用、残留、卷、回收站、进程 -├── squid-rules TOML 规则引擎:模式展开、锚点、保护、年龄与风险标记 -├── squid-stats sysinfo 采样、趋势、电池、网络与磁盘活动 -├── squid-engine clean / uninstall / purge / analyze 与唯一删除通道 -├── squid-tui ratatui 终端界面 -└── squid-cli clap 命令行入口 - -src/ React 桌面界面 -src-tauri/ Tauri 壳、命令适配、托盘、权限检查与更新器 -scripts/ 开发、验证与双平台发布脚本 -docs/ 架构、设计、桌面与发布规范 -``` - -核心依赖方向: - -```text -squid-core → squid-platform → squid-rules → squid-stats → squid-engine → squid-tui → squid-cli -``` - -`src-tauri` 独立于根 Cargo workspace,但直接依赖 `squid-core`、`squid-platform`、`squid-stats` 与 `squid-engine`,桌面端不维护第二套清理实现。 - -更多设计见 [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md);Nex 系列统一颜色、字体和组件常量见 [`docs/DESIGN.md`](docs/DESIGN.md)。 - -## 安全模型 - -1. **索引式删除**:桌面界面只能提交扫描结果中的索引,不能提交任意待删除路径。 -2. **执行前复验**:Rust 层重新构造扫描条目,并检查路径所有权、安全锚点、保护列表、白名单与锁定状态。 -3. **默认进废纸篓**:删除模式默认是 `trash`;只有显式选择永久删除才直接移除。 -4. **硬性禁区**:系统根目录、`/usr`、`/System`、`/Applications` 等位置不能被递归删除;符号链接不会被跟随。 -5. **规则刹车**:规则支持 `protect`、`min_age_days`、`skip_if_running` 与 `risky` 标记。 -6. **账本与撤销**:真实删除记录到本地 JSON 账本,仍在废纸篓中的文件可以还原。 -7. **进程保护**:结束进程前重新采样并核对名称,拒绝 Squid 自身、系统首进程和关键系统进程。 - -GUI 和 CLI 使用同一个 `squid-engine::delete` 通道,因此行为、锁定和审计结果一致。 - -## 数据与配置 - -| 用途 | macOS | Windows | -| --- | --- | --- | -| 配置与规则 | `~/Library/Application Support/squid/` | `%APPDATA%\squid\` | -| 历史账本 | `~/Library/Application Support/squid/history/` | `%APPDATA%\squid\history\` | -| 删除去向 | `~/.Trash` 或永久删除 | 回收站或永久删除 | - -Linux 使用 XDG 目录。桌面端与 CLI/TUI 共用配置和历史,因此任一端产生的清理记录都能在另一端查看。 - -常用配置: - -```toml -delete_mode = "trash" -history_keep = 60 -purge_min_age_days = 7 -purge_max_entries = 200000 -show_allocated = true -language = "zh" # en | zh -whitelist = ["~/Library/Caches/ImportantApp"] -disabled_rules = ["user-trash"] -purge_roots = ["~/code", "~/Projects", "~/Desktop"] -``` - -主要环境变量: - -| 变量 | 作用 | -| --- | --- | -| `SQUID_CONFIG_DIR` | 覆盖配置目录 | -| `SQUID_STATE_DIR` | 覆盖状态与历史目录 | -| `SQUID_LANG` | 强制 `zh` 或 `en` | -| `SQUID_UPDATE_URL` | 覆盖桌面端更新清单地址,适合测试发布通道 | -| `SQUID_TRUECOLOR` / `NO_COLOR` | 控制 TUI 颜色 | -| `SQUID_SYMBOL_CELLS` / `SQUID_CONSOLE_TRACE` | 排查 Windows 控制台字符宽度与排版 | - -## 开发与验证 - -前端: - -```bash -pnpm check -pnpm build -``` - -Rust workspace: - -```bash -cargo fmt --all -- --check -cargo clippy --workspace --all-targets -- -D warnings -cargo test --workspace -``` - -Tauri: - -```bash -cargo fmt --manifest-path src-tauri/Cargo.toml -- --check -cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings -cargo test --manifest-path src-tauri/Cargo.toml --lib -``` - -TUI 使用真实 pty 冒烟测试;Windows 控制台另有“抓帧、复放、量框”验证: - -```bash -python3 -m pip install --user pyte -python3 scripts/tui_smoke.py -python3 scripts/tui-frame-check.py --selftest -``` - -CI 同时执行 workspace 测试、MSVC 目标交叉检查、桌面前端构建和 Tauri Rust 检查。 - -## 打包与发布 - -版本必须同时写入以下四处: - -- `Cargo.toml` workspace 版本 -- `src-tauri/Cargo.toml` -- `src-tauri/tauri.conf.json` -- `package.json` - -构建安装包: - -```bash -scripts/build-macos-release.sh -scripts/build-windows-release.sh -``` - -产物: - -```text -artifacts/Squid--macOS-universal.dmg -artifacts/Squid-Setup--win-x64.exe -artifacts/SHA256SUMS.txt -``` - -发布到更新通道: - -```bash -scripts/publish-release.sh --notes /path/to/release-notes.md -``` - -发布脚本会重建 `releases` 分支,写入 `squid-update.json`、两个安装包和可选的 `squid-update.sig`。清单包含精确大小与 SHA256,客户端下载后再次校验。 - -完整发布流程、签名和清单格式见 [`docs/RELEASE.md`](docs/RELEASE.md)。 - -## 平台状态 - -| 平台 | 状态 | -| --- | --- | -| macOS | 桌面端与 CLI/TUI 完整支持,发布通用 DMG | -| Windows x64 | 桌面端与 CLI/TUI 支持,发布 NSIS 安装包 | -| Linux | 平台层与 CLI/TUI 基础实现;尚未提供内置 Linux 规则和桌面安装包 | - -## 许可证 - -Squid 使用 **GNU General Public License v3.0 only**(`GPL-3.0-only`)。完整条款见 [`LICENSE`](LICENSE)。 +**GNU General Public License v3.0 only** (`GPL-3.0-only`). See [`LICENSE`](LICENSE). diff --git a/README.zh-CN.md b/README.zh-CN.md new file mode 100644 index 0000000..3f35d0a --- /dev/null +++ b/README.zh-CN.md @@ -0,0 +1,283 @@ +# Squid + +[English](README.en.md) · [返回双语首页](README.md) + +**给你的电脑洗个澡。** + +Squid 是面向 macOS 与 Windows 的本地系统维护工具:清理可重建的缓存与系统垃圾、卸载应用并处理残留、清理项目构建产物、分析磁盘占用,以及实时查看系统状态。 + +桌面端、命令行与 TUI 共用同一套 Rust 扫描和删除引擎。清理规则、安全边界、删除账本与配置只维护一份,不依赖云端服务,也不需要 root。 + +## 产品组成 + +| 入口 | 技术栈 | 二进制 | +| --- | --- | --- | +| 桌面应用 | Tauri 2 + React 19 + TypeScript + Vite 6 | `squid-desktop` | +| 命令行 | Rust + clap | `squid` | +| 终端界面 | Rust + ratatui + crossterm | `squid state` | + +桌面端支持 macOS 12+ 与 Windows 10/11 x64;CLI/TUI 使用同一个 Rust workspace。 + +## 功能 + +| 功能 | 说明 | +| --- | --- | +| 电脑概览 | 磁盘健康、常用操作入口与 CPU、内存、存储摘要 | +| 日常清理 | macOS 38 条 / Windows 30 条内置规则,覆盖应用与浏览器缓存、日志、崩溃报告、开发缓存与废纸篓等 | +| 应用卸载 | 按名称定位应用,把应用本体与偏好、缓存、容器或 AppData 残留组成同一个卸载计划 | +| 深度清理 | 查找 `node_modules` 等可重建构建产物、磁盘镜像、安装包和陈旧下载,并保护近期仍在使用的项目 | +| 存储空间 | 逐层测量目录、查看最大子项与最大文件 | +| 实时监控 | 每两秒采样 CPU、内存、网络、磁盘、电池、卷和高占用进程,可确认后结束进程 | +| 历史与撤销 | 每次真实删除写入本地账本;仍在废纸篓或回收站中的内容可以还原 | +| 系统更新 | 从发布分支检查、校验、下载并安装新版本 | + +语言设置只提供简体中文与 English 两项,首次使用时默认选中当前系统语言。手动选择会保存为该电脑上的界面语言。 + +## 桌面应用 + +### 左侧菜单 + +- **维护**:电脑概览、日常清理、应用卸载、深度清理 +- **洞察**:存储空间、实时监控 +- **底部**:历史记录、设置 + +`⌘1`–`⌘8`(macOS)或 `Ctrl+1`–`Ctrl+8`(Windows)可以直接切换页面。 + +### 常驻托盘 + +关闭主窗口只会隐藏窗口,Squid 进程继续运行。托盘菜单提供: + +- 打开 Squid +- 日常清理 +- 应用卸载 +- 深度清理 +- 退出 Squid + +托盘菜单跟随当前界面语言。再次打开应用、双击应用图标或通过单实例唤起时,会恢复并聚焦主窗口。只有选择“退出 Squid”才会结束进程。 + +### 软件更新 + +- 设置中的系统信息面板始终显示当前系统版本、架构与 Squid 版本。 +- 只有检测到更高版本时,才显示版本变化、更新说明和操作按钮;已经是最新版本时不显示额外提示。 +- 下载完成后可安装并重启,或用与 Shift 一致的中性描边“放弃”按钮清除已下载文件。 +- 自动检查默认开启,每天最多检查一次。 +- 安装包必须通过 SHA256 与文件大小校验;带发布公钥的构建还会校验清单的 Ed25519 签名。 + +### 权限与隐私 + +- 首次启动会显示一次可选的全盘访问检查,不会强制弹出 macOS 权限窗口,也不会阻止应用启动。 +- “设置 → 系统权限”提供权限状态检查和打开“系统设置 → 隐私与安全性 → 全盘访问”的入口。 +- 没有全盘访问时,受 TCC 保护的位置会被跳过,其余功能仍然可用。 +- 存储分析与深度清理只在用户选择或配置目录后读取;文件内容不会上传。 +- 除更新检查和安装包下载外,应用不发起网络请求。 + +### 开机自启 + +“设置 → 启动”提供开机自启开关。启用后 Squid 会在当前用户登录时自动启动并保留托盘入口;该设置只写入当前用户级启动项,不需要管理员权限。 + +完整说明见 [`docs/DESKTOP.md`](docs/DESKTOP.md)。 + +## 快速开始 + +### 桌面端开发 + +环境要求: + +- Node.js 20+ 与 pnpm +- Rust stable +- macOS:Xcode Command Line Tools +- Windows:MSVC Build Tools 与 WebView2 Runtime + +```bash +pnpm install +pnpm desktop:dev +``` + +仅运行 Vite 页面时无法调用 Tauri 命令;需要验证扫描、删除、系统数据或更新流程时请使用 `pnpm desktop:dev`。 + +### CLI / TUI + +```bash +cargo install --path crates/squid-cli +# 或 +cargo build --release -p squid-cli + +squid state # TUI +squid status # 系统快照 +squid clean --dry-run # 预览可清理内容 +squid uninstall --list # 已安装应用 +squid purge ~/code # 深度清理项目构建产物 +squid analyze ~/Library/Caches # 存储分析 +squid history # 历史账本 +squid undo # 还原最近一次废纸篓会话 +``` + +常用命令: + +| 命令 | 作用 | +| --- | --- | +| `clean` | 按规则清理缓存、日志、浏览器与开发者垃圾、崩溃报告和废纸篓 | +| `uninstall [NAME]` | 定位应用并生成“本体 + 残留”卸载计划 | +| `purge [PATHS…]` | 清理项目构建目录、磁盘镜像、安装包与陈旧下载 | +| `state` | 打开包含清理、卸载、深度清理、存储、系统和历史面板的 TUI | +| `status` | 输出 CPU、内存、网络、磁盘、电池与进程快照 | +| `analyze [PATH]` | 输出目录体积树与最大文件 | +| `history` / `undo [ID]` | 查看历史或还原废纸篓会话 | +| `whitelist add\|list\|remove` | 维护永不选中的保护路径 | +| `rules` | 列出当前生效的规则 | +| `doctor` | 检查权限、配置、历史文件和生效路径 | + +所有删除命令都支持 `--dry-run`;非交互环境必须使用 `-y/--yes`。完整参数请运行 `squid --help`。 + +## 架构 + +```text +crates/ +├── squid-core 模型、路径、安全策略、设置、删除账本、进度与取消 +├── squid-platform macOS / Linux / Windows 平台适配:应用、残留、卷、回收站、进程 +├── squid-rules TOML 规则引擎:模式展开、锚点、保护、年龄与风险标记 +├── squid-stats sysinfo 采样、趋势、电池、网络与磁盘活动 +├── squid-engine clean / uninstall / purge / analyze 与唯一删除通道 +├── squid-tui ratatui 终端界面 +└── squid-cli clap 命令行入口 + +src/ React 桌面界面 +src-tauri/ Tauri 壳、命令适配、托盘、权限检查与更新器 +scripts/ 开发、验证与双平台发布脚本 +docs/ 架构、设计、桌面与发布规范 +``` + +`src-tauri` 独立于根 Cargo workspace,但直接依赖 `squid-core`、`squid-platform`、`squid-stats` 与 `squid-engine`,桌面端不维护第二套清理实现。 + +更多设计见 [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md);Nex 系列统一颜色、字体、组件和语言规范见 [`docs/DESIGN.md`](docs/DESIGN.md)。 + +## 安全模型 + +1. **索引式删除**:桌面界面只能提交扫描结果中的索引,不能提交任意待删除路径。 +2. **执行前复验**:Rust 层重新构造扫描条目,并检查路径所有权、安全锚点、保护列表、白名单与锁定状态。 +3. **默认进废纸篓**:删除模式默认是 `trash`;只有显式选择永久删除才直接移除。 +4. **硬性禁区**:系统根目录、`/usr`、`/System`、`/Applications` 等位置不能被递归删除;符号链接不会被跟随。 +5. **规则刹车**:规则支持 `protect`、`min_age_days`、`skip_if_running` 与 `risky` 标记。 +6. **账本与撤销**:真实删除记录到本地 JSON 账本,仍在废纸篓中的文件可以还原。 +7. **进程保护**:结束进程前重新采样并核对名称,拒绝 Squid 自身、系统首进程和关键系统进程。 + +GUI 和 CLI 使用同一个 `squid-engine::delete` 通道,因此行为、锁定和审计结果一致。 + +## 数据与配置 + +| 用途 | macOS | Windows | +| --- | --- | --- | +| 配置与规则 | `~/Library/Application Support/squid/` | `%APPDATA%\squid\` | +| 历史账本 | `~/Library/Application Support/squid/history/` | `%APPDATA%\squid\history\` | +| 删除去向 | `~/.Trash` 或永久删除 | 回收站或永久删除 | + +Linux 使用 XDG 目录。桌面端与 CLI/TUI 共用配置和历史,因此任一端产生的清理记录都能在另一端查看。 + +常用配置: + +```toml +delete_mode = "trash" +history_keep = 60 +purge_min_age_days = 7 +purge_max_entries = 200000 +show_allocated = true +# language 留空或删除表示跟随系统;也可手动设为 "en" 或 "zh" +language = "" +whitelist = ["~/Library/Caches/ImportantApp"] +disabled_rules = ["user-trash"] +purge_roots = ["~/code", "~/Projects", "~/Desktop"] +``` + +主要环境变量: + +| 变量 | 作用 | +| --- | --- | +| `SQUID_CONFIG_DIR` | 覆盖配置目录 | +| `SQUID_STATE_DIR` | 覆盖状态与历史目录 | +| `SQUID_LANG` | 强制 CLI/TUI 使用 `zh` 或 `en` | +| `SQUID_UPDATE_URL` | 覆盖桌面端更新清单地址,适合测试发布通道 | +| `SQUID_TRUECOLOR` / `NO_COLOR` | 控制 TUI 颜色 | +| `SQUID_SYMBOL_CELLS` / `SQUID_CONSOLE_TRACE` | 排查 Windows 控制台字符宽度与排版 | + +`SQUID_LANG` 是命令行覆盖项;桌面界面的默认语言来自系统设置,并可在应用内修改。 + +## 开发与验证 + +前端: + +```bash +pnpm check +pnpm build +``` + +Rust workspace: + +```bash +cargo fmt --all -- --check +cargo clippy --workspace --all-targets -- -D warnings +cargo test --workspace --no-fail-fast +``` + +Tauri: + +```bash +cargo fmt --manifest-path src-tauri/Cargo.toml -- --check +cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings +cargo test --manifest-path src-tauri/Cargo.toml --lib +``` + +TUI 使用真实 pty 冒烟测试;Windows 控制台另有“抓帧、复放、量框”验证: + +```bash +python3 -m pip install --user pyte +python3 scripts/tui_smoke.py +python3 scripts/tui-frame-check.py --selftest +``` + +CI 同时执行 workspace 测试、MSVC 目标交叉检查、桌面前端构建和 Tauri Rust 检查。 + +## 打包与发布 + +版本必须同时写入以下四处: + +- `Cargo.toml` workspace 版本 +- `src-tauri/Cargo.toml` +- `src-tauri/tauri.conf.json` +- `package.json` + +构建安装包: + +```bash +scripts/build-macos-release.sh +scripts/build-windows-release.sh +``` + +产物: + +```text +artifacts/Squid--macOS-universal.dmg +artifacts/Squid-Setup--win-x64.exe +artifacts/SHA256SUMS.txt +``` + +发布到更新通道: + +```bash +scripts/publish-release.sh --notes /path/to/release-notes.md +``` + +发布脚本会重建 `releases` 分支,写入 `squid-update.json`、两个安装包和可选的 `squid-update.sig`。清单包含精确大小与 SHA256,客户端下载后再次校验。 + +完整发布流程、签名和清单格式见 [`docs/RELEASE.md`](docs/RELEASE.md)。 + +## 平台状态 + +| 平台 | 状态 | +| --- | --- | +| macOS | 桌面端与 CLI/TUI 完整支持,发布通用 DMG | +| Windows x64 | 桌面端与 CLI/TUI 支持,发布 NSIS 安装包 | +| Linux | 平台层与 CLI/TUI 基础实现;尚未提供内置 Linux 规则和桌面安装包 | + +## 许可证 + +Squid 使用 **GNU General Public License v3.0 only**(`GPL-3.0-only`)。完整条款见 [`LICENSE`](LICENSE)。 diff --git a/crates/squid-core/Cargo.toml b/crates/squid-core/Cargo.toml index 28730fa..513bd53 100644 --- a/crates/squid-core/Cargo.toml +++ b/crates/squid-core/Cargo.toml @@ -23,6 +23,7 @@ rayon.workspace = true [target.'cfg(windows)'.dependencies] windows = { version = "0.58", features = [ "Win32_Foundation", + "Win32_Globalization", "Win32_Security", "Win32_Storage_FileSystem", "Win32_System_Com", diff --git a/crates/squid-core/src/settings.rs b/crates/squid-core/src/settings.rs index af534ca..c246ada 100644 --- a/crates/squid-core/src/settings.rs +++ b/crates/squid-core/src/settings.rs @@ -338,13 +338,34 @@ fn system_locale() -> Option { None } -#[cfg(not(target_os = "macos"))] +#[cfg(target_os = "windows")] fn system_locale() -> Option { - // Linux and Windows describe the language through the environment only, - // and step 3 of `detect` has already read every bit of it. + use windows::Win32::Globalization::GetUserDefaultUILanguage; + + // The environment is not a reliable proxy for the Windows display + // language: Explorer and the Store may run under a different UI locale. + let langid = unsafe { GetUserDefaultUILanguage() }; + Some(locale_from_langid(langid)) +} + +#[cfg(not(any(target_os = "macos", target_os = "windows")))] +fn system_locale() -> Option { + // Linux describes the language through the environment, already read by + // step 3 of `detect`. None } +/// Windows LANGIDs pack a primary language in the low ten bits. +#[cfg(any(target_os = "windows", test))] +fn locale_from_langid(langid: u16) -> Locale { + const PRIMARY_CHINESE: u16 = 0x04; + if langid & 0x03ff == PRIMARY_CHINESE { + Locale::Zh + } else { + Locale::En + } +} + /// Convenience for reports that want the "freed" number in display units. pub fn display_size(settings: &Settings, logical: Bytes, allocated: Bytes) -> Bytes { if settings.show_allocated && !allocated.is_zero() { @@ -454,6 +475,16 @@ mod tests { ); } + #[test] + fn windows_langid_uses_the_primary_language() { + assert_eq!(locale_from_langid(0x0004), Locale::Zh); + assert_eq!(locale_from_langid(0x0804), Locale::Zh, "zh-CN"); + assert_eq!(locale_from_langid(0x0404), Locale::Zh, "zh-TW"); + assert_eq!(locale_from_langid(0x0409), Locale::En, "en-US"); + assert_eq!(locale_from_langid(0x0809), Locale::En, "en-GB"); + assert_eq!(locale_from_langid(0x0411), Locale::En, "ja-JP fallback"); + } + #[test] fn squid_lang_beats_the_desktop_locale() { assert_eq!( diff --git a/docs/DESIGN.md b/docs/DESIGN.md index e968e44..9dc9899 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -1,6 +1,6 @@ # Nex 应用视觉规范 -版本:1.0 +版本:1.1 状态:Nex 系列应用统一标准 基准实现:`nex_shift` 的主色系 @@ -12,7 +12,8 @@ Squid 以及后续 Nex 应用不得再各自定义蓝色或其它颜色的主操 - 主操作、选中态、焦点环和进度使用 Nex 主色。 - 页面底色、卡片和正文使用暖中性色,不使用冷蓝色底。 - 绿色、红色、黄色只表达成功、危险和警告,不作为品牌主色。 -- 分类色可以保留各自的语义色,但不得替代主操作色。 +- 图表、分类和装饰只使用主色、暖中性色或成功/警告/危险状态色。 +- 不引入蓝色、紫色、青色、粉色等第二品牌色;状态色也不得用于装饰。 - 新界面必须引用 `src/styles.css` 中的 `--nex-*` 常量,不写新的主色十六进制值。 ## 2. 品牌常量 @@ -39,6 +40,19 @@ Squid 以及后续 Nex 应用不得再各自定义蓝色或其它颜色的主操 主色高亮需要透明度时使用 `rgba(var(--nex-primary-rgb), α)`,其中 `--nex-primary-rgb` 为 `242, 106, 51`。 +### 状态色 + +| 常量 | 值 | 用途 | +| --- | --- | --- | +| `--nex-success` / `-strong` / `-soft` | `#17865F` / `#126D4C` / `#E7F8F1` | 完成、安全、已授权 | +| `--nex-warning` / `-strong` / `-soft` | `#A97729` / `#8C6C40` / `#FFF8E9` | 警告、需要注意 | +| `--nex-danger` / `-strong` / `-soft` | `#C85A62` / `#A64048` / `#FFEDEF` | 错误、危险操作 | + +对应的 `--nex-success-rgb`、`--nex-warning-rgb`、`--nex-danger-rgb` +用于状态色透明度。组件通过 `.tone-primary`、`.tone-success`、 +`.tone-warning`、`.tone-danger`、`.tone-neutral` 五种语义色调取色, +不新增分类专用色调。 + ## 3. 图标渐变 应用图标的品牌渐变沿用 Shift: @@ -47,7 +61,8 @@ Squid 以及后续 Nex 应用不得再各自定义蓝色或其它颜色的主操 - 中段 `#FF6B35` - 终点 `#C66BFF` -图标主体的描边和阴影必须使用暖色,不得保留旧版蓝色。 +图标主体允许保留应用图标自身的暖橙渐变与粉色高光;它们属于图标资产, +不得扩展为界面装饰色。图标主体的描边和阴影必须使用暖色,不得保留旧版蓝色。 ### 侧栏品牌锁定 @@ -95,18 +110,26 @@ Squid 以及后续 Nex 应用不得再各自定义蓝色或其它颜色的主操 - 正文不使用纯黑;标题使用 `--nex-ink-strong`。 - 更新面板面向使用者,只展示当前系统版本、版本状态、更新说明、进度与操作; 更新地址、安装包文件名和哈希留在后端校验流程中,不进入常规界面。 +- 下载完成后的“放弃”使用中性描边按钮:34px 高、9px 圆角、暖白半透明表面、 + `--nex-ink` 文字;悬停仅切换主色描边与白色表面,与 Shift 保持一致。 +- 软件更新不再重复显示“已是最新版本”;当前版本只在系统信息面板中展示, + 只有发现更新包时才展开版本变化与操作区。 -## 6. 旧变量兼容 +## 6. 语言与本地化 -现有组件仍引用 `--blue`、`--blue-deep`、`--blue-soft`。这三个变量已经 -分别别名为 `--nex-primary`、`--nex-primary-strong`、`--nex-primary-soft`, -因此不会再渲染蓝色。新增代码应直接使用 `--nex-*` 常量;迁移旧组件时 -可以逐步移除 `--blue-*` 别名,但不得改回独立颜色值。 +- 首次启动默认跟随系统语言:macOS 读取 `AppleLocale` / `AppleLanguages`, + Windows 读取 `GetUserDefaultUILanguage`,Linux 读取标准 locale 环境变量。 +- 设置中只提供“简体中文”和“English”两个语言选项;尚未手动选择时,选中项反映当前系统语言。 +- 手动选择语言会写入 `config.toml` 的 `language`,后续启动继续使用该选择。 +- 托盘菜单与主界面使用同一语言,并在切换后立即刷新。 +- 当前支持中文与英文,其他系统语言回退到英文。 ## 7. 验收 -- 全应用不出现蓝色主按钮、蓝色选中态或蓝色焦点环。 +- 全应用不出现蓝色、紫色、青色或粉色界面装饰;品牌色只有橙色。 +- 状态色只用于成功、警告和危险,不作为卡片或图表的分类装饰色。 - 页面底色为 `#F5EEE7`,面板为暖白,不使用冷蓝渐变。 - Settings、首次启动权限卡和更新面板共享同一套主色。 - 应用图标与界面使用同一组暖色品牌常量。 - 正文和标签不小于 11px,标题使用统一字号阶梯,不出现 7–10px 的正文。 +- 默认语言与系统一致,切换语言后主界面和托盘同步更新。 diff --git a/docs/DESKTOP.md b/docs/DESKTOP.md index 03d5e0d..2fa1cdc 100644 --- a/docs/DESKTOP.md +++ b/docs/DESKTOP.md @@ -52,7 +52,7 @@ cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings | Storage | Measures a chosen folder, exposes the largest children, drills down, and finds the largest files | | Real-time monitor | Live CPU, memory, network, disk, battery, volume and process data; process termination asks for confirmation | | History | Lists cleanup sessions, shows the ledger, restores files that are still in Trash/Recycle Bin, and opens the bin | -| Settings | Language, deletion mode, history retention, protected paths, local file locations, and software updates | +| Settings | Chinese/English language selection that defaults to the system language, launch at login, deletion mode, history retention, protected paths, local file locations, and software updates | `⌘1`–`⌘8` on macOS and `Ctrl+1`–`Ctrl+8` on Windows switch screens. @@ -60,7 +60,13 @@ cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings Squid keeps running after its main window is closed. The tray menu can reopen the window and jump directly to Daily cleanup, Uninstall apps or Deep Clean. -Use **Quit Squid** in the same menu to stop the background process. +The tray follows the active interface language. Use **Quit Squid** in the same +menu to stop the background process. + +**Settings → Startup** registers the app for the current user only. macOS +uses a user LaunchAgent, Windows uses the current-user Run key, and Linux uses +an XDG autostart desktop entry. Enabling or disabling launch at login does not +require administrator access. ## Safety boundary @@ -115,6 +121,8 @@ The update implementation mirrors `nex_shift`: bytes. - The application checks at most once a day when automatic checks are enabled; the last-check day lives in `updates.json`. +- A verified download can be installed and restarted, or discarded with the + neutral outlined action shared with `nex_shift`. - macOS mounts the DMG after exit and swaps `Squid.app` with rollback on failure. - Windows waits for `squid-desktop.exe` to exit, runs the same NSIS installer silently, then relaunches it from `%LOCALAPPDATA%\Programs\Squid`. diff --git a/package.json b/package.json index 2f06f8b..e688bbc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "squid-desktop", "private": true, - "version": "0.1.4", + "version": "0.1.5", "type": "module", "scripts": { "dev": "vite --port 1420 --strictPort", diff --git a/release/0.1.5/README-Windows-x64.txt b/release/0.1.5/README-Windows-x64.txt new file mode 100644 index 0000000..ba9f738 --- /dev/null +++ b/release/0.1.5/README-Windows-x64.txt @@ -0,0 +1,27 @@ +Squid 0.1.5 - Windows x64 + +系统要求 +-------- +- Windows 10 或 Windows 11(x64;ARM64 设备通过系统兼容层运行)。 +- Microsoft Edge WebView2 Runtime。Windows 10/11 通常已内置;如果 Squid + 启动后窗口空白,请从微软官方页面安装 WebView2 Evergreen Runtime: + https://developer.microsoft.com/microsoft-edge/webview2/ +- 安装与运行都不需要管理员权限。安装位置为 + %LOCALAPPDATA%\Programs\Squid。 + +安装 +---- +1. 运行 Squid-Setup-0.1.5-win-x64.exe。 +2. 这是未签名构建。若 SmartScreen 显示警告,请选择“更多信息” > “仍要运行”。 +3. 卸载请在 Windows“设置 > 应用”中移除 Squid。 + +更新 +---- +Squid 使用与 nex_shift 一致的 releases 分支更新通道。更新包会先校验 +文件大小与 SHA256,再在退出后运行同一个安装程序。若构建时写入发布公钥, +还会验证清单的 Ed25519 签名。 + +校验 +---- +PowerShell: + Get-FileHash .\Squid-Setup-0.1.5-win-x64.exe -Algorithm SHA256 diff --git a/release/0.1.5/RELEASE_NOTES.md b/release/0.1.5/RELEASE_NOTES.md new file mode 100644 index 0000000..f921cde --- /dev/null +++ b/release/0.1.5/RELEASE_NOTES.md @@ -0,0 +1,9 @@ +Squid 0.1.5 + +- 语言默认跟随系统;macOS、Windows 与 Linux 分别读取对应的系统语言设置。 +- 语言设置只保留中文与 English 两项,默认选中当前系统语言;切换后托盘菜单同步更新。 +- 设置中新增开机自启开关,使用当前用户级启动项,无需管理员权限。 +- 软件更新下载完成后的「放弃」按钮改为与 Shift 一致的中性描边样式。 +- 统一 Nex 暖色设计语言:界面只使用橙色主色、暖中性色与成功/警告/危险状态色,移除蓝色、紫色、青色和粉色装饰。 +- README 提供双语首页以及完整的简体中文版和英文版。 +- macOS 与 Windows 同步发布 0.1.5。 diff --git a/release/0.1.5/SHA256SUMS.txt b/release/0.1.5/SHA256SUMS.txt new file mode 100644 index 0000000..325cd30 --- /dev/null +++ b/release/0.1.5/SHA256SUMS.txt @@ -0,0 +1,3 @@ +57028b3872a9dbe965752b6451cc06fcec19d6d92b2e40710e5bbd49b2b60bd2 Squid-0.1.5-macOS-universal.dmg +9e85eefc348e066f873f3b91c6202f0e906c166a0c50a8fec4de6db7dc1f907b Squid-Setup-0.1.5-win-x64.exe +2048178675631a41f39961413d6865c462e5366ffeb890431c373cd7cb8440cb README-Windows-x64.txt diff --git a/release/0.1.5/Squid-0.1.5-macOS-universal.dmg b/release/0.1.5/Squid-0.1.5-macOS-universal.dmg new file mode 100644 index 0000000..fa3a7b8 Binary files /dev/null and b/release/0.1.5/Squid-0.1.5-macOS-universal.dmg differ diff --git a/release/0.1.5/Squid-Setup-0.1.5-win-x64.exe b/release/0.1.5/Squid-Setup-0.1.5-win-x64.exe new file mode 100644 index 0000000..76b36f3 Binary files /dev/null and b/release/0.1.5/Squid-Setup-0.1.5-win-x64.exe differ diff --git a/release/0.1.5/squid-update.json b/release/0.1.5/squid-update.json new file mode 100644 index 0000000..b8ec820 --- /dev/null +++ b/release/0.1.5/squid-update.json @@ -0,0 +1,18 @@ +{ + "schema": 1, + "version": "0.1.5", + "date": "2026-11-05", + "notes": "Squid 0.1.5\n\n- 语言默认跟随系统;macOS、Windows 与 Linux 分别读取对应的系统语言设置。\n- 语言设置只保留中文与 English 两项,默认选中当前系统语言;切换后托盘菜单同步更新。\n- 设置中新增开机自启开关,使用当前用户级启动项,无需管理员权限。\n- 软件更新下载完成后的「放弃」按钮改为与 Shift 一致的中性描边样式。\n- 统一 Nex 暖色设计语言:界面只使用橙色主色、暖中性色与成功/警告/危险状态色,移除蓝色、紫色、青色和粉色装饰。\n- README 提供双语首页以及完整的简体中文版和英文版。\n- macOS 与 Windows 同步发布 0.1.5。", + "artifacts": { + "macos": { + "file": "Squid-0.1.5-macOS-universal.dmg", + "sha256": "57028b3872a9dbe965752b6451cc06fcec19d6d92b2e40710e5bbd49b2b60bd2", + "size": 10702261 + }, + "windows": { + "file": "Squid-Setup-0.1.5-win-x64.exe", + "sha256": "9e85eefc348e066f873f3b91c6202f0e906c166a0c50a8fec4de6db7dc1f907b", + "size": 3354754 + } + } +} diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index b8bccc1..68424cc 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -3489,7 +3489,7 @@ dependencies = [ [[package]] name = "squid-core" -version = "0.1.4" +version = "0.1.5" dependencies = [ "anyhow", "chrono", @@ -3508,10 +3508,11 @@ dependencies = [ [[package]] name = "squid-desktop" -version = "0.1.4" +version = "0.1.5" dependencies = [ "base64 0.22.1", "chrono", + "dirs 6.0.0", "ed25519-dalek", "globset", "hex", @@ -3532,7 +3533,7 @@ dependencies = [ [[package]] name = "squid-engine" -version = "0.1.4" +version = "0.1.5" dependencies = [ "anyhow", "chrono", @@ -3552,7 +3553,7 @@ dependencies = [ [[package]] name = "squid-platform" -version = "0.1.4" +version = "0.1.5" dependencies = [ "dirs 6.0.0", "libc", @@ -3569,7 +3570,7 @@ dependencies = [ [[package]] name = "squid-rules" -version = "0.1.4" +version = "0.1.5" dependencies = [ "globset", "serde", @@ -3581,7 +3582,7 @@ dependencies = [ [[package]] name = "squid-stats" -version = "0.1.4" +version = "0.1.5" dependencies = [ "chrono", "libc", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index fc3b067..67b0af2 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "squid-desktop" -version = "0.1.4" +version = "0.1.5" description = "Squid — a CleanMyMac-inspired cleaner, uninstaller and system monitor." authors = ["squid contributors"] edition = "2021" @@ -28,6 +28,7 @@ tauri = { version = "2.11", features = ["tray-icon", "image-png", "macos-private tauri-plugin-dialog = "2" tauri-plugin-opener = "2" tauri-plugin-single-instance = "2" +dirs = "6" serde = { version = "1", features = ["derive"] } serde_json = "1" chrono = { version = "0.4", features = ["clock"] } diff --git a/src-tauri/src/app.rs b/src-tauri/src/app.rs index 1aa2f12..4c6637e 100644 --- a/src-tauri/src/app.rs +++ b/src-tauri/src/app.rs @@ -9,8 +9,8 @@ use squid_core::ledger::{self, Session}; use squid_core::paths; use squid_core::progress::{CancelToken, Event, Progress}; use squid_core::{ - AppInfo, Bytes, Category, CleanupItem, DeleteMode, ItemKind, LockReason, ScanReport, Settings, - UninstallPlan, + AppInfo, Bytes, Category, CleanupItem, DeleteMode, ItemKind, Locale, LockReason, ScanReport, + Settings, UninstallPlan, }; use squid_engine::analyze::{self, FileEntry, Node}; use squid_engine::delete::{self, DeleteJob, DeleteOutcome}; @@ -316,6 +316,7 @@ pub struct SettingsView { purge_min_age_days: u64, show_allocated: bool, language: Option, + effective_language: String, history_keep: usize, setup_reviewed: bool, errors: Vec, @@ -330,6 +331,7 @@ impl SettingsView { purge_min_age_days: settings.purge_min_age_days, show_allocated: settings.show_allocated, language: settings.language.clone(), + effective_language: Locale::detect(settings).code().into(), history_keep: settings.history_keep, setup_reviewed: settings.desktop_setup_reviewed, errors, @@ -835,7 +837,7 @@ pub struct SettingsPatch { } #[tauri::command] -pub async fn settings_save(patch: SettingsPatch) -> Result { +pub async fn settings_save(app: AppHandle, patch: SettingsPatch) -> Result { tauri::async_runtime::spawn_blocking(move || { let (mut settings, mut errors) = Settings::load(); if let Some(mode) = patch.delete_mode { @@ -860,6 +862,7 @@ pub async fn settings_save(patch: SettingsPatch) -> Result settings .save() .map_err(|error| format!("Could not save settings: {error}"))?; + crate::sync_tray(&app, Locale::detect(&settings)); errors.retain(|error| !error.contains("config.toml")); Ok(SettingsView::from_settings(&settings, errors)) }) diff --git a/src-tauri/src/autostart.rs b/src-tauri/src/autostart.rs new file mode 100644 index 0000000..fda228b --- /dev/null +++ b/src-tauri/src/autostart.rs @@ -0,0 +1,249 @@ +//! User-level launch-at-login integration. +//! +//! Every platform writes only the current user's startup configuration. Failing +//! to create or remove it is reported to Settings so the toggle can roll back. + +use std::path::{Path, PathBuf}; +#[cfg(target_os = "windows")] +use std::process::Command; + +#[cfg(any( + target_os = "windows", + not(any(target_os = "macos", target_os = "windows")) +))] +const APP_NAME: &str = "Squid"; + +#[tauri::command] +pub fn autostart_status() -> Result { + status().map_err(|error| format!("Could not read launch-at-login state: {error}")) +} + +#[tauri::command] +pub fn set_autostart(enabled: bool) -> Result { + set(enabled).map_err(|error| format!("Could not update launch-at-login state: {error}")) +} + +fn set(enabled: bool) -> Result { + if enabled { + enable()?; + } else { + disable()?; + } + status() +} + +fn executable() -> Result { + std::env::current_exe().map_err(|error| error.to_string()) +} + +#[cfg(target_os = "macos")] +fn registration_path() -> Result { + let home = dirs::home_dir().ok_or("The home directory is unavailable.")?; + Ok(home + .join("Library") + .join("LaunchAgents") + .join("app.nex.squid.plist")) +} + +#[cfg(target_os = "macos")] +fn status() -> Result { + Ok(registration_path()?.is_file()) +} + +#[cfg(target_os = "macos")] +fn enable() -> Result<(), String> { + let path = registration_path()?; + let parent = path + .parent() + .ok_or("The LaunchAgents directory is unavailable.")?; + std::fs::create_dir_all(parent).map_err(|error| error.to_string())?; + std::fs::write(&path, launch_agent_plist(&executable()?)).map_err(|error| error.to_string()) +} + +#[cfg(target_os = "macos")] +fn disable() -> Result<(), String> { + let path = registration_path()?; + match std::fs::remove_file(path) { + Ok(()) => Ok(()), + Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(()), + Err(error) => Err(error.to_string()), + } +} + +#[cfg(target_os = "macos")] +fn launch_agent_plist(exe: &Path) -> String { + let target = exe + .ancestors() + .find(|path| path.extension().is_some_and(|extension| extension == "app")) + .unwrap_or(exe); + let arguments = if target == exe { + format!("{}", xml_escape(&target.to_string_lossy())) + } else { + format!( + "/usr/bin/open{}", + xml_escape(&target.to_string_lossy()) + ) + }; + format!( + r#" + + + + Label + app.nex.squid + ProgramArguments + {arguments} + RunAtLoad + + LimitLoadToSessionType + Aqua + + +"# + ) +} + +#[cfg(target_os = "macos")] +fn xml_escape(text: &str) -> String { + text.replace('&', "&") + .replace('<', "<") + .replace('>', ">") + .replace('"', """) + .replace('\'', "'") +} + +#[cfg(target_os = "windows")] +const RUN_KEY: &str = r"HKCU\Software\Microsoft\Windows\CurrentVersion\Run"; +#[cfg(target_os = "windows")] +const RUN_VALUE: &str = APP_NAME; + +#[cfg(target_os = "windows")] +fn status() -> Result { + let output = hidden_command("reg.exe") + .args(["query", RUN_KEY, "/v", RUN_VALUE]) + .output() + .map_err(|error| error.to_string())?; + Ok(output.status.success()) +} + +#[cfg(target_os = "windows")] +fn enable() -> Result<(), String> { + let exe = executable()?; + let value = format!("\"{}\"", exe.display()); + let output = hidden_command("reg.exe") + .args([ + "add", RUN_KEY, "/v", RUN_VALUE, "/t", "REG_SZ", "/d", &value, "/f", + ]) + .output() + .map_err(|error| error.to_string())?; + command_result(output) +} + +#[cfg(target_os = "windows")] +fn disable() -> Result<(), String> { + if !status()? { + return Ok(()); + } + let output = hidden_command("reg.exe") + .args(["delete", RUN_KEY, "/v", RUN_VALUE, "/f"]) + .output() + .map_err(|error| error.to_string())?; + command_result(output) +} + +#[cfg(target_os = "windows")] +fn hidden_command(program: &str) -> Command { + use std::os::windows::process::CommandExt; + + const CREATE_NO_WINDOW: u32 = 0x0800_0000; + let mut command = Command::new(program); + command.creation_flags(CREATE_NO_WINDOW); + command +} + +#[cfg(target_os = "windows")] +fn command_result(output: std::process::Output) -> Result<(), String> { + if output.status.success() { + return Ok(()); + } + let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string(); + Err(if stderr.is_empty() { + format!("reg.exe exited with {}", output.status) + } else { + stderr + }) +} + +#[cfg(not(any(target_os = "macos", target_os = "windows")))] +fn registration_path() -> Result { + dirs::config_dir() + .map(|directory| directory.join("autostart").join("squid.desktop")) + .ok_or_else(|| "The user configuration directory is unavailable.".to_string()) +} + +#[cfg(not(any(target_os = "macos", target_os = "windows")))] +fn status() -> Result { + Ok(registration_path()?.is_file()) +} + +#[cfg(not(any(target_os = "macos", target_os = "windows")))] +fn enable() -> Result<(), String> { + let path = registration_path()?; + let parent = path + .parent() + .ok_or("The autostart directory is unavailable.")?; + std::fs::create_dir_all(parent).map_err(|error| error.to_string())?; + std::fs::write(&path, desktop_entry(&executable()?)).map_err(|error| error.to_string()) +} + +#[cfg(not(any(target_os = "macos", target_os = "windows")))] +fn disable() -> Result<(), String> { + let path = registration_path()?; + match std::fs::remove_file(path) { + Ok(()) => Ok(()), + Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(()), + Err(error) => Err(error.to_string()), + } +} + +#[cfg(not(any(target_os = "macos", target_os = "windows")))] +fn desktop_entry(exe: &Path) -> String { + let executable = exe + .to_string_lossy() + .replace('\\', "\\\\") + .replace('"', "\\\"") + .replace('$', "\\$"); + format!( + "[Desktop Entry]\n\ + Type=Application\n\ + Name={APP_NAME}\n\ + Comment=System care for your computer\n\ + Exec=\"{executable}\"\n\ + Terminal=false\n\ + X-GNOME-Autostart-enabled=true\n" + ) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[cfg(target_os = "macos")] + #[test] + fn launch_agent_opens_the_app_bundle() { + let plist = launch_agent_plist(Path::new( + "/Applications/Squid & Tools.app/Contents/MacOS/squid-desktop", + )); + assert!(plist.contains("/usr/bin/open")); + assert!(plist.contains("/Applications/Squid & Tools.app")); + assert!(plist.contains("RunAtLoad")); + } + + #[cfg(not(any(target_os = "macos", target_os = "windows")))] + #[test] + fn desktop_entry_quotes_the_executable() { + let entry = desktop_entry(Path::new("/home/me/Squid Tools/squid-desktop")); + assert!(entry.contains("Exec=\"/home/me/Squid Tools/squid-desktop\"")); + assert!(entry.contains("X-GNOME-Autostart-enabled=true")); + } +} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index db3e79a..25de1dc 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,8 +1,10 @@ mod app; +mod autostart; mod permissions; mod process; mod update; +use squid_core::{Locale, Settings}; use tauri::{ menu::{Menu, MenuItem, PredefinedMenuItem}, tray::TrayIconBuilder, @@ -25,15 +27,53 @@ fn navigate_to(app: &AppHandle, page: &'static str) { let _ = app.emit("squid://navigate", page); } -fn create_tray(app: &AppHandle) -> tauri::Result<()> { - let open = MenuItem::with_id(app, "open", "打开 Squid", true, None::<&str>)?; - let cleanup = MenuItem::with_id(app, "cleanup", "日常清理", true, None::<&str>)?; - let apps = MenuItem::with_id(app, "applications", "应用卸载", true, None::<&str>)?; - let purge = MenuItem::with_id(app, "purge", "深度清理", true, None::<&str>)?; - let quit = MenuItem::with_id(app, "quit", "退出 Squid", true, None::<&str>)?; +fn tray_text(locale: Locale, en: &'static str, zh: &'static str) -> &'static str { + if locale == Locale::Zh { + zh + } else { + en + } +} + +fn tray_menu(app: &AppHandle, locale: Locale) -> tauri::Result> { + let open = MenuItem::with_id( + app, + "open", + tray_text(locale, "Open Squid", "打开 Squid"), + true, + None::<&str>, + )?; + let cleanup = MenuItem::with_id( + app, + "cleanup", + tray_text(locale, "Daily cleanup", "日常清理"), + true, + None::<&str>, + )?; + let apps = MenuItem::with_id( + app, + "applications", + tray_text(locale, "Uninstall apps", "应用卸载"), + true, + None::<&str>, + )?; + let purge = MenuItem::with_id( + app, + "purge", + tray_text(locale, "Deep Clean", "深度清理"), + true, + None::<&str>, + )?; + let quit = MenuItem::with_id( + app, + "quit", + tray_text(locale, "Quit Squid", "退出 Squid"), + true, + None::<&str>, + )?; let first_separator = PredefinedMenuItem::separator(app)?; let last_separator = PredefinedMenuItem::separator(app)?; - let menu = Menu::with_items( + Menu::with_items( app, &[ &open, @@ -44,7 +84,11 @@ fn create_tray(app: &AppHandle) -> tauri::Result<()> { &last_separator, &quit, ], - )?; + ) +} + +fn create_tray(app: &AppHandle, locale: Locale) -> tauri::Result<()> { + let menu = tray_menu(app, locale)?; let icon = app .default_window_icon() .cloned() @@ -67,6 +111,15 @@ fn create_tray(app: &AppHandle) -> tauri::Result<()> { Ok(()) } +pub(crate) fn sync_tray(app: &AppHandle, locale: Locale) { + let Some(tray) = app.tray_by_id("squid-tray") else { + return; + }; + if let Ok(menu) = tray_menu(app, locale) { + let _ = tray.set_menu(Some(menu)); + } +} + #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { let app = tauri::Builder::default() @@ -102,6 +155,8 @@ pub fn run() { app::settings_save, app::whitelist_add, app::whitelist_remove, + autostart::autostart_status, + autostart::set_autostart, app::reveal_path, app::open_trash, permissions::permission_status, @@ -114,7 +169,8 @@ pub fn run() { update::set_update_check_enabled, ]) .setup(|app| { - create_tray(app.handle())?; + let (settings, _) = Settings::load(); + create_tray(app.handle(), Locale::detect(&settings))?; update::spawn_startup_check(app.handle()); Ok(()) }) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b869bce..fc62af3 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Squid", - "version": "0.1.4", + "version": "0.1.5", "identifier": "app.nex.squid", "mainBinaryName": "squid-desktop", "build": { diff --git a/src/App.tsx b/src/App.tsx index d942e6e..e1e51a5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -230,11 +230,11 @@ export default function App() { const changeLanguage = useCallback( async (nextLanguage: Language) => { - setLang(nextLanguage); - document.documentElement.lang = nextLanguage === "zh" ? "zh-CN" : "en"; try { const next = await api.settingsSave({ language: nextLanguage }); setSettings(next); + setLang(next.effectiveLanguage); + document.documentElement.lang = next.effectiveLanguage === "zh" ? "zh-CN" : "en"; } catch (reason) { push(messageFrom(reason), "danger"); } diff --git a/src/components/UpdatePanel.tsx b/src/components/UpdatePanel.tsx index d519e71..cd744ff 100644 --- a/src/components/UpdatePanel.tsx +++ b/src/components/UpdatePanel.tsx @@ -184,7 +184,8 @@ export function UpdatePanel({ ) : null} {verified && !flow.installing ? ( - -
- +
@@ -474,7 +550,7 @@ export function SettingsPage({
- +
diff --git a/src/pages/StoragePage.tsx b/src/pages/StoragePage.tsx index d777d41..44d8d8a 100644 --- a/src/pages/StoragePage.tsx +++ b/src/pages/StoragePage.tsx @@ -31,7 +31,7 @@ import { SectionTitle, } from "../components/ui"; -const BAR_TONES = ["blue", "violet", "cyan", "teal", "orange", "pink", "indigo", "slate"]; +const BAR_TONES = ["primary", "neutral"] as const; function nodeSize(node: { allocated: number; logical: number }): number { return node.allocated || node.logical; diff --git a/src/pages/SystemPage.tsx b/src/pages/SystemPage.tsx index 2e23d44..f460952 100644 --- a/src/pages/SystemPage.tsx +++ b/src/pages/SystemPage.tsx @@ -96,7 +96,7 @@ export function SystemPage({
- +
@@ -108,7 +108,7 @@ export function SystemPage({ value={snapshot?.cpu.total ?? 0} size={168} stroke={13} - tone="blue" + tone="primary" label={t("Processor usage", "处理器占用")} > @@ -142,7 +142,7 @@ export function SystemPage({
- +
@@ -160,7 +160,7 @@ export function SystemPage({ value={memoryPercent} size={168} stroke={13} - tone="violet" + tone="primary" label={t("Memory usage", "内存占用")} > {Math.round(memoryPercent)}% @@ -185,7 +185,7 @@ export function SystemPage({
- +
@@ -319,7 +319,7 @@ export function SystemPage({ const use = percent(volume.total - volume.free, volume.total); return (
- +
@@ -331,7 +331,7 @@ export function SystemPage({ 88 ? "red" : "blue"} + tone={use > 88 ? "danger" : "primary"} />
{Math.round(use)}% @@ -363,7 +363,7 @@ export function SystemPage({ snapshot?.network.interfaces ?? 0, )} 个网络接口`, )} - +
span { @@ -554,26 +507,26 @@ select:focus-visible, display: flex; align-items: center; gap: 9px; - color: #516b84; + color: var(--nex-muted); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-medium); } .topbar-title > span { - color: #395673; + color: var(--nex-ink); font-size: var(--nex-text-2xs); } .topbar-title > i { width: 1px; height: 11px; - background: rgba(55, 84, 113, 0.18); + background: var(--nex-line-strong); } .topbar-title small { max-width: 240px; overflow: hidden; - color: #93a1b0; + color: var(--nex-muted-soft); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-body); text-overflow: ellipsis; @@ -591,10 +544,10 @@ select:focus-visible, align-items: center; gap: 5px; padding: 5px 9px; - border: 1px solid rgba(31, 157, 115, 0.1); + border: 1px solid rgba(var(--nex-success-rgb), 0.14); border-radius: 20px; - color: #388a6d; - background: rgba(236, 249, 244, 0.8); + color: var(--nex-success); + background: var(--nex-success-soft); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-semibold); } @@ -644,7 +597,7 @@ select:focus-visible, .page-eyebrow { margin-bottom: 7px; - color: #7890a7; + color: var(--nex-primary-strong); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-heavy); letter-spacing: 0.075em; @@ -663,7 +616,7 @@ select:focus-visible, .page-header p { max-width: 650px; margin: 10px 0 0; - color: #73869b; + color: var(--nex-muted); font-size: var(--nex-text-2xs); line-height: var(--nex-leading-body); } @@ -752,8 +705,8 @@ select:focus-visible, .button.is-danger { color: #fff; border-color: rgba(178, 44, 53, 0.12); - background: linear-gradient(145deg, #f07179, #df545d); - box-shadow: 0 8px 18px rgba(202, 55, 65, 0.18); + background: linear-gradient(145deg, var(--nex-danger), var(--nex-danger-strong)); + box-shadow: 0 8px 18px rgba(var(--nex-danger-rgb), 0.18); } .button.is-sm { @@ -802,7 +755,7 @@ select:focus-visible, } .text-button:hover { - color: var(--blue); + color: var(--nex-primary); } .checkbox { @@ -812,7 +765,7 @@ select:focus-visible, width: 17px; height: 17px; padding: 0; - border: 1.5px solid rgba(79, 103, 128, 0.26); + border: 1.5px solid var(--nex-line-strong); border-radius: 5px; color: #fff; background: #fff; @@ -822,13 +775,13 @@ select:focus-visible, } .checkbox.is-checked { - border-color: var(--blue); + border-color: var(--nex-primary); background: linear-gradient(145deg, #ff9a68, var(--nex-primary)); } .checkbox.is-mixed { - border-color: var(--blue); - background: var(--blue); + border-color: var(--nex-primary); + background: var(--nex-primary); } .checkbox.is-mixed > span { @@ -849,8 +802,8 @@ select:focus-visible, height: 22px; padding: 0; border-radius: 22px; - background: #cdd8e3; - box-shadow: inset 0 1px 2px rgba(41, 72, 105, 0.12); + background: color-mix(in srgb, var(--nex-muted-soft) 42%, var(--nex-paper)); + box-shadow: inset 0 1px 2px rgba(89, 51, 34, 0.12); transition: background 0.18s ease; } @@ -862,7 +815,7 @@ select:focus-visible, height: 18px; border-radius: 50%; background: #fff; - box-shadow: 0 2px 4px rgba(35, 64, 93, 0.2); + box-shadow: 0 2px 4px rgba(61, 32, 19, 0.2); transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1); } @@ -880,7 +833,7 @@ select:focus-visible, height: 5px; overflow: hidden; border-radius: 5px; - background: rgba(96, 124, 151, 0.12); + background: rgba(125, 98, 86, 0.12); } .usage-bar > span, @@ -899,10 +852,10 @@ select:focus-visible, gap: 9px; margin: 0 0 17px; padding: 10px 12px; - border: 1px solid rgba(217, 62, 73, 0.1); + border: 1px solid rgba(var(--nex-danger-rgb), 0.15); border-radius: 11px; - color: #a64048; - background: rgba(255, 239, 240, 0.86); + color: var(--nex-danger-strong); + background: var(--nex-danger-soft); font-size: var(--nex-text-2xs); line-height: var(--nex-leading-body); } @@ -981,8 +934,8 @@ select:focus-visible, } .status-chip.is-live { - color: #17865f; - background: #e7f8f1; + color: var(--nex-success); + background: var(--nex-success-soft); } .status-chip.is-restored { @@ -1002,7 +955,7 @@ select:focus-visible, border: 1px solid var(--nex-line); border-radius: var(--radius-xl); background: - radial-gradient(circle at 84% 45%, rgba(242, 106, 51, 0.16), transparent 29%), + radial-gradient(circle at 84% 45%, rgba(var(--nex-primary-rgb), 0.16), transparent 29%), radial-gradient(circle at 58% -26%, rgba(255, 255, 255, 0.98), transparent 31%), linear-gradient(125deg, #fffaf6, #fff1e7 56%, #ffe9dc); box-shadow: @@ -1122,7 +1075,7 @@ select:focus-visible, border-radius: 50%; background: radial-gradient( circle, - rgba(242, 106, 51, 0.14), + rgba(var(--nex-primary-rgb), 0.14), rgba(255, 178, 92, 0.06) 50%, transparent 69% ); @@ -1148,13 +1101,13 @@ select:focus-visible, } .gauge-value { - stroke: var(--tone, var(--blue)); + stroke: var(--tone, var(--nex-primary)); filter: drop-shadow(0 5px 6px rgba(var(--nex-primary-rgb), 0.13)); transition: stroke-dashoffset 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); } -.tone-red.gauge .gauge-value { - stroke: var(--red); +.tone-danger.gauge .gauge-value { + stroke: var(--nex-danger); } .gauge-center { @@ -1230,7 +1183,7 @@ select:focus-visible, align-items: center; gap: 11px; padding: 14px; - border: 1px solid rgba(50, 88, 126, 0.075); + border: 1px solid var(--nex-line); border-radius: 15px; color: var(--ink); background: @@ -1247,7 +1200,7 @@ select:focus-visible, .quick-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--tone) 22%, transparent); - box-shadow: 0 13px 28px rgba(38, 70, 107, 0.09); + box-shadow: 0 13px 28px rgba(89, 51, 34, 0.09); } .quick-icon { @@ -1297,7 +1250,7 @@ select:focus-visible, .metric-panel { padding: 15px; - border: 1px solid rgba(48, 87, 126, 0.075); + border: 1px solid var(--nex-line); border-radius: 15px; background: rgba(255, 255, 255, 0.72); box-shadow: var(--shadow-card); @@ -1367,7 +1320,7 @@ select:focus-visible, flex-direction: column; padding: 14px; overflow: hidden; - border: 1px solid rgba(47, 87, 126, 0.08); + border: 1px solid var(--nex-line); border-radius: 15px; background: radial-gradient(circle at 0 0, var(--tone-soft), transparent 53%), @@ -1383,7 +1336,7 @@ select:focus-visible, .category-card:hover:not(.is-disabled) { transform: translateY(-1px); border-color: color-mix(in srgb, var(--tone) 23%, transparent); - box-shadow: 0 12px 26px rgba(38, 70, 107, 0.08); + box-shadow: 0 12px 26px rgba(89, 51, 34, 0.08); } .category-card.is-selected { @@ -1494,7 +1447,7 @@ select:focus-visible, place-items: center; width: 47px; height: 47px; - color: var(--blue); + color: var(--nex-primary); } .progress-card.is-compact .progress-orbit { @@ -1556,7 +1509,7 @@ select:focus-visible, margin: 9px 0 7px; overflow: hidden; border-radius: 4px; - background: rgba(71, 113, 155, 0.11); + background: var(--nex-line); } .progress-track > span { @@ -1650,7 +1603,7 @@ select:focus-visible, .cleanup-list-panel { padding: 17px; - border: 1px solid rgba(48, 87, 126, 0.075); + border: 1px solid var(--nex-line); border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.72); box-shadow: var(--shadow-card); @@ -1677,7 +1630,7 @@ select:focus-visible, } .cleanup-row:hover:not(.is-locked) { - background: rgba(242, 247, 252, 0.8); + background: var(--nex-cream); } .cleanup-row.is-selected { @@ -1752,7 +1705,7 @@ select:focus-visible, } .cleanup-row-note.is-locked { - color: #a77b55; + color: var(--nex-warning); } .cleanup-row-size { @@ -1771,13 +1724,13 @@ select:focus-visible, height: 25px; padding: 0; border-radius: 7px; - color: #98a8b8; + color: var(--nex-muted-soft); background: transparent; } .row-reveal:hover { - color: #3d7ab2; - background: rgba(227, 238, 249, 0.8); + color: var(--nex-primary-strong); + background: var(--nex-primary-tint); } .floating-action { @@ -1823,11 +1776,11 @@ select:focus-visible, align-items: center; gap: 18px; padding: 22px; - border: 1px solid rgba(24, 157, 108, 0.1); + border: 1px solid rgba(var(--nex-success-rgb), 0.14); border-radius: var(--radius-lg); background: - radial-gradient(circle at 5% 5%, rgba(98, 207, 166, 0.16), transparent 30%), - linear-gradient(120deg, rgba(255, 255, 255, 0.94), rgba(239, 251, 246, 0.9)); + radial-gradient(circle at 5% 5%, rgba(var(--nex-success-rgb), 0.1), transparent 30%), + linear-gradient(120deg, rgba(255, 255, 255, 0.94), var(--nex-success-soft)); box-shadow: var(--shadow-card); } @@ -1839,8 +1792,8 @@ select:focus-visible, height: 54px; border-radius: 50%; color: #fff; - background: linear-gradient(145deg, #54cfa0, #1ea473); - box-shadow: 0 10px 22px rgba(30, 164, 115, 0.2); + background: linear-gradient(145deg, var(--nex-success), var(--nex-success-strong)); + box-shadow: 0 10px 22px rgba(var(--nex-success-rgb), 0.2); } .result-copy { @@ -1849,7 +1802,7 @@ select:focus-visible, } .result-eyebrow { - color: #3d9b78; + color: var(--nex-success); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-bold); letter-spacing: 0.065em; @@ -1858,7 +1811,7 @@ select:focus-visible, .result-copy h2 { margin: 3px 0 4px; - color: #185e47; + color: var(--nex-success-strong); font-size: var(--nex-text-hero); font-weight: var(--nex-weight-heavy); letter-spacing: -0.04em; @@ -1866,7 +1819,7 @@ select:focus-visible, .result-copy p { margin: 0; - color: #719286; + color: var(--nex-muted); font-size: var(--nex-text-2xs); line-height: var(--nex-leading-body); } @@ -1897,7 +1850,7 @@ select:focus-visible, border: 1px dashed var(--nex-line-strong); border-radius: var(--radius-xl); background: - radial-gradient(circle at 50% 10%, rgba(242, 106, 51, 0.08), transparent 33%), + radial-gradient(circle at 50% 10%, rgba(var(--nex-primary-rgb), 0.08), transparent 33%), rgba(255, 250, 245, 0.58); text-align: center; } @@ -1954,7 +1907,7 @@ select:focus-visible, gap: 14px; margin-bottom: 13px; padding: 17px; - border: 1px solid rgba(48, 87, 126, 0.075); + border: 1px solid var(--nex-line); border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.72); box-shadow: var(--shadow-card); @@ -1977,12 +1930,12 @@ select:focus-visible, .deep-option-main textarea::placeholder, .whitelist-add input::placeholder, .search-field input::placeholder { - color: #a5b1bd; + color: var(--nex-muted-soft); } .deep-option-side { padding-left: 17px; - border-left: 1px solid rgba(48, 87, 126, 0.075); + border-left: 1px solid var(--nex-line); } .number-field { @@ -2048,9 +2001,9 @@ select:focus-visible, } .safety-strip { - border: 1px solid rgba(29, 155, 146, 0.11); - color: #4d7f7c; - background: rgba(235, 250, 247, 0.76); + border: 1px solid rgba(var(--nex-success-rgb), 0.13); + color: var(--nex-muted); + background: var(--nex-success-soft); } .safety-strip > div { @@ -2061,18 +2014,18 @@ select:focus-visible, } .safety-strip strong { - color: #31736f; + color: var(--nex-success-strong); font-size: var(--nex-text-2xs); } .safety-strip span { - color: #709796; + color: var(--nex-muted); } .warning-strip { - border: 1px solid rgba(200, 137, 44, 0.1); - color: #927247; - background: rgba(255, 248, 232, 0.75); + border: 1px solid rgba(var(--nex-warning-rgb), 0.14); + color: var(--nex-warning-strong); + background: var(--nex-warning-soft); } /* Applications */ @@ -2088,7 +2041,7 @@ select:focus-visible, .app-plan-panel, .process-panel, .health-side { - border: 1px solid rgba(48, 87, 126, 0.075); + border: 1px solid var(--nex-line); border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.73); box-shadow: var(--shadow-card); @@ -2100,7 +2053,7 @@ select:focus-visible, justify-content: space-between; gap: 14px; padding: 16px 17px 12px; - border-bottom: 1px solid rgba(48, 87, 126, 0.065); + border-bottom: 1px solid var(--nex-line); } .apps-list-head h2 { @@ -2161,7 +2114,7 @@ select:focus-visible, } .app-row:hover { - background: rgba(255, 248, 242, 0.85); + background: var(--nex-primary-tint); } .app-row.is-selected { @@ -2276,7 +2229,7 @@ select:focus-visible, align-items: center; gap: 11px; padding: 16px; - border-bottom: 1px solid rgba(48, 87, 126, 0.065); + border-bottom: 1px solid var(--nex-line); } .plan-head > div { @@ -2314,21 +2267,21 @@ select:focus-visible, width: 27px; height: 27px; border-radius: 8px; - color: #93a2b0; + color: var(--nex-muted-soft); background: transparent; } .plan-close:hover { - background: #eef4f9; + background: var(--nex-primary-tint); } .plan-warnings { margin: 10px 13px 0; padding: 9px 10px; - border: 1px solid rgba(200, 137, 44, 0.1); + border: 1px solid rgba(var(--nex-warning-rgb), 0.14); border-radius: 8px; - color: #8c6c40; - background: #fff8e9; + color: var(--nex-warning-strong); + background: var(--nex-warning-soft); } .plan-warnings p { @@ -2346,7 +2299,7 @@ select:focus-visible, align-items: center; gap: 20px; padding: 11px 15px; - border-bottom: 1px solid rgba(48, 87, 126, 0.06); + border-bottom: 1px solid var(--nex-line); } .plan-summary > div { @@ -2443,7 +2396,7 @@ select:focus-visible, align-items: center; justify-content: space-between; padding: 10px 14px 13px; - border-top: 1px solid rgba(48, 87, 126, 0.06); + border-top: 1px solid var(--nex-line); } .operation-shade { @@ -2452,7 +2405,7 @@ select:focus-visible, right: 25px; bottom: 24px; width: min(430px, calc(100vw - 50px)); - filter: drop-shadow(0 18px 32px rgba(34, 73, 111, 0.16)); + filter: drop-shadow(0 18px 32px rgba(61, 32, 19, 0.16)); } /* Storage */ @@ -2463,7 +2416,7 @@ select:focus-visible, gap: 8px; margin-bottom: 15px; padding: 7px 8px 7px 11px; - border: 1px solid rgba(48, 87, 126, 0.09); + border: 1px solid var(--nex-line); border-radius: 12px; background: rgba(255, 255, 255, 0.76); box-shadow: var(--shadow-card); @@ -2476,8 +2429,8 @@ select:focus-visible, width: 28px; height: 28px; border-radius: 8px; - color: #6093c2; - background: #edf6fe; + color: var(--nex-primary-strong); + background: var(--nex-primary-soft); } .storage-pathbar input { @@ -2485,7 +2438,7 @@ select:focus-visible, flex: 1; border: 0; outline: 0; - color: #567088; + color: var(--nex-muted); background: transparent; font-family: var(--nex-font-mono); font-size: var(--nex-text-2xs); @@ -2493,7 +2446,7 @@ select:focus-visible, .storage-overview, .storage-large { - border: 1px solid rgba(48, 87, 126, 0.075); + border: 1px solid var(--nex-line); border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.73); box-shadow: var(--shadow-card); @@ -2547,7 +2500,7 @@ select:focus-visible, margin: 18px 0 7px; overflow: hidden; border-radius: 5px; - background: #edf2f7; + background: var(--nex-cream); } .storage-map > span { @@ -2560,7 +2513,7 @@ select:focus-visible, .storage-map .storage-map-rest { flex: 1; - background: #dde6ef; + background: var(--nex-line); } .storage-folded { @@ -2594,7 +2547,7 @@ select:focus-visible, } .storage-child.is-navigable:hover { - background: #f4f9fd; + background: var(--nex-primary-tint); } .storage-child.is-muted { @@ -2606,7 +2559,7 @@ select:focus-visible, width: 6px; height: 22px; border-radius: 4px; - background: var(--tone, #aebdca); + background: var(--tone, var(--nex-muted-soft)); } .storage-child-icon { @@ -2616,8 +2569,8 @@ select:focus-visible, width: 31px; height: 31px; border-radius: 9px; - color: #6485a3; - background: #f0f6fb; + color: var(--nex-primary-strong); + background: var(--nex-primary-soft); } .storage-child-copy { @@ -2653,7 +2606,7 @@ select:focus-visible, margin-top: 4px; overflow: hidden; border-radius: 3px; - background: #f3ece5; + background: var(--nex-cream); } .storage-mini-track > span { @@ -2687,7 +2640,7 @@ select:focus-visible, flex: 0 0 auto; align-items: center; gap: 4px; - color: #95a5b4; + color: var(--nex-muted-soft); } .storage-large { @@ -2710,7 +2663,7 @@ select:focus-visible, } .large-file-row:hover { - background: #f5f9fd; + background: var(--nex-primary-tint); } .large-file-rank { @@ -2727,8 +2680,8 @@ select:focus-visible, width: 29px; height: 29px; border-radius: 8px; - color: #6486a4; - background: #eff5fa; + color: var(--nex-primary-strong); + background: var(--nex-primary-soft); } .large-file-copy { @@ -2771,7 +2724,7 @@ select:focus-visible, width: 100%; min-height: 260px; justify-content: center; - border: 1px dashed rgba(48, 87, 126, 0.15); + border: 1px dashed var(--nex-line-strong); border-radius: var(--radius-xl); background: rgba(255, 255, 255, 0.5); } @@ -2783,8 +2736,8 @@ select:focus-visible, height: 55px; margin-bottom: 5px; border-radius: 17px; - color: #4a83b9; - background: #eaf4fd; + color: var(--nex-primary-strong); + background: var(--nex-primary-soft); } .storage-start strong { @@ -2804,9 +2757,9 @@ select:focus-visible, align-items: center; gap: 5px; padding: 7px 10px; - border: 1px solid rgba(48, 87, 126, 0.09); + border: 1px solid var(--nex-line); border-radius: 9px; - color: #668097; + color: var(--nex-muted); background: rgba(255, 255, 255, 0.7); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-medium); @@ -2824,7 +2777,7 @@ select:focus-visible, flex-direction: column; min-height: 297px; padding: 15px; - border: 1px solid rgba(48, 87, 126, 0.075); + border: 1px solid var(--nex-line); border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.73); box-shadow: var(--shadow-card); @@ -2868,7 +2821,7 @@ select:focus-visible, justify-content: space-between; width: 100%; padding-top: 10px; - border-top: 1px solid rgba(48, 87, 126, 0.055); + border-top: 1px solid var(--nex-line); color: var(--nex-muted); font-size: var(--nex-text-3xs); } @@ -2902,11 +2855,11 @@ select:focus-visible, } .core-bar.is-busy i { - background: #e7aa54; + background: var(--nex-warning); } .core-bar.is-hot i { - background: #ed7379; + background: var(--nex-danger); } .memory-split { @@ -2990,19 +2943,19 @@ select:focus-visible, } .activity-arrow.is-down { - color: #188b70; - background: #e1f7f0; + color: var(--nex-success); + background: var(--nex-success-soft); } .activity-arrow.is-up { - color: #5277c8; - background: #e9effc; + color: var(--nex-primary-strong); + background: var(--nex-primary-soft); } .activity-divider { height: 1px; margin: 16px 0 0; - background: rgba(48, 87, 126, 0.06); + background: var(--nex-line); } .activity-pair.is-compact { @@ -3029,10 +2982,10 @@ select:focus-visible, gap: 15px; margin-top: 12px; padding: 14px 17px; - border: 1px solid rgba(36, 151, 105, 0.09); + border: 1px solid rgba(var(--nex-success-rgb), 0.14); border-radius: var(--radius-lg); background: - radial-gradient(circle at 0 0, rgba(83, 206, 155, 0.12), transparent 30%), + radial-gradient(circle at 0 0, rgba(var(--nex-success-rgb), 0.09), transparent 30%), rgba(255, 255, 255, 0.73); box-shadow: var(--shadow-card); } @@ -3044,8 +2997,8 @@ select:focus-visible, width: 42px; height: 42px; border-radius: 13px; - color: #1d9b6e; - background: #e6f8f1; + color: var(--nex-success); + background: var(--nex-success-soft); } .battery-main { @@ -3059,14 +3012,14 @@ select:focus-visible, } .battery-main strong { - color: #205d48; + color: var(--nex-success-strong); font-size: var(--nex-text-xl); font-weight: var(--nex-weight-heavy); letter-spacing: -0.035em; } .battery-main > span:last-child { - color: #7e9c91; + color: var(--nex-muted); font-size: var(--nex-text-3xs); } @@ -3081,12 +3034,12 @@ select:focus-visible, } .battery-facts span { - color: #91a29c; + color: var(--nex-muted-soft); font-size: var(--nex-text-3xs); } .battery-facts strong { - color: #42695d; + color: var(--nex-ink); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-semibold); } @@ -3096,14 +3049,14 @@ select:focus-visible, height: 7px; overflow: hidden; border-radius: 7px; - background: #e7f2ed; + background: var(--nex-success-soft); } .battery-track > span { display: block; height: 100%; border-radius: inherit; - background: linear-gradient(90deg, #65d1a6, #1da677); + background: linear-gradient(90deg, var(--nex-success), var(--nex-success-strong)); } .system-lower { @@ -3128,7 +3081,7 @@ select:focus-visible, .process-head { padding: 7px 4px; - border-bottom: 1px solid rgba(48, 87, 126, 0.06); + border-bottom: 1px solid var(--nex-line); color: var(--nex-muted-soft); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-medium); @@ -3142,7 +3095,7 @@ select:focus-visible, .process-row { min-height: 38px; padding: 5px 4px; - border-bottom: 1px solid rgba(48, 87, 126, 0.045); + border-bottom: 1px solid var(--nex-line); } .process-row:last-child { @@ -3153,7 +3106,7 @@ select:focus-visible, width: 5px; height: 5px; border-radius: 50%; - background: #79b4ec; + background: var(--nex-primary); } .process-name { @@ -3193,7 +3146,7 @@ select:focus-visible, width: 22px; height: 22px; border-radius: 6px; - color: #9dabb8; + color: var(--nex-muted-soft); background: transparent; opacity: 0; } @@ -3203,8 +3156,8 @@ select:focus-visible, } .process-stop:hover { - color: #d95860; - background: #fff0f1; + color: var(--nex-danger); + background: var(--nex-danger-soft); } .volume-list { @@ -3258,8 +3211,8 @@ select:focus-visible, padding: 11px; border: 1px solid rgba(var(--nex-primary-rgb), 0.09); border-radius: 10px; - color: #806355; - background: #fff7f1; + color: var(--nex-muted); + background: var(--nex-primary-tint); } .host-card > div { @@ -3306,9 +3259,9 @@ select:focus-visible, gap: 1px; margin-bottom: 14px; overflow: hidden; - border: 1px solid rgba(48, 87, 126, 0.075); + border: 1px solid var(--nex-line); border-radius: var(--radius-lg); - background: rgba(48, 87, 126, 0.05); + background: var(--nex-line); box-shadow: var(--shadow-card); } @@ -3350,7 +3303,7 @@ select:focus-visible, .history-card { overflow: hidden; - border: 1px solid rgba(48, 87, 126, 0.075); + border: 1px solid var(--nex-line); border-radius: 14px; background: rgba(255, 255, 255, 0.74); box-shadow: var(--shadow-card); @@ -3381,13 +3334,13 @@ select:focus-visible, width: 34px; height: 34px; border-radius: 10px; - color: #d47b47; - background: #fff1e8; + color: var(--nex-primary-strong); + background: var(--nex-primary-soft); } .history-mode.is-restored { - color: #4b8b89; - background: #e9f7f5; + color: var(--nex-success-strong); + background: var(--nex-success-soft); } .history-main { @@ -3436,7 +3389,7 @@ select:focus-visible, .history-chevron { flex: 0 0 auto; - color: #a1afbb; + color: var(--nex-muted-soft); transition: transform 0.16s ease; } @@ -3446,7 +3399,7 @@ select:focus-visible, .history-detail { padding: 0 14px 13px 58px; - border-top: 1px solid rgba(48, 87, 126, 0.05); + border-top: 1px solid var(--nex-line); } .history-detail-head { @@ -3540,7 +3493,7 @@ select:focus-visible, align-items: center; gap: 7px; margin: 0; - color: #2e4d69; + color: var(--nex-ink-strong); font-size: var(--nex-text-xs); font-weight: var(--nex-weight-bold); letter-spacing: -0.018em; @@ -3552,14 +3505,14 @@ select:focus-visible, .settings-section-head p { margin: 4px 0 0; - color: #8c9baa; + color: var(--nex-muted); font-size: var(--nex-text-3xs); line-height: var(--nex-leading-body); } .language-picker { display: grid; - grid-template-columns: 1fr 1fr; + grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; } @@ -3586,13 +3539,13 @@ select:focus-visible, } .language-picker strong { - color: #355674; + color: var(--nex-ink); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-medium); } .language-picker span { - color: #93a2b1; + color: var(--nex-muted-soft); font-size: var(--nex-text-3xs); } @@ -3600,7 +3553,7 @@ select:focus-visible, position: absolute; top: 11px; right: 11px; - color: var(--blue); + color: var(--nex-primary); } .delete-mode-cards { @@ -3651,13 +3604,13 @@ select:focus-visible, } .delete-mode-cards strong { - color: #355573; + color: var(--nex-ink); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-medium); } .delete-mode-cards small { - color: #93a2b1; + color: var(--nex-muted-soft); font-size: var(--nex-text-3xs); } @@ -3669,7 +3622,7 @@ select:focus-visible, } .delete-mode-cards > button.is-active .radio-dot { - border: 4px solid var(--blue); + border: 4px solid var(--nex-primary); background: #fff; } @@ -3682,6 +3635,11 @@ select:focus-visible, border-top: 1px solid var(--nex-line); } +.settings-row.is-first { + padding-bottom: 1px; + border-top: 0; +} + .settings-row > div { display: flex; min-width: 0; @@ -3690,13 +3648,13 @@ select:focus-visible, } .settings-row strong { - color: #405d77; + color: var(--nex-ink); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-medium); } .settings-row span { - color: #909fad; + color: var(--nex-muted-soft); font-size: var(--nex-text-3xs); line-height: var(--nex-leading-body); } @@ -3759,15 +3717,15 @@ select:focus-visible, width: 25px; height: 25px; border-radius: 7px; - color: #4c9d80; - background: #e9f8f1; + color: var(--nex-success); + background: var(--nex-success-soft); } .whitelist-row code { min-width: 0; flex: 1; overflow: hidden; - color: #647d92; + color: var(--nex-muted); font-family: var(--nex-font-mono); font-size: var(--nex-text-3xs); text-overflow: ellipsis; @@ -3777,7 +3735,7 @@ select:focus-visible, .settings-empty { margin: 0; padding: 13px; - border: 1px dashed rgba(48, 87, 126, 0.11); + border: 1px dashed var(--nex-line-strong); border-radius: 9px; color: var(--nex-muted-soft); font-size: var(--nex-text-3xs); @@ -3838,7 +3796,7 @@ select:focus-visible, justify-content: center; gap: 6px; padding: 13px; - color: #96a5b2; + color: var(--nex-muted-soft); font-size: var(--nex-text-3xs); text-align: center; } @@ -3847,7 +3805,7 @@ select:focus-visible, .update-section { background: - radial-gradient(circle at 96% -20%, rgba(242, 106, 51, 0.11), transparent 29%), + radial-gradient(circle at 96% -20%, rgba(var(--nex-primary-rgb), 0.11), transparent 29%), rgba(255, 251, 246, 0.86); } @@ -4040,15 +3998,15 @@ select:focus-visible, .update-message { margin-top: 10px; padding: 8px 10px; - border: 1px solid rgba(177, 86, 90, 0.18); + border: 1px solid rgba(var(--nex-danger-rgb), 0.18); border-radius: 8px; font-size: var(--nex-text-3xs); line-height: var(--nex-leading-body); } .update-message.is-error { - color: #a94c52; - background: #fff1ef; + color: var(--nex-danger-strong); + background: var(--nex-danger-soft); } .update-actions { @@ -4059,6 +4017,21 @@ select:focus-visible, margin-top: 12px; } +.update-actions .update-cancel { + min-height: 34px; + padding: 0 14px; + border-color: var(--nex-line-strong); + border-radius: 9px; + color: var(--nex-ink); + background: rgba(255, 255, 255, 0.72); + font-weight: var(--nex-weight-semibold); +} + +.update-actions .update-cancel:hover:not(:disabled) { + border-color: rgba(var(--nex-primary-rgb), 0.26); + background: #fff; +} + .update-section > .settings-row { margin-top: 12px; } @@ -4083,7 +4056,7 @@ select:focus-visible, border: 1px solid rgba(255, 255, 255, 0.66); border-radius: 24px; background: - radial-gradient(circle at 100% 0, rgba(242, 106, 51, 0.11), transparent 34%), + radial-gradient(circle at 100% 0, rgba(var(--nex-primary-rgb), 0.11), transparent 34%), linear-gradient(145deg, rgba(255, 252, 248, 0.98), rgba(251, 246, 240, 0.96)); box-shadow: 0 30px 80px rgba(61, 32, 19, 0.24), @@ -4143,12 +4116,12 @@ select:focus-visible, } .setup-check.is-ok { - border-color: rgba(31, 157, 115, 0.18); - background: rgba(242, 252, 247, 0.82); + border-color: rgba(var(--nex-success-rgb), 0.18); + background: var(--nex-success-soft); } .setup-check.is-problem { - border-color: rgba(242, 106, 51, 0.24); + border-color: rgba(var(--nex-primary-rgb), 0.24); background: rgba(255, 243, 235, 0.88); } @@ -4164,8 +4137,8 @@ select:focus-visible, } .setup-check.is-ok .setup-check-icon { - color: #17865f; - background: #e7f8f1; + color: var(--nex-success); + background: var(--nex-success-soft); } .setup-check-copy { @@ -4180,7 +4153,7 @@ select:focus-visible, display: flex; align-items: center; gap: 6px; - color: #4b3024; + color: var(--nex-ink); font-size: var(--nex-text-2xs); font-weight: var(--nex-weight-bold); } @@ -4190,13 +4163,13 @@ select:focus-visible, align-items: center; gap: 3px; margin-left: auto; - color: #8a6d5e; + color: var(--nex-muted); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-semibold); } .setup-check.is-ok .setup-check-state { - color: #17865f; + color: var(--nex-success); } .setup-check.is-problem .setup-check-state { @@ -4204,20 +4177,20 @@ select:focus-visible, } .setup-check-copy small { - color: #866b5d; + color: var(--nex-muted); font-size: var(--nex-text-3xs); line-height: var(--nex-leading-body); } .setup-check-copy code { margin-top: 2px; - color: #9b7d6c; + color: var(--nex-muted-soft); font-size: var(--nex-text-3xs); } .setup-note { margin: 14px 1px 0; - color: #9a8072; + color: var(--nex-muted-soft); font-size: var(--nex-text-3xs); line-height: var(--nex-leading-body); } @@ -4261,8 +4234,8 @@ select:focus-visible, } .permission-check-icon.is-granted { - color: #17865f; - background: #e7f8f1; + color: var(--nex-success); + background: var(--nex-success-soft); } .permission-check-copy { @@ -4277,13 +4250,13 @@ select:focus-visible, display: flex; align-items: center; gap: 7px; - color: #4b3024; + color: var(--nex-ink); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-semibold); } .permission-check-copy > span { - color: #907566; + color: var(--nex-muted); font-size: var(--nex-text-3xs); line-height: var(--nex-leading-body); } @@ -4293,15 +4266,15 @@ select:focus-visible, align-items: center; padding: 3px 6px; border-radius: 5px; - color: #987968; - background: #f4ebe4; + color: var(--nex-muted); + background: var(--nex-cream); font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-semibold); } .permission-state.is-granted { - color: #17865f; - background: #e7f8f1; + color: var(--nex-success); + background: var(--nex-success-soft); } .permission-state.is-denied { @@ -4325,7 +4298,7 @@ select:focus-visible, display: grid; place-items: center; padding: 25px; - background: rgba(24, 44, 67, 0.3); + background: rgba(44, 28, 22, 0.3); backdrop-filter: blur(8px); animation: fade-in 0.16s ease-out; } @@ -4343,9 +4316,9 @@ select:focus-visible, border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 19px; background: - radial-gradient(circle at 70% -20%, rgba(110, 177, 250, 0.13), transparent 36%), - rgba(252, 254, 255, 0.98); - box-shadow: 0 30px 80px rgba(22, 47, 75, 0.28); + radial-gradient(circle at 70% -20%, rgba(var(--nex-primary-rgb), 0.13), transparent 36%), + var(--nex-paper); + box-shadow: 0 30px 80px rgba(61, 32, 19, 0.24); animation: modal-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); } @@ -4398,8 +4371,8 @@ select:focus-visible, justify-content: flex-end; gap: 5px; padding: 12px 19px 16px; - border-top: 1px solid rgba(48, 87, 126, 0.06); - background: rgba(247, 251, 254, 0.7); + border-top: 1px solid var(--nex-line); + background: var(--nex-cream); } .confirm-content { @@ -4415,13 +4388,13 @@ select:focus-visible, width: 44px; height: 44px; border-radius: 13px; - color: #d05b63; - background: #ffedef; + color: var(--nex-danger); + background: var(--nex-danger-soft); } .confirm-content.is-default .confirm-icon { - color: #4483bd; - background: #e9f3fd; + color: var(--nex-primary-strong); + background: var(--nex-primary-soft); } .confirm-message { @@ -4448,7 +4421,7 @@ select:focus-visible, gap: 7px; padding: 4px; border-radius: 10px; - background: #eff4f9; + background: var(--nex-cream); } .mode-picker button { @@ -4459,17 +4432,17 @@ select:focus-visible, min-height: 35px; border: 1px solid transparent; border-radius: 8px; - color: #788d9f; + color: var(--nex-muted); background: transparent; font-size: var(--nex-text-3xs); font-weight: var(--nex-weight-medium); } .mode-picker button.is-active { - color: #356b99; - border-color: rgba(48, 87, 126, 0.07); + color: var(--nex-primary-strong); + border-color: rgba(var(--nex-primary-rgb), 0.12); background: #fff; - box-shadow: 0 3px 8px rgba(47, 80, 112, 0.07); + box-shadow: 0 3px 8px rgba(89, 51, 34, 0.07); } /* Toast */ @@ -4495,8 +4468,8 @@ select:focus-visible, border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 11px; color: #fff; - background: rgba(30, 52, 76, 0.92); - box-shadow: 0 16px 38px rgba(18, 40, 66, 0.24); + background: rgba(36, 18, 10, 0.92); + box-shadow: 0 16px 38px rgba(61, 32, 19, 0.24); font-size: var(--nex-text-2xs); line-height: var(--nex-leading-body); backdrop-filter: blur(18px); @@ -4505,11 +4478,11 @@ select:focus-visible, } .toast.is-success { - background: rgba(24, 119, 87, 0.94); + background: rgba(var(--nex-success-rgb), 0.94); } .toast.is-danger { - background: rgba(148, 57, 63, 0.94); + background: rgba(var(--nex-danger-rgb), 0.94); } .toast > span { @@ -4608,7 +4581,7 @@ select:focus-visible, border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 22px; background: rgba(255, 255, 255, 0.62); - box-shadow: 0 20px 45px rgba(46, 89, 132, 0.16); + box-shadow: 0 20px 45px rgba(89, 51, 34, 0.16); } .loading-orb .brand-mark { @@ -4637,7 +4610,7 @@ select:focus-visible, margin-top: 19px; overflow: hidden; border-radius: 4px; - background: rgba(64, 105, 149, 0.09); + background: var(--nex-line); } .loading-track i { diff --git a/src/types.ts b/src/types.ts index 02f5664..b6c733a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -83,6 +83,7 @@ export interface SettingsView { purgeMinAgeDays: number; showAllocated: boolean; language: string | null; + effectiveLanguage: Language; historyKeep: number; setupReviewed: boolean; errors: string[];