fix: match the web's dev-server filtering on the phone
The web's "running dev servers" list shows ports that belong to a known project (the current one included) or arrive without a directory; ports started outside every project sit behind "show hidden ports". 0.7.2 listed every port that answered with a page, which showed more servers on the phone than in the web. The phone now applies the same known-project filter, so the telegram server on 8080 and the directory-less 9090 both appear. Version 0.7.3+703.
This commit is contained in:
1 parent
b372bce63f
commit
4bd9256ef8
4 files changed
+33
-7
No files matched your search
@@ -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`)
|
## 0.7.2 开发服务器列表改为全机器范围(分支 `flutter`)
|
||||||
|
|
||||||
| 项 | 结果 |
|
| 项 | 结果 |
|
||||||
|
|||||||
@@ -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
|
feature set as the earlier Asuka/Go and MyGo attempts, reimplemented in
|
||||||
Flutter to compare mobile UI maturity.
|
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
|
SOCKS5/socks5h proxy, self-signed certificates and pinning, or a pairing link
|
||||||
over the OpenChamber private relay with end-to-end encryption; the pairing
|
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
|
link is pasted or scanned with the camera), session list with search and live
|
||||||
|
|||||||
@@ -181,13 +181,30 @@ class _BrowserPanelState extends State<BrowserPanel> {
|
|||||||
try {
|
try {
|
||||||
final list = await cl.devServers(directory: widget.directory);
|
final list = await cl.devServers(directory: widget.directory);
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
// The web client's "running dev servers" list is machine-wide, not
|
// Match the web client's "running dev servers": a port that answered
|
||||||
// scoped to the open project, so show the same set here. Only ports
|
// with a page is listed when it belongs to a known project (or carries
|
||||||
// that answered with a page (the web client hides the rest behind
|
// no directory, which is how announced servers arrive). Ports started
|
||||||
// "show hidden ports") are listed.
|
// outside every project stay behind the web client's "show hidden
|
||||||
|
// ports" too.
|
||||||
|
final known = <String>[
|
||||||
|
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 = [
|
final filtered = [
|
||||||
for (final server in list)
|
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));
|
]..sort((a, b) => a.port.compareTo(b.port));
|
||||||
setState(() {
|
setState(() {
|
||||||
_servers = filtered;
|
_servers = filtered;
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ name: openchamber
|
|||||||
description: "A lightweight OpenChamber client for phones."
|
description: "A lightweight OpenChamber client for phones."
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.7.2+702
|
version: 0.7.3+703
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.14.0
|
sdk: ^3.14.0
|
||||||
|
|||||||
Reference in new issue
Block a user