Commit Graph

12 Commits (dev)

Author SHA1 Message Date
lijunjie e3eba338a7 借鉴 Mole 的 12 项安全架构与交互全部落地;修复启动项开关失效
- 空间清理:扫描实时计数(已统计 N 文件 · X,进度封顶 99%);分类算完一个亮一个;
  清理点/文件行「X 未使用」休眠标签;node_modules 可删依据面板(锁文件/安装记录/
  手改检测/Git/年龄);低风险走底部绿色内联确认条(Esc 取消),对话框新增
  「刚刚逐路径复核过」审计面板;结果页按原因分组展示未处理项并给下一步按钮;
  清理清单导出 Markdown(含依据与受保护项)。
- 存储空间:新增「隐藏的吃空间大户」(更新缓存/休眠/页面文件/WinSxS/手机备份/旧下载);
  文件夹测量缓存 10 分钟 + 新鲜度标注 + 重新测量,删除后缓存自动作废。
- 引擎:微信/QQ 聊天文件、浏览器 IndexedDB 离线数据、搜狗词库等个人文件在扫描结果
  以待解锁行呈现且删除层强制拒删;preflight 删除前逐路径复核;白名单消费审计
  (设置页标注每条规则最近是否命中)。
- 修复:权限管理开机启动项开关点击无效/弹回——StartupApproved 标记改用最小注册表
  权限写入(原 KEY_ALL_ACCESS 在安全软件驻留的机器上直接被拒),拒绝访问时自动
  UAC 提权重试并回读核实;计划任务/服务同样支持提权通道;开关失败新增红色气泡。
- 无头浏览器 29 项点击断言全过;cargo test/clippy/fmt、pnpm check/build 全绿;0.1.10 重新打包。
2026-11-20 18:54:02 +08:00
lijunjie a3253ad38f Squid 0.1.10:升级安装包清理、CPU 面板、回收站文案与桌面小工具降占用
- 清理新增「升级安装包」分类:已知应用精确规则(微信/企微/WPS/网易邮箱等)+ AppData 启发式扫描;只匹配安装包形态、≥7 天、1MiB 起,运行中应用锁定;删除确认弹条「跳过升级包,只删其余」
- 桌面小工具新增 CPU 面板:总占用曲线 + 整行逻辑核心渐变柱(绿→黄→橙→红连续插值,悬停显示核心 N 百分比,0 起编号,柱宽随核心数自适应)
- Windows 上「废纸篓」文案全链路改为「回收站」(bootstrap.binNoun 驱动,macOS 不变)
- 常驻 CPU 优化:轻/全两档采样(system_snapshot(full))、双窗口共享 2s 采样缓存、主窗口收托盘与小工具折叠时完全停止轮询
- 修复小工具自适应尺寸→重锚定 IPC 死循环(主进程+渲染进程空转、每循环写一次 widget.json);同时修复由此摘除 prefs 依赖引入的面板高度不自适应回归
- 版本升至 0.1.10(4 处同步),release/0.1.10 全套发布文件(安装包/便携包/SHA256/更新清单/一键安装.bat)
2026-11-19 00:08:56 +08:00
lijunjie 67a68b4fbb Squid 0.1.6-0.1.9: 权限管理、桌面小工具、概览/卸载修复
权限管理(新增页):开机启动项按软件分组 + 中文软件名 + 每行图标;
右键菜单对齐电脑管家颗粒度(文件/文件夹/桌面/驱动器/所有对象 横向
分类导航、创建者列、模块图标、占位名回退安装目录名、系统内置过滤、
模块去重);弹窗拦截(窗口/规则图标、一键建规则、常驻观察者)。
数据源 crates/squid-platform/src/permissions.rs + src-tauri manage.rs。

桌面小工具(新增,仿飞牛):桌面层无边框窗口(HWND_BOTTOM,压在
壁纸上、其他窗口下),运行状态圆环 / 网络与磁盘曲线 / 存储空间条,
独立面板开关、不透明度(90-100)、频率、停靠角、折叠记忆、拖拽位置
持久化;主界面「桌面小工具」管理页 + 托盘开关;widget.json 持久化。
src-tauri/src/widget.rs、src/pages/Widget{Window,Page}.tsx、
src/components/WidgetPanels.tsx。

概览页:本机配置面板(主板/CPU/内存条/硬盘型号/显卡,原生 API 读取)、
Windows 11 版本识别修复(构建号规则)、盘符百分比、无滚动的紧凑布局。
squid-platform hardware_info + squid-stats gpu_usage 字段。

卸载应用:EstimatedSize/实测目录修复 0 B;应用图标(DisplayIcon 解析、
老图标 AND 掩码、.lnk 目标跟踪)。

安装:NSIS 自定义模板静默覆盖升级(不弹卸载旧版页,继承安装位置与
%APPDATA% 配置);管家环境发布必带 一键安装.bat(复制到 C 盘 %TEMP%
再启动,docs/RELEASE.md 记录);release/0.1.6-0.1.9 归档。

测试:scracth 目录写入被端点防护拒绝时优雅跳过(core/engine/rules/tui);
widget 序列化契约 3 个新单测;工作区 199 测试全绿。
2026-11-18 11:52:36 +08:00
mula.liu 09ba6c6b36 Release Squid 0.1.3 with tray support
- Hide up-to-date messaging in the update panel
- Simplify primary navigation to Overview, Cleanup, and Applications
- Keep Squid running in the tray with cleanup and purge actions
- Package macOS, Windows, and update manifest artifacts
2026-11-05 11:40:42 +08:00
mula.liu f65021de03 Measure long paths, and clean up after a failing fixture
`windows_allocation` built its UTF-16 argument with `to_string_lossy`, so a
path that an `OsString` can hold but a `String` cannot arrived at
`GetCompressedFileSizeW` with replacement characters in it, and any path past
the 260-character legacy limit was answered with `ERROR_PATH_NOT_FOUND` — the
deep `node_modules` trees this tool exists to measure cross that line
routinely. `wide_path` keeps every UTF-16 unit and adds the verbatim prefix
only where it is honest (absolute, no `.` or `..`), because the prefix also
switches off normalisation.

The scratch-directory fixture now removes itself even when an assertion
panics halfway through. That is not housekeeping: a file extended with
`set_len` is charged as if written in full, and one surviving fixture sat on
the test machine's disk at 11 GB — in `AppData\Local\Temp`, where squid then
correctly offered it back as junk.
2026-10-15 18:53:31 +08:00
mula.liu d74420f24a Ask NTFS for stored bytes, not for allocated clusters
`FileStandardInfo.AllocationSize` turned out to be the wrong question. Measured
against `fsutil` and `compact` on a real Windows 10 volume:

- it returns the cluster-rounded logical length for ordinary files, including
  1 GiB files extended by `SetEndOfFile` (NTFS does hand over the whole tail,
  and free space moves accordingly) and sub-cluster files living in `$MFT`;
- it reported the full 8 MiB for a file `compact` accounts as 1,572,864 stored
  bytes, i.e. it is blind to NTFS compression, which is the one way Windows
  really does hide size on disk;
- `FSCTL_QUERY_ALLOCATED_RANGES` reported that same compressed file as fully
  allocated, so "which clusters exist" is not "what do they weigh".

`GetCompressedFileSizeW` answers 1,572,864, matching `compact` byte for byte.
It takes the path we already hold instead of a handle, so it is one query per
file rather than a `CreateFileW` pair, and it keeps answering while another
process holds the file open exclusively — the normal state of a cache file.
That also removes the `ALLOCATION_PROBE_MIN` cutoff: it existed to avoid a
handle per small file, and small files on a compressed volume need the honest
number just as much.

Guard the zero answer behind `FILE_ATTRIBUTE_COMPRESSED`/`SPARSE_FILE` (free
from the `Metadata` we already have) so a deleted-but-still-open file cannot
zero out a total the user is about to act on, and read `GetLastError` to tell
failure from a genuine 4 GiB-minus-one length.

Tests: each platform now gets the fixture that provokes its own divergence —
POSIX holes for `st_blocks`, and a `compact`-compressed file for the Windows
path. The old Windows sparse fixture proved nothing: extending a file does not
hole out on NTFS, and `FSCTL_SET_SPARSE` is refused outright on this volume
(`ERROR_INVALID_FUNCTION`), as is `FSCTL_SET_COMPRESSION`
(`ERROR_ACCESS_DENIED`) even for a file we created ourselves.
2026-10-15 17:25:17 +08:00
mula.liu 69dd3b5456 Stop matching path separators in suffixes
The purge test compared rendered path strings against `demo/node_modules` and
friends, so on Windows every positive assertion failed and the negative one —
`loose/dist` must not be offered — passed for the wrong reason. Assertions now
compare trailing components, which is what they meant all along and holds on
both separators.

`category_index` made the same assumption in production: it lowercased the path
and looked for `/library/caches`, so a leftover root was only ever reclassified
on the OS whose separator it was written for.
2026-10-15 16:51:00 +08:00
mula.liu 7584811e91 Measure what NTFS actually allocated, and unbreak the /Applications test
Real Windows 10 hardware turned up two failures the macOS and cross-compile
checks could not see:

- squid-core::fs reported every file's logical length as its allocated size,
  because `allocated_bytes` returned 0 on non-Unix and `on_disk()` then fell
  back to logical. NTFS only answers the allocation question through a handle,
  so ask `GetFileInformationByHandleEx(FileStandardInfo)` for files big enough
  to distort a total. Files below the cutoff keep counting as their length,
  which is also what keeps MFT-resident entries — they report an allocation of
  0 — from shrinking a cache cleanup down to nothing.
- the "a plain user can still uninstall into /Applications" safety test hard
  coded a Unix path, so on Windows it asserted that a folder the policy never
  looked at was refused. The fixture now comes from the policy's own shared
  install folder, `/Applications` on Unix and the machine-wide program-data
  folders on Windows.

Also added:

- `a_written_file_reports_what_the_volume_gave_it`, the cross-platform
  invariant the missing backend silently violated.
- the sparse-file test now marks its file sparse via `fsutil` on Windows and
  skips when the volume will not cooperate, instead of pretending a hole
  exists.
- `scripts/win-sync.sh`, `scripts/win-check.ps1` and `scripts/win-hwcheck.ps1`
  for iterating against a LAN Windows host over SSH without git credentials.
2026-10-15 16:43:41 +08:00
mula.liu 13dfcce22f Windows-friendly elevation hints
- new squid_core::elevation_hint(): sudo on Unix, elevated Administrator
  terminal on Windows; used by the locked-item notes in clean/uninstall
  and the user-only safety refusal.
- the Permission error no longer tells Windows users to grant Full Disk
  Access (a macOS-only concept).
2026-10-15 15:26:12 +08:00
mula.liu 5619b1467d Windows: safety layer, rule engine fixes, and 30 built-in cleanup rules
- paths: platform-semantic comparisons. Component keys are lower-cased
  and canonical \\?\\ verbatim prefixes folded away on Windows, so
  is_within/same_path/depth_below/relative_below match how the OS
  actually resolves paths; pretty() got the same treatment.
- safety: drive roots and UNC roots are hard-denied (is_root_like);
  Windows hard-deny grows env-derived entries (SystemRoot, ProgramFiles,
  ProgramData, USERPROFILE, ...); DENY_EXACT gains the AppData tree and
  shell folders; OUTSIDE_HOME_OK becomes platform-supplied
  (%ProgramData%, %PUBLIC% mirror /Applications); a path containing
  $Recycle.Bin / System Volume Information / Recovery is always refused;
  the canonicalize-vs-expected symlink probe now compares with
  platform semantics instead of raw equality.
- rules: $VAR heads stop at backslashes too; ${VAR} resolves in every
  occurrence; glob component matching is case-insensitive on Windows;
  protect patterns normalise \\ to / so protections keep working there;
  anchor_for keeps drive prefixes instead of bailing out, and folds
  Prefix+RootDir into a rooted C:\ anchor.
- rules/windows.toml: 30 rules for Win10/11 (temp, WER/crash dumps,
  browser caches, shell caches, dev caches, Windows.old, Package Cache)
  embedded under cfg(windows) and parse-checked on every host.
2026-10-15 15:23:19 +08:00
mula.liu 122e81cb4d Windows: real platform layer, recycle-bin trash backend, cross-compile CI
- squid-core: trash moves behind a platform seam — Windows recycles via
  IFileOperation (shell owns $Recycle.Bin bookkeeping; ledger records no
  physical path there), Unix keeps the rename/copy path untouched
- squid-core: default cleanup anchors per platform; Unix-only helpers
  (getuid, statvfs-style trash dirs, symlink copy) gated
- squid-platform: windows.rs rewritten — installed apps from the uninstall
  registry (HKLM 64/32-bit views + HKCU, SystemComponent/patch filtering),
  BIOS/NT version keys for hardware/OS strings, sysinfo for volumes and
  running processes; winreg replaces the PowerShell stub
- squid-stats: COMPUTERNAME hostname off-unix; battery parsers gated
- CI: .gitlab-ci.yml with a Linux job that cross-checks the whole workspace
  against x86_64-pc-windows-msvc, plus a manual tagged Windows job driven by
  scripts/ci-windows.ps1 (build + test on a real machine)
- host (macOS) tests, clippy -D warnings and fmt stay green
2026-10-15 14:56:55 +08:00
mula.liu 54585ffc40 squid 0.1.0: macOS 磁盘清理(CLI + TUI) 2026-10-13 17:00:50 +08:00