Commit Graph
70 Commits
Author SHA1 Message Date
Qiu Yuzhou 7ab774fcfd chore(legacy): 移除 Legacy/ 旧版源码,归档到 legacy-v1 分支
旧版实现已由 shadowsocks/ShadowsocksX-NG 的 legacy-v1 分支跟踪,本仓库不再
保留同一份代码副本。删除 Legacy/ 下 603 个跟踪文件,被 gitignore 的
.DS_Store 一并清理。

删除前核对:Legacy/ShadowsocksX-NG/PACUtils.swift 的 blob hash 与
upstream/legacy-v1 的同名文件完全相同,且工作区在 Legacy/ 下无未提交改动。

配套改动:

- 根 README、AGENTS.md、ShadowsocksX-NG2/README.md:目录结构只留
  ShadowsocksX-NG2/;旧版说明改为指向 shadowsocks/ShadowsocksX-NG 的
  legacy-v1 分支(含其 README);pre-commit 说明去掉 Legacy/。
- codegraph.json 删除 "exclude": ["Legacy/"];.gitignore 与 .zcodeignore
  删除 Legacy 构建产物与依赖条目;.swiftlint.yml 删除 ../Legacy 排除项;
  .githooks/pre-commit 头部注释去掉冻结目录表述。
- docs/research 的 4 份历史研究报告(issue 7/11/12/17)中 129 处
  ../../Legacy/... 相对链接改写为 legacy-v1 的 GitHub blob 链接,正文未改;
  把新 URL 反替换回原相对路径后与 HEAD 版本逐字节相同,证明只动了链接。

验证:全仓库不再有指向 Legacy/ 的路径引用;剩余 Legacy 字样均为概念性用法
(Legacy 导入功能、ADR 与术语表、历史报告正文中的冻结陈述)。本次未改任何
NG2 源码或构建配置,暂存区无 NG2 .swift 文件,pre-commit 直接放行。
2026-10-05 21:39:06 +08:00
Qiu Yuzhou a31e2fa4bf docs(adr): 记录源码目录即分层与主题及守卫约定
App/ 按分层、Domain/ 按主题组织,两个根层只放子目录、不放平铺文件;边界由
Tests/SkeletonTests.swift 的守卫正面圈定断言,而不是禁令加豁免登记。

ADR-0029 只记录组织原则本身:分层与主题划分的依据(Domain 主题名取自
GLOSSARY.md 的章节划分)、四条被否决的备选(平铺加豁免登记、feature-first、
Domain 照搬分层、守卫锁定目录集合),以及两条在代码里不可见的 XcodeGen
约束和跨进程契约按文件引用的代价。

ADR 不维护目录与文件清单——清单由 ShadowsocksX-NG2/README.md 的工程结构
一节维护,避免记录随事实漂移。

project.yml 的两处分层注释与 README 的工程结构一节各加一处引用:前者按该
文件既有写法引用编号,后者用完整链接。
2026-10-05 20:27:11 +08:00
Qiu Yuzhou 0f2855f453 fix(ui): 关闭服务器表单密码框的系统密码自动填充
系统对 NSSecureTextField 默认提供钥匙串/密码 App 的自动填充入口,且不
取决于字段语义:实测底层字段 contentType 已是 nil,既有
.textContentType(nil) 不足以关掉它,AppKit 也没有公开开关。

改用字段级私有开关 _setPasswordAutofillEnabled:(responds(to:) 守卫,
方法消失时静默回退、不崩溃)。PasswordAutofillOptOut 以同帧背景探针
认领承载密码控件的文本框,只关密码列自己;明文/密文切换换成新实例后
重新认领。

新增 PasswordAutofillOptOutTests 固定认领范围与切换行为;全量单测
1022 通过,人工验证通过。取舍与后果记入 ADR-0028。
2026-10-05 19:23:55 +08:00
Qiu Yuzhou a6ebb69bbf feat(servers): add group sharing popover 2026-10-05 16:57:48 +08:00
Qiu Yuzhou bd68e45ea4 feat(servers): present sharing in a popover 2026-10-05 16:41:18 +08:00
Qiu Yuzhou fd6fa65a8d feat(share): rework server share as QR sheet
- Replace toolbar QR popover with a window sheet per sketch: top hint,
  280pt white-backed QR, copy-image / save-image / copy-ss:// actions
  and a Done button; all buttons share a 260pt min label width
- Freeze share payload and suggested file name at presentation time;
  transient "copied" feedback on copy actions
- Add ImageClipboard seam (PNG normative type + TIFF in AppKit adapter)
  and QrImageSaver seam (NSSavePanel PNG, sanitized suggested name)
- Register new typed failures in the presentation whitelist; extend
  platform-effects architecture guard and seam tests
- Record spec in docs/design/server-share-sheet.md; GLOSSARY server
  share now covers saved QR image files
2026-10-05 13:54:59 +08:00
Qiu Yuzhou 86779b63ee feat(plugins): add settings management UI 2026-10-05 12:03:52 +08:00
Qiu Yuzhou 3d8d56b8e1 test(plugins): cover mapping commit and runtime convergence 2026-10-05 11:13:42 +08:00
Qiu Yuzhou e74f8dfc01 refactor(plugins): derive server form facts from effective catalog 2026-10-05 00:46:43 +08:00
Qiu Yuzhou 128efcc0d6 feat(plugins): add user plugin catalog and runtime wiring 2026-10-05 00:28:16 +08:00
Qiu Yuzhou 4623dc78aa Merge commit 'a9a7aed' into develop 2026-10-04 22:26:20 +08:00
Qiu Yuzhou a9a7aedc0b fix(servers): restore direct creation buttons 2026-10-04 22:03:18 +08:00
Qiu Yuzhou 5968b1fd0b feat(import): 统一服务器导入入口并支持 SIP-008 文件导入
新增统一导入面板(拖放多文件/剪贴板 ss:// 一键/旧版直接导入),来源按内容
嗅探分派(位图→二维码、JSON→SIP-008、其余→文本行),逐来源独立事务与
结果。深模块集中在 CatalogWorkflow.importServers 单一接缝,凭据统一经
journal,退役 ss:// 文本框、二维码预览、Legacy 专属 sheet 与首启主动弹窗。
SIP-008 导入语义见 ADR-0027(文档 ID 只作装配键,目录身份全新生成)。
2026-10-04 21:45:20 +08:00
Qiu Yuzhou 535d62a28a fix(servers): support root creation and clearing selection
Add explicit current-group and root creation menus. Clear the management
tree selection on blank clicks or Escape while focused. Capture creation
parents, retain failed group drafts, and select/reveal created nodes.

Validation: 870 hostless tests (921 executions), 21 Python checks, unsigned
app build, format/lint/diff checks. Standards and spec reviews passed.
Native interaction and visual verification were not performed per request.
2026-10-04 21:36:51 +08:00
Qiu Yuzhou 7bb327ba1d docs(domain): CONTEXT.md 改名 GLOSSARY.md 并对齐引用
domain-modeling skill 升级后单上下文约定文件名为 GLOSSARY.md:
git mv 保历史、内容零改动;AGENTS.md、docs/agents/domain.md 及
NG2 源码注释中的活引用随之对齐。docs/design、docs/research、ADR
中的旧名引用属历史记录,不改写。
2026-10-04 15:06:41 +08:00
Qiu Yuzhou 2f670a4c6b refactor(rules): decouple saved intent from runtime application 2026-10-03 17:40:05 +08:00
Qiu Yuzhou 3aae39799a fix(rules): convert root URL paths to exact domains 2026-10-03 09:56:00 +08:00
Qiu Yuzhou 6e69d92449 feat(rules): convert pathless URL prefixes to exact domains 2026-10-03 09:52:42 +08:00
Qiu Yuzhou a5d96dc990 refactor(rules): keep one conversion path 2026-10-03 02:55:48 +08:00
Qiu Yuzhou fcd5645b68 refactor(rules): slim built-in snapshots 2026-10-03 02:34:04 +08:00
Qiu Yuzhou 59ba9dfeff feat(rules): enhance rule identity documentation and introduce offline testing explanation 2026-10-02 22:38:11 +08:00
Qiu Yuzhou cb5a535297 feat(rules): simplify details and open conversion reports in a window 2026-10-02 20:38:23 +08:00
Qiu Yuzhou 640ebf9f51 docs: record system proxy repair and suspension design (#73) 2026-10-02 10:28:22 +08:00
Qiu Yuzhou a7465154d2 ui(app): show selected address details as caption lines for #72
收起状态按钮只显示当前选中 IP;接口名称(接口:…)与地址类型
(地址类型:…)以说明行展示在按钮下方,与菜单项的 title/subtitle
结构对应。模型移除不再被呈现层使用的 label 组合字段。
2026-10-01 16:06:53 +08:00
Qiu Yuzhou 24666df4ac ui(app): command address menu items with native title/subtitle for #72
Picker(.menu) 的选项桥接会把多 Text 压平成独立菜单项(注记成了单独
item)。改为 Menu + adaptive-controls 桥接(Apple technote 文档化的
title/subtitle 机制):

- 菜单项主行 = IP,副标题 = 「注记 - 接口名称」(无注记时仅接口名称)
- 收起状态显示当前选中项的 {IP} - {name}(borderedButton 样式)
- 选择器下方的类型说明行保留,选中地址类型收起时也可见
2026-10-01 15:54:46 +08:00
Qiu Yuzhou 149cf39ea4 ui(app): render command address annotation as menu subtitle for #72
按 ifconfig 同源的 IPv6 类型注记改为次要文本行呈现:

- 菜单项用两个 Text 桥接 NSMenuItem 原生 subtitle(macOS 14+ 官方机制,
  Apple adaptive controls technote),主行 {IP} - {name} 不再内联注记
- 选择器下方新增说明行「地址类型:{注记}」——无论菜单桥接行为如何,
  当前选中地址的类型始终可见
- TerminalCommandAddress.label 收回纯主行,注记保持独立呈现事实;
  地址身份与命令内容不受影响
2026-10-01 15:43:31 +08:00
Qiu Yuzhou 111fa93131 feat(app): annotate and filter IPv6 command addresses by kernel flags for #72
经 SIOCGIFAFLAG_IN6 逐地址查询内核 IPv6 标志(与 ifconfig 的注记同源,
Darwin 模块不导出该 ioctl 请求宏,手工展开 _IOWR 编码):

- IN6_IFF_TEMPORARY(RFC 4941 隐私临时地址,会轮换)不进候选
- 其余 IPv6 候选在标签 IP 后附类型注记(位于中段):
  autoconf secured / autoconf / dynamic;标志查询失败不注记也不过滤
- 注记只进标签不进命令;地址身份仍为 BSD 接口名 + 规范化 IP

真实主机非视觉验证扩展:每 IPv6 地址标志查询非空、候选注记属 ifconfig
同源闭集、临时地址被过滤;替身用例覆盖 temporary 过滤与标签格式。
2026-10-01 15:19:26 +08:00
Qiu Yuzhou 5c1781c2b8 docs: revise terminal command loopback convention for #72
按 issue #72 设计同步修订:ADR-0015 命令地址段落改为「默认兼容回环 +
非本机方式会话内可选 Wi‑Fi/Ethernet 地址」,表格列名改默认命令地址;
CONTEXT.md 命令定义与监听约束同步;设计文档标记已实现。健康检查与系统
代理目标仍由监听方式确定。
2026-10-01 10:07:05 +08:00
Qiu Yuzhou 82411d92ea docs(design): publish terminal command address design for #72
grill-with-docs 会话产物:交互设计与测试边界定稿,spec 已发布为
issue #72;CONTEXT.md 增加 Terminal command address 词条。
2026-10-01 09:33:08 +08:00
Qiu Yuzhou ab5a153477 docs(adr): record hostless unit tests and the appBundle resource seam in ADR-0021 2026-09-30 20:45:04 +08:00
Qiu Yuzhou ba20e42f11 docs(adr): record BundleProgram key and throttled re-register in ADR-0020 2026-09-30 19:15:33 +08:00
Qiu Yuzhou d2a8d6105c feat(system-proxy): route writes through privileged LaunchDaemon helper
Implements issue #71 with ADR-0020 (supersedes ADR-0019's endpoint-signature
cleanup, startup cleanup, and health-gate cleanup).

- New ShadowsocksX-NG2SystemProxyHelper target: app-bundled root LaunchDaemon
  (SMAppService.daemon, on-demand via MachServices) that mechanically applies
  a closed typed configuration or executes an unconditional clear. Clients are
  accepted by code-signing bundle identifier only; requests run serially on a
  shared queue (last-writer-wins).
- SystemProxyConfiguration is now the closed typed apply payload (Codable over
  JSON XPC): explicit SOCKS/HTTP/HTTPS enable + endpoints, PAC and
  auto-discovery disabled with URL/JS removed, explicit simple-hostname
  exclusion, complete ExceptionsList. Unmodeled Proxies keys are preserved and
  equivalent values skip the commit.
- Cleanup is a side effect of a persisted system-proxy intent on-to-off
  transition only: the switch itself, or the agent-off cascade (persist both
  intents off, clear, then stop listeners; failed cascade persistence records
  no transition and clears nothing). Launch with the switch off, health-gate
  closure, invalid targets, and passive events never clear. Failed clears are
  surfaced without deferred retry.
- Endpoint-signature store, ownership migration, and direct Authorization
  Services writes are removed; old signature files stay inert. Helper
  unavailability or pending approval keeps an enabled intent pending and
  surfaces the Login Items approval path (HomeView button + menu label).
2026-09-30 12:26:40 +08:00
Qiu Yuzhou 08682724c9 fix(system-proxy): reconcile configuration across network changes 2026-09-29 23:39:25 +08:00
Qiu Yuzhou 9284b1c9a1 feat: export configuration groups as SIP-008 JSON 2026-09-29 20:16:05 +08:00
Qiu Yuzhou c50470dc89 refactor(settings): move silent-launch persistence to UserDefaults
Migrate SilentLaunchStore from its versioned JSON file to the app's
standard defaults domain (key `silentLaunch`), the platform's canonical
home for GUI-scalar preferences, so the GUI preference category stops
growing one file per item. Reads stay safe-side strict: a missing key
or a value not bridgeable to Bool loads as not silent (plain
bool(forKey:) would coerce "yes" to true). The file-form
persistence-failure naming path is dropped — UserDefaults.set reports
no failure — so SilentLaunchController keeps its persist-then-flip seam
while errorMessage and its SettingsView presentation go away.

The legacy file never shipped in any release; migrateLegacyFileIfPresent
runs in the production composition root only, preserves the value on
developer machines, and deletes the file (no-op when absent). The test
composition uses a dedicated suite cleared at assembly; unit tests use
per-test suites with removePersistentDomain teardown, never the
standard domain.

ADR-0017 carries a dated amendment (Status plus the affected
consequence line); the settings.json separation rationale stands
unchanged.
2026-09-29 16:06:52 +08:00
Qiu Yuzhou 8b698a0bf1 feat(app): adaptive app form with window-following activation policy
- switch to regular while the workspace window is open (Dock icon,
  app switcher, default menu bar) and back to accessory when it closes;
  driven by NSWindow didBecomeKey/willClose with an anchor-view identity
  filter (scenePhase follows the app rather than windows on macOS, so it
  fires no event on close)
- add silent launch preference (settings-general, off by default,
  persisted in its own silent-launch.json since settings.json is rewritten
  whole from the controller's in-memory snapshot): suppressed launches
  keep the menu-bar baseline and proxy runtime restoration is unaffected
- docs: CONTEXT.md adaptive app form / silent launch terms and invariants;
  ADR 0017 superseding 0016 (scene-based model and reopening carry over)
2026-09-29 15:13:30 +08:00
Qiu Yuzhou 0d0e74d59c feat(ui): menu-bar-only form with scene-based main window
Replace the hybrid form (LSUIElement + runtime activation-policy
switching + AppKit-owned NSWindow) with a plain SwiftUI Window scene:
the app stays accessory at all times, launch presents the workspace
window via defaultLaunchBehavior(.presented), and the status menu
reopens it after close via openWindow. Drop AppDelegate and the
window-opening adapter and intents; WorkspaceRoute keeps navigation
state only, with the scene id defined there. Documented in ADR 0016
and CONTEXT.md.
2026-09-28 19:18:27 +08:00
Qiu Yuzhou cf1834a775 feat(ng2): add four-way listener mode 2026-09-27 20:58:54 +08:00
Qiu Yuzhou 5a05b8a661 refactor(ng2): use sslocal runtime defaults 2026-09-27 17:51:34 +08:00
Qiu Yuzhou e62ce007d7 feat(settings): save proxy ports independently 2026-09-27 17:07:47 +08:00
Qiu Yuzhou 88af8bfdf2 feat(system-proxy): write HTTP/HTTPS alongside SOCKS
Apps honoring only the HTTP proxy family were never proxied under
the SOCKS-only projection. Point system HTTP and HTTPS at the
always-on sslocal HTTP inbound (CONNECT); reject documents lacking
that inbound instead of aiming at port 0. See ADR 0012.
2026-09-27 15:49:03 +08:00
Qiu Yuzhou effae048b8 feat(settings): remove holistic preferences reset
Not every preference warrants a reset; future resets are per
configuration item, added only where a field truly needs one (tracked
in #69). The whole chain goes: the 恢复默认 button and its confirmation
alert in SettingsView, the SettingsWorkflow reset/confirm/cancel
commands and the confirmation machinery they existed for (the
SettingsConfirmation enum had a single case), the
SettingsCommitting.resetPreferences seam entry, the runtime
resetPreferences() and ProxySettingsFileStore.reset() with its
file-rollback helpers and the rollbackFailed store error.

CONTEXT.md drops the three stale reset phrases and now records the
domain decision: no restore-all-factory-defaults action for
preferences; a reset, where it exists, is scoped to one configuration
item. ADR-0004/0005/0011 carry amendment notes since their reset
sentences describe a removed capability (0004's also predate the
PAC removal).
2026-09-27 13:29:32 +08:00
Qiu Yuzhou 8aedf8c42e perf(acl): per-variant ACL files behind a stable active link
Stop rewriting the whole ACL on every proxy-mode switch: materialize one
file per routing shape (acl-<summary>.ini), keep acl-active.ini as a stable
symlink the contract points at, and skip unchanged writes via a digest
manifest. The contract carries only path/summary/sha256 — the agent checks
the link stays inside the runtime directory and never reads ACL bytes.

Agent switch now defaults to off (no server config on a fresh install) and
survives preferences reset, which also returns any held system proxy and
converges a still-running agent onto the factory runtime. See ADR-0011.
2026-09-27 03:14:38 +08:00
Qiu Yuzhou a8cd6262c2 feat(proxy): remove PAC and accept ACL system proxy path
Remove the PAC product feature entirely: PAC HTTP service, port, health
probe, runtime extension, PAC URL system proxy projection, PAC rule
editing, and GFWList URL settings. The product now exposes rule / global /
direct modes only, all projected as a local SOCKS system-proxy target.

First-run defaults are rule + proxyWhenUnmatched, agent on, system proxy
off. Homepage and status menu share one ProxyControlSnapshot showing the
three modes and rule sub-options. Manual servers, subscriptions, Legacy
import, and independent SOCKS/HTTP inbounds are retained.

Fix: include verbose in SslocalListenFingerprint so a verbose-only
contract change restarts sslocal instead of leaving RUST_LOG stale.

Revise CONTEXT.md vocabulary, ADR-0007, and ADR-0009. Record GFWList
exception shadowing, IPv6 system-exception, DNS, and traffic-coverage
boundaries. Add host acceptance evidence document.

Closes #67
2026-09-26 21:58:12 +08:00
Qiu Yuzhou f2e9cff69d feat(proxy): add ACL-backed global mode with local bypass
Global mode now deploys a minimal proxy_all ACL carrying only the fixed
local safety rules, so public targets default through Shadowsocks while
loopback/RFC1918/link-local/ULA/localhost/*.local/no-dot hosts stay
direct for SOCKS, HTTP, and LAN-sharing clients. System proxy exceptions
include that fixed scope; IPv6 system-exception limits are documented
with the ACL as the routing guarantee. Mode switches keep the
full-restart and rollback path.

Closes #62
2026-09-26 12:33:35 +08:00
Qiu Yuzhou 39e25477bb feat(proxy): add ACL-backed direct mode 2026-09-26 11:46:45 +08:00
Qiu Yuzhou 1c5e4e5e23 feat(docs): add research on sslocal password handling via environment variables 2026-09-25 00:51:05 +08:00
Qiu Yuzhou ab6acf8912 refactor(ng2): remove UDP relay preference 2026-09-24 22:00:58 +08:00
Qiu Yuzhou 620c929450 docs(research): survey proxy rule sources 2026-09-24 21:41:33 +08:00
Qiu Yuzhou fb6be460b8 docs(research): assess sslocal ACL as PAC alternative
Document routing, reload, DNS, UDP, and compatibility boundaries
before considering an NG2 runtime migration.
2026-09-24 21:40:51 +08:00