diff --git a/PLAN.md b/PLAN.md index 6dc979f..cb0928d 100644 --- a/PLAN.md +++ b/PLAN.md @@ -5,6 +5,15 @@ --- +## 0.7.3 开发服务器列表与网页端同一套过滤(分支 `flutter`) + +| 项 | 结果 | +| --- | --- | +| 列表 | 0.7.2 放开了项目目录过滤,结果把 `~/.config/pitchfork`、`~/Downloads` 等不在项目列表里的端口也列了出来(手机 7 个,网页只有 2 个)。现在按网页端的规则:只列出「返回了网页」且目录属于已知项目(含当前目录)或没有目录(announced)的端口;不在任何项目里的端口像网页端一样隐藏在「显示已隐藏端口」之后。Telegram 的 8080 属于已知项目、9090 没有目录,两者都会显示 | +| 版本 | **0.7.3(code 703)** | + +--- + ## 0.7.2 开发服务器列表改为全机器范围(分支 `flutter`) | 项 | 结果 | diff --git a/README.md b/README.md index d58c9dd..6f7dc49 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Android first. This branch (`flutter`) is a framework evaluation: the same feature set as the earlier Asuka/Go and MyGo attempts, reimplemented in Flutter to compare mobile UI maturity. -Status: 0.7.2 — servers (passwordless / password login, HTTP/HTTPS and +Status: 0.7.3 — servers (passwordless / password login, HTTP/HTTPS and SOCKS5/socks5h proxy, self-signed certificates and pinning, or a pairing link over the OpenChamber private relay with end-to-end encryption; the pairing link is pasted or scanned with the camera), session list with search and live diff --git a/lib/screens/browser_panel.dart b/lib/screens/browser_panel.dart index 348978e..d66111b 100644 --- a/lib/screens/browser_panel.dart +++ b/lib/screens/browser_panel.dart @@ -181,13 +181,30 @@ class _BrowserPanelState extends State { try { final list = await cl.devServers(directory: widget.directory); if (!mounted) return; - // The web client's "running dev servers" list is machine-wide, not - // scoped to the open project, so show the same set here. Only ports - // that answered with a page (the web client hides the rest behind - // "show hidden ports") are listed. + // Match the web client's "running dev servers": a port that answered + // with a page is listed when it belongs to a known project (or carries + // no directory, which is how announced servers arrive). Ports started + // outside every project stay behind the web client's "show hidden + // ports" too. + final known = [ + if (widget.directory.isNotEmpty) widget.directory, + for (final project in widget.app.projects) + if (project.canonical.isNotEmpty) project.canonical, + ]; + bool knownDirectory(String directory) { + if (directory.isEmpty || known.isEmpty) return true; + for (final root in known) { + if (samePath(root, directory) || isUnderDirectory(directory, root)) { + return true; + } + } + return false; + } + final filtered = [ for (final server in list) - if (server.title.isNotEmpty) server, + if (server.title.isNotEmpty && knownDirectory(server.directory)) + server, ]..sort((a, b) => a.port.compareTo(b.port)); setState(() { _servers = filtered; diff --git a/pubspec.yaml b/pubspec.yaml index f4d08b3..64ace4a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: openchamber description: "A lightweight OpenChamber client for phones." publish_to: 'none' -version: 0.7.2+702 +version: 0.7.3+703 environment: sdk: ^3.14.0