- 账号与同步:GitHub / Google / Apple 登录后把菜单栏项目与风格等偏好同步到 getopenstats.com,换一台 Mac 登录即恢复(AccountSync 模块、SyncController、SettingsDocument、账号设置页,openstats:// 回调) - 磁盘页成为工具页:已用 / 可清除 / 可用分段容量条、空间分析、文件系统检查、本地快照清理(辅助工具协议 v4)、其他磁盘推出 - 公网 IP:归属地数据源可选 CleanIP.io / ipapi.is / DB-IP / ipinfo.io / 本地 GeoLite2,每台 Mac 自己查、本地缓存 7 天;IPv4 / IPv6 双栈各自查询与切换;弹窗显示 ASN、运营方、原生 / 住宅等徽章与纯净度评分色带;接口区块可重置上传 / 下载统计 - 弹窗:右上角按钮改为该指标自己的图标 + 总设置;主窗口页面标题栏的开关点不动已修复;滚动条改为悬浮式,内容不再偏左;网络弹窗卡片被标题行撑宽的问题已修复 - 设置:⌘ 拖动排序说明;每个菜单栏项目单独选风格并带实时预览;网络与磁盘的进程榜单固定 5 行并平滑排序;CPU 持续高负载通知 - 设计系统:分段条、评分色带、标签徽章、胶囊切换、刷新按钮等组件与徽章配色 token - 更新日志、架构说明、README 与译文同步
31 lines
1.2 KiB
Swift
31 lines
1.2 KiB
Swift
import Foundation
|
|
|
|
/// Time Machine 本地快照的删除命令。辅助工具与未安装辅助工具时的授权回退共用同一份参数校验:
|
|
/// 快照只能用形如 2026-09-14-120000 的时间标识指定,不接受任何其他字符
|
|
public enum LocalSnapshotCommand {
|
|
public static let tool = "/usr/bin/tmutil"
|
|
public static let maxCount = 64
|
|
|
|
public static func isValidIdentifier(_ identifier: String) -> Bool {
|
|
let scalars = Array(identifier.unicodeScalars)
|
|
guard scalars.count == 17 else { return false }
|
|
for (index, scalar) in scalars.enumerated() {
|
|
if index == 4 || index == 7 || index == 10 {
|
|
guard scalar == "-" else { return false }
|
|
} else {
|
|
guard ("0"..."9").contains(scalar) else { return false }
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
public static func arguments(identifier: String) -> [String] {
|
|
["deletelocalsnapshots", identifier]
|
|
}
|
|
|
|
/// 授权回退用的一整条 shell;调用前必须已用 isValidIdentifier 校验
|
|
public static func shellCommand(identifiers: [String]) -> String {
|
|
identifiers.map { "\(tool) deletelocalsnapshots \($0)" }.joined(separator: "; ")
|
|
}
|
|
}
|