Clone
1
Home
Mr.Lee edited this page 2026-12-01 10:09:50 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Trace 镜像同步记录与项目分析

维护说明:本页由 gitea-mirror-wiki 技能生成(2026-12-01 10:09),记录该仓库在 GPD Gitea 的镜像状态与代码速览。Wiki 属于本地维护内容,不来自上游,也不受 8 小时同步影响。

一、仓库概况

项目 值
上游 https://github.com/lxyeternal/Trace.git
本地镜像 http://192.168.1.99:3000/jarod/Trace
公网入口 https://git.lxj.ai/jarod/Trace
状态 活跃镜像(8 小时自动同步)
默认分支 main
仓库大小 约 32.2 MB(DB 33788282 字节;裸仓约 33141 KB)
refs 1 分支 / 7 标签 / HEAD 历史 29 提交
建立时间 2026-12-01 10:07:15
描述 Free, open-source alternative to Timing for macOS. Automatically records the apps, windows, files and web pages you use, and keeps everything on your Mac. Native SwiftUI, English and 简体中文.

二、同步过程与当前状态

本次同步实测

项目 结果
上游仓库 https://github.com/lxyeternal/Trace (lxyeternal/Trace,Swift 6 / SwiftUI,GPL-3.0,145 star / 10 fork / 2 open issues,默认分支 main,创建于 2026-11-13,最后推送 2026-11-18)
迁移请求 POST /api/v1/repos/migrate;mirror=true、mirror_interval=8h0m0s、private=false、repo_owner=jarod、repo_name=Trace;由 GPD 宿主侧 nohup 后台 curl 发起,避开本机客户端超时误判
迁移结果 HTTP 201 Created,服务端实测耗时 12655.7 ms(约 12.7 秒),repo id 49,empty=false;上游工作树约 32.5 MB(GitHub API size=33248 KB),裸仓 32 MB(DB size 33,787,148 字节)
默认分支 main;裸仓 HEAD = c47ee136e9a6945a4d8458cd967066d522628422(Release 0.4.2),与 GitHub 上游 main HEAD 一致
refs 规模 1 分支 / 7 标签(v0.1.0 → v0.4.2)/ 全 refs 31 提交(main 单分支历史 29 提交);代码 37 个 Swift 文件、约 10,865 行
远端配置 remote.origin.url = https://github.com/lxyeternal/Trace.git;fetch 双 refspec(+refs/:refs/ 与 +refs/tags/:refs/tags/);无 remote.origin.proxy 等代理残留
同步排期 mirror_interval = 8h0m0s(interval=28,800,000,000,000 ns),enable_prune=1;mirror-sync 后 updated 10:07:52 → next_update 18:07:52(+8h),之后按 8 小时节奏自动拉取,无需人工干预
完整性校验 git fsck 无异常输出;裸仓属主 jarod:jarod(1000:1000);仓库页 /jarod/Trace 返回 200;API 返回 mirror=true、empty=false、default_branch=main、size=32995
仓库计数 同步后 Gitea 共 34 个仓库,其中 32 个活跃镜像(另含 anqing 静态归档、cn-edu 本地自建非镜像)
本次无异常 迁移一次成功,未出现 status=1 中间态停留、未重发 migrate、无需手动接管;客户端与 GPD 全程 SSH 正常

当前校验状态

检查项 结果
is_mirror / is_empty 1 / 0
HEAD refs/heads/main → c47ee13
remote.origin.url https://github.com/lxyeternal/Trace.git
remote.origin.fetch +refs/*:refs/* / +refs/tags/*:refs/tags/*
自动同步排期 updated 2026-12-01 10:07:52 → next 2026-12-01 18:07:52

页面验证:GET /jarod/Trace/wiki 返回 200 即表示 Wiki 裸仓已被 Gitea 正确识别。

三、项目功能速览

README 来源:README.md

A free, open-source alternative to Timing: an activity tracker for macOS that keeps everything on your Mac.
Trace sits in the menu bar and records which app, window, file and web page is in front of you, and for how long. There are no timers to start and nothing to fill in. At the end of the day it shows where the time went, down to the single file or page.
## Why Trace
[Timing](https://timingapp.com) set the standard for automatic time tracking on the Mac, and it is a paid app. Trace is a free, open-source alternative: it records your day in the same hands-off way, it costs nothing, the source is here to read and change, and your records never leave your Mac unles
## Features
### The day in lanes
One lane per tag or app, with sound and calls underneath, so you can see what happened at the same time: coding with music on, or a meeting that ran in the background. Below that, every app that was open gets a lane of its own, solid while its window was on screen and faint while it was open out of 
### A detailed timeline
Expand the day level by level: tag › app › file or site › page. The day runs top to bottom on the right; click a session or drag across any stretch of it, and the outline sums up only that period.
### Projects, found for you
Trace works out which project each file belongs to from the folder it is in (a git repository, a Swift package, an Obsidian vault, or simply the folder inside Documents), so you can see time per project without setting anything up.
### Every record, one by one
Switch to Records to read the day stay by stay. Sessions group the records that belong together, and a brief glance at another app does not split a session. Select a record to see its file path or URL, how often you came back to it, and its tags.
### Tags that apply themselves

检出的技术栈 / 构建信号:SPM 依赖锁文件、Swift Package Manager、macOS / iOS App Bundle

顶层目录:(根目录)、Resources、Sources、Support、Tests、docs、scripts

四、代码功能与安全简析(人工复核)

一、功能定位

Trace 是一款 macOS 本地时间追踪工具,定位为付费软件 Timing 的免费开源替代品(README 原话「A free, open-source alternative to Timing」)。它常驻菜单栏,每 2 秒采样一次前台应用、聚焦窗口标题、文件路径与网页地址,每 10 秒记录一次「哪些应用开着、窗口是否在屏」,自动累积成「停留事件」写入本地 SQLite;不需要手动计时,也无需事后补录。

核心视图:Lanes(并行泳道) 按标签/应用分道展示同一天的并发活动,声音与通话单独成行;Timeline 按 标签 › 应用 › 文件或站点 › 页面 四级下钻,可拖选任意时段单独汇总;Projects 依据所在文件夹(git 仓库、Swift package、Obsidian vault 或 Documents 下的目录)自动归并项目;Records 逐条罗列停留记录并用 session 合并;Tags 内置 8 类(开发/办公/学习/沟通/娱乐/游戏/设计/浏览)并支持按应用、路径、URL、窗口标题写规则,规则在读取时应用,改动后自动重算全部历史;Focus 支持手动开启计时/开放式专注会话。

数据处理上一个值得注意的设计:空闲时间不落库,只体现为时间轴上的空隙;在通话中或前台应用正在出声时,「没有键鼠操作」不计为离开。同步是可选项,采用「每台 Mac 每天写一个文件到同步目录下自己的子文件夹」的方式,两台机器不会写同一文件,标签与规则以最后修改为准。

二、技术栈与工程结构

项 情况
语言 / UI Swift 6(swiftLanguageModes: [.v5])、SwiftUI,最低 macOS 14,需 Xcode 16+ 构建
依赖 仅 1 个:GRDB.swift 7.12.0(Package.resolved 已精确锁定 revision 92a554cd…),供应链面很窄
结构 Sources/TraceCore(模型/存储/打标签/聚合,无 UI、可单测)+ Sources/Trace(Capture 采集、Views 界面、菜单栏);37 个 Swift 文件约 10,865 行
关键实现 采集走 NSWorkspace 取前台应用、Accessibility API 取聚焦窗口、CGEventSource 取空闲时长、Core Audio 判断出声/占用麦克风
构建 scripts/bundle.sh(release/ad-hoc 签名,UNIVERSAL=1 出通用二进制)、scripts/release.sh(打 DMG + zip)
本地化 en / zh-Hans / ru 三语,英文文案即 key
版本节奏 2026-11-13 首个提交,6 天内迭代到 v0.4.2(7 个标签),非常年轻的活跃项目

三、安全快检结论(只做防御性审查)

  • 无硬编码凭据:全树未见 .env、.pem、.p12、.p8、id_rsa、credentials/secrets 文件,也未发现私钥块。关键词命中仅 2 处且均非凭据:LICENSE 里 GPL 正文的 "no special password or key for"、AXReader.swift 中 parts.password = nil(主动剥离 URL 中的密码,属隐私正面实现)。
  • 无危险脚本模式:scripts/ 下只有 bundle / release / 生成图标 / 生成 GIF 四个脚本,无 curl|sh、wget|sh、sudo、eval(、rm -rf /。
  • 无网络行为:全树 Swift 代码未使用 URLSession / NWConnection,也没有 analytics / telemetry / Sentry / Firebase 等 SDK;仅有的两处 http:// 字符串是 UI 里为展示而去掉协议前缀的处理。README 明确「Trace makes no network connections and has no account」,与代码一致。
  • 发版签名规范:release.sh 通过环境变量 DEVELOPER_ID 与钥匙串 profile NOTARY_PROFILE(xcrun notarytool store-credentials 创建)完成签名与公证,密钥不入库;仓库根 .codesign-identity 已在 .gitignore 中(本地自签用)。
  • 无 CI 工作流:仓库无 .github/workflows,因此不存在第三方 Action 的供应链风险,但也意味着构建与发布完全由维护者本机完成、缺少可复现的自动校验。
  • 数据面:单文件 SQLite,路径 ~/Library/Application Support/Trace/trace.sqlite;URL 入库前会去掉 query、fragment 与凭据;窗口标题、文件路径、网页地址、声音/通话、开着的应用列表均可单独关闭,可整应用排除;支持 CSV 导出与一键清空。

四、风险提示与建议

  1. 权限面极宽,这是此类工具的本质代价:Trace 依赖 macOS 辅助功能(Accessibility) 授权,授权后可读取所有应用的窗口标题、文档路径与网页地址。就代码论代码它只读这些字段(.title / .document / webArea),未发现键盘记录或截屏(README 明确「No keystrokes, no screenshots」,代码中也无对应 API 调用),但信任成本主要落在「作者是否可信」而非「代码是否干净」——一个 2026-11-13 才创建、两周 145 star 的新项目,建议先在一台非主力 Mac 上观察,或自行 scripts/bundle.sh 构建后再用。
  2. 未沙盒化:仓库无 .entitlements,走 hardened runtime 但不开 App Sandbox——这对需要读其他应用窗口的工具是必然选择,同时也意味着一旦二进制被替换,影响面不受沙盒约束。建议只从 Releases 取 Developer ID 签名+公证版本,校验签名后再运行。
  3. 同步目录是明文:可选的「同步文件夹」把记录写成可读文件,谁能打开该文件夹谁就能读。若启用 iCloud/Dropbox 等云同步,等于把完整活动轨迹(含文件名、网页地址)交给该云服务;README 已如实提示。
  4. 隐私边界要自己设:README「Known limitations」坦白了三点——静音视频/长时间阅读会被判为离开;一直占用麦克风的工具(如听写软件)会被误判为通话;无痕浏览窗口不会被识别,会和其他窗口一样被记录。对校园办公机,建议至少关闭网页地址采集或整应用排除浏览器隐私场景。
  5. 许可证 GPL-3.0:若要把它集成进校内分发或二次开发的闭源工具,会触发传染性条款;单纯自用/内部研究不受影响。
  6. 平台局限:仅 macOS 14+、Apple silicon 或 Intel;Windows/国产系统环境无法使用。

五、结论

代码卫生良好、依赖极简、无网络回连、无凭据泄露,隐私设计(剥离 URL 凭据、可逐项关闭采集、数据仅本地)在同类的 Electron 方案里属于明显更克制的一档。技术上值得试用,适合作为「本地优先 + SwiftUI + GRDB」的时间追踪参考实现;主要不确定性来自项目太新(两周、单作者主导)与辅助功能权限的天然高敏感度,建议隔离试用、只取官方签名版本,并先想清楚「允许它看见我所有窗口标题」这件事是否可接受。

五、代码安全快检(自动)

  • password|secret|token|api_key|private_key|access_key 命中 5 处;此类命中多为变量名、UI 文案或协议字段,需人工复核,不等于存在凭据泄露。
  • 敏感文件(.env / *.pem / *.p12 / 私钥 / credentials 等):未检出
  • 硬编码 PEM 私钥:未检出
  • 危险脚本模式(curl|bash / eval / base64 -d / chmod 777):未检出

六、风险提示

  1. 自动快检只覆盖常见模式,不替代人工审计;部署前核对依赖来源、锁文件与 CI 中的 ${{ secrets.* }} 用法。
  2. 远程控制 / Agent / 文件上传 / 解析外部文档类项目,优先放在内网隔离环境,避免直接暴露公网。
  3. 注意许可证(GPL / AGPL 等)对二次分发与闭源集成的约束。

七、维护约定

  • Gitea 对 is_mirror=1 的仓库禁止 Wiki API / UI 写入(POST .../wiki/pages 返回 405),但读正常;本页由服务端直接维护 <repo>.wiki.git 裸仓。
  • 更新方式:临时 chown -R root:root,用 hash-object -w + mktree + commit-tree + update-ref 提交,最后 chown -R 1000:1000;root 直接 git clone 会触发 dubious ownership。
  • Wiki 是独立裸仓,8 小时 mirror-sync --prune 只操作主裸仓,不会影响本页;删除并重建仓库会连带删除 Wiki,Gitea 迁移/备份时须单独带上 .wiki.git。
  • 每次人工发起的镜像同步完成后,按 gitea-mirror-wiki 技能更新本页;后台自动同步不重复生成。