Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(desktop): 独立测试包支持局域网访问

longmeidaod815ff95f935
diff --git a/README.en.md b/README.en.md
index ae204704e..55fd7d77f 100644
--- a/README.en.md
+++ b/README.en.md
@@ -65,8 +65,9 @@ Peach is **pre-1.0**. The application interface is currently Chinese only.
2. Open `Peach.exe`, select existing media folders in the setup page and submit.
3. Browse your library. Media and service configuration are available from page settings or the tray menu.
-The test package is accessible only on the same computer and needs no Python, Git, Node or OpenSSL.
-Data lives separately from the program in `%LOCALAPPDATA%\Peach\peach-data`.
+The test package can stay local to one computer or allow devices on the same LAN during first-run setup.
+LAN clients open `http://<configured-name>.local:<port>`; on first use, allow only Private networks in the Windows Firewall prompt.
+No Python, Git, Node or OpenSSL is required. Data lives separately from the program in `%LOCALAPPDATA%\Peach\peach-data`.
Settings → “This computer” → Updates and maintenance compares the installed version with the latest GitHub prerelease.
Automatic updates can check every 6 hours, daily, or weekly and are off by default. Standalone packages can download automatically and wait for restart confirmation; source installations support automatic checks.
diff --git a/README.md b/README.md
index fa021ee57..12c3c2488 100644
--- a/README.md
+++ b/README.md
@@ -65,8 +65,9 @@ Peach 处于 **pre-1.0** 阶段,界面目前只有中文。
2. 双击 `Peach.exe`,在首次设置页选择已有媒体文件夹并提交。
3. 打开馆藏浏览;媒体文件夹与服务配置可从页面设置或托盘进入。
-测试包只在本机访问,不需要 Python、Git、Node 或 OpenSSL。数据保存在
-`%LOCALAPPDATA%\Peach\peach-data`,与程序目录分开。
+测试包可只在本机访问,也可在首次设置中允许同一局域网的设备访问;局域网模式通过
+`http://<设置的名字>.local:<端口>` 打开,首次连接时只允许 Windows 防火墙的专用网络。
+不需要 Python、Git、Node 或 OpenSSL。数据保存在 `%LOCALAPPDATA%\Peach\peach-data`,与程序目录分开。
右上角「设置 →『这台电脑』→ 更新与维护」比对 GitHub 上的最新测试版,独立包可以在页面里下载并安装,失败时恢复旧版;
也可以退出托盘后手动完整解压新版,保留数据目录。同一处提供卸载,可选是否一并删除 Peach 数据,原始媒体保留。
diff --git a/docs/OPERATIONS.md b/docs/OPERATIONS.md
index b9bd0c876..e679dad6d 100644
--- a/docs/OPERATIONS.md
+++ b/docs/OPERATIONS.md
@@ -69,11 +69,11 @@ Peach 这一侧的行为:首启页与配置页按本机系统检测 CloudDrive
这条服务没有 TLS、口令强制置空(安全边界就是那个绑定地址),首页是首次运行表单,提交端点
是 `POST /setup`:应用已配置回 404、非回环调用方回 403、设置文件已存在回 409。
- 切换由 `tray.SetupGate` 做,Windows 托盘与 macOS 菜单栏共用。它挂在健康轮询里(Windows 10 秒、
- macOS 5 秒),每轮新鲜 `settings_file.load_config()`:不再需要设置且 TLS 材料齐了,就停掉引导
- 服务、按新数据根构建正常规格(`build_service_specs(tls_dir=..., mdns_hostname=...)`)并启动,
- 托盘进程本身不重启。TLS 还没齐(例如这台机器没有 openssl)就原地等下一轮,不会拿一组缺文件
- 的规格去启动。mDNS 名同样由这里传进规格:明文口的 `--redirect-origin` 必须是表单刚写下的
- `<mdns_name>.local`,而 `peach.config.MDNS_HOSTNAME` 是托盘 import 期就定型的旧值。
+ macOS 5 秒),每轮新鲜 `settings_file.load_config()`:不再需要设置就停掉引导服务,按新数据根
+ 构建正常规格并启动,托盘进程本身不重启。独立测试包按设置在高位端口提供 HTTP:本机模式绑定
+ `127.0.0.1` 且不发布 mDNS,局域网模式绑定 `0.0.0.0` 并发布 `<mdns_name>.local:<端口>`;托盘打开与
+ 健康检查始终走回环。源码部署仍由 `build_service_specs(tls_dir=..., mdns_hostname=...)` 构建 HTTP
+ 跳转与 HTTPS 入口,TLS 材料没齐就原地等下一轮。mDNS 名由这里传进规格,不读 import 期旧值。
- 首扫不跑在引导服务里——那个进程在切换的那一刻就被停掉了。表单勾了「现在扫描」只写一个
一次性标记 `<数据根>/state/first-scan.request`(内容是来源 ID),托盘切换完成后读走并删除它,
用子进程跑 `peach scan <来源>`,输出落在 `<数据根>/logs/tray-scan.out.log`。标记只消费一次。
@@ -170,7 +170,7 @@ curl -s --noproxy '*' -o /dev/null -w '%{http_code}\n' https://peach.local/healt
验收四项:菜单栏只出现一个 Peach 图标且 `status` 报「已加载」;`launchctl print` 的 pid 就是那个菜单栏进程;`pfctl -s nat` 列出 80 → 8900、443 → 8443 两条 rdr;两条 `/healthz` 都回 200。`peach.local` 换成本机 `[server].mdns_name` 的值。
- 发布入口是 `scripts/build_windows.ps1`:先用 `scripts/generate_brand_assets.py` 生成方形 Logo 与多尺寸 `.ico`,再构建单一 `dist/Peach/Peach.exe`;无参数运行托盘,`serve`/`migrate` 运行 CLI。桌面快捷方式和开机自启都在配置页的「开机自启」一组里开关,由 `src/peach/desktop_startup.py` 落盘;`scripts/manage_tray_startup.ps1` 只作发布包的排障入口。
-- 对外测试包由 `.github/workflows/release.yml` 承担:`build_windows.ps1 -Standalone` 用 PyInstaller onedir 生成完整 Windows 程序目录,压缩后由不检出源码的消费任务运行 `scripts/smoke_desktop.py`。`v<__version__>` tag 与版本不一致会失败,通过制品验收才创建 GitHub 预发布并附 SHA256;`workflow_dispatch` 只生成和验收 artifact。macOS 独立包另列待办,源码菜单栏构建入口仍为 `build_macos_app.py`。
+- 对外测试包由 `.github/workflows/release.yml` 承担:`build_windows.ps1 -Standalone` 用 PyInstaller onedir 生成完整 Windows 程序目录,压缩后由不检出源码的消费任务运行 `scripts/smoke_desktop.py`;冒烟会完成首启、以 `0.0.0.0` 重启、从本机局域网地址读取 `/healthz`、核对 mDNS 已装配并用访问密码登录。`v<__version__>` tag 与版本不一致会失败,通过制品验收才创建 GitHub 预发布并附 SHA256;`workflow_dispatch` 只生成和验收 artifact。macOS 独立包另列待办,源码菜单栏构建入口仍为 `build_macos_app.py`。
- 刷新源码运行态不要用 Computer Use 点托盘:`python scripts/restart_windows_tray.py` 按精确 EXE 路径找到 pystray 隐藏窗口、发送正常停止消息、等托盘自行关闭子服务,再静默启动并核对新托盘重新拥有两个服务;找不到唯一窗口或退出超时就拒绝,绝不强杀后另启。`--swap-from <暂存包>` 让它在旧托盘退出后、新托盘启动前顺手换掉二进制,那是整条链路上唯一一个目标文件没有进程持有的窗口;换生产二进制用下面那条入口,不要单独调它。打包托盘窗口不在时命令自动改走源码托盘:`find_source_tray_windows()` 按同一窗口类名加「命令行含 `peach.tray`」认源码托盘,`restart_source_tray()` 照抄原命令行(含 `--show`/数据根)等托盘退出后自起,不换包不备份;`--source` 显式跳过打包入口。
- 换掉生产托盘二进制走 `python scripts/deploy_windows_tray.py`,在主检出里用项目 venv 的 Python 跑:拒绝脏检出 → 按 HEAD 提交号在 `<数据根>/state/source-sync-build/<commit>/` 构建 → 让暂存包自己跑一次 `migrate status` → 停旧托盘、原地换 `dist/Peach/Peach.exe`(旧的留成 `Peach.pre-source-sync-<时间>.exe`)、起新托盘 → 用项目 CA 严格校验读生产 HTTPS 口的 `/healthz`。验收按回话的是谁分成两条:独立发行版里回话的就是冻结进程自己,核对它报的 `build_commit` 等于这次打包的提交;本机这套形态下回话的是 venv 里的源码进程——托盘刻意把两个子服务交回项目 venv(`src/peach/tray.py` 的 `_peach_executable()`),那个进程没有第二个版本,`build_commit` 结构上恒为 None——这时核对生产入口那个文件的 sha256 等于这次打出来的暂存包,而托盘正是换完之后才从这个文件起来并拿到两个子服务的。两条都不认版本号:版本号一次发布才推一格,同一个号下有很多个构建,只比版本号证明不了二进制换掉了。结果打印成一份 JSON,`step` 说明停在哪一步。新托盘起不来或拿不到两个子服务时自动换回备份并重开旧托盘;`--staged <路径>` 复用已经打好的包、跳过构建。不要就地构建 `dist/Peach/`:运行中的托盘持有那个文件,PyInstaller 清目录会撞上 WinError 5。换生产入口本身仍要当场授权,脚本不代替那次授权。
- `dist/Peach/Peach.exe` 是本机打包入口而不是可移动的独立发行版:托盘只打包了自己,服务进程仍由项目 venv 的 `peach.exe` 承担,`_peach_executable()` 从 exe 位置逐级向上找 `.venv\Scripts\peach.exe`,所以不要按「单文件绿色版」对外描述。
diff --git a/docs/PRODUCT_BACKLOG.md b/docs/PRODUCT_BACKLOG.md
index 018da7b6a..9e67ed1da 100644
--- a/docs/PRODUCT_BACKLOG.md
+++ b/docs/PRODUCT_BACKLOG.md
@@ -14,8 +14,6 @@ Board 视觉层是唯一一套界面,没有切换开关;Board 风格的视
## 已有骨架、尚未完成(7 项)
-- Windows 独立测试包的局域网访问与 mDNS:按用户要求先恢复本机访问,后续加入此功能;测试域名与开发环境隔离。首启页的局域网选项与当前测试包限制不一致,也在此项闭环。
-
本轮实施顺序(评审来源:[外部复评](https://chatgpt.com/c/6a9ad810-6148-83e9-95dd-6b58ef28e7ec),按当前源码核对;候选实现与生产验收分开):
- 运行与一致性:HTTP 只跳转 HTTPS;业务与调度由单一应用拥有;成功提交后失效缓存;缓存有界;可更新图片可复验;列表参数有上下界。
diff --git a/docs/TESTING_DESKTOP.md b/docs/TESTING_DESKTOP.md
index 9b048e4ae..c7b6c8c99 100644
--- a/docs/TESTING_DESKTOP.md
+++ b/docs/TESTING_DESKTOP.md
@@ -2,9 +2,11 @@
1. 下载 `Peach-<版本>-windows-x64.zip`,右键「全部解压」。保留整个 `Peach` 文件夹。
2. 双击 `Peach.exe`。浏览器会打开首次设置页。
-3. 填入已有媒体文件夹的完整路径,选择是否立即扫描,提交。设置完成后自动进入馆藏。
+3. 填入已有媒体文件夹的完整路径,选择访问范围与是否立即扫描,提交。设置完成后自动进入馆藏。
-测试包仅在这台电脑访问,不需要安装 Python、Git、Node 或 OpenSSL。
+选择「只有这台电脑」时从 `http://127.0.0.1:<端口>` 打开;选择「同一局域网的设备」时,
+其他设备从 `http://<设置的名字>.local:<端口>` 打开。Windows 首次询问防火墙权限时只允许
+「专用网络」;不需要安装 Python、Git、Node 或 OpenSSL。局域网里有其他使用者时建议开启访问密码。
数据保存在当前用户的 `%LOCALAPPDATA%\Peach\peach-data`,和程序目录分开。
## 配置与反馈
@@ -13,6 +15,7 @@
- 保存配置会重新启动本机服务,正在播放的视频会中断;已有配置备份为 `config.previous.toml`。
- 配置页列出版本、数据目录和日志目录。反馈问题时写上版本、操作步骤、预期结果和实际结果;日志请先检查并移除个人路径与来源网址,不发送 `secrets` 目录或账本。
- 端口被占用时,退出占用该端口的其他程序后重试;修改端口时界面会检查冲突。
+- 局域网地址解析不到时,确认两台设备在同一个网络、路由器没有开启客户端隔离,并检查 Windows 防火墙是否允许 Peach 的专用网络连接。
- 测试包没有代码签名。如果 Windows 提示未识别应用,请核对下载来自本项目 Release,并与 `SHA256SUMS.txt` 对照后再决定是否运行。
## 采集测试
diff --git a/scripts/smoke_desktop.py b/scripts/smoke_desktop.py
index 8d4f70050..088bd4677 100644
--- a/scripts/smoke_desktop.py
+++ b/scripts/smoke_desktop.py
@@ -15,6 +15,27 @@ import urllib.request
import urllib.parse
+def wait_health(opener, base: str, process: subprocess.Popen, log_path: Path) -> dict:
+ deadline = time.monotonic() + 40
+ while True:
+ try:
+ with opener.open(base + "/healthz", timeout=1) as response:
+ return json.load(response)
+ except (OSError, urllib.error.URLError):
+ if process.poll() is not None or time.monotonic() > deadline:
+ raise RuntimeError(log_path.read_text(errors="replace"))
+ time.sleep(.25)
+
+
+def lan_base(port: int) -> str:
+ routed = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ try:
+ routed.connect(("192.0.2.1", 80))
+ return f"http://{routed.getsockname()[0]}:{port}"
+ finally:
+ routed.close()
+
+
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("executable", type=Path)
@@ -33,26 +54,20 @@ def main() -> int:
with socket.socket() as reservation:
reservation.bind(("127.0.0.1", 0))
port = reservation.getsockname()[1]
- command = [str(executable), "serve", "--host", "127.0.0.1", "--port", str(port),
- "--no-ledger-sync", "--no-mdns"]
- process = subprocess.Popen(command + ["--setup"], cwd=root, env=environment, stdout=log, stderr=log)
+ setup_command = [str(executable), "serve", "--host", "127.0.0.1", "--port", str(port),
+ "--no-ledger-sync", "--no-mdns", "--setup"]
+ process = subprocess.Popen(setup_command, cwd=root, env=environment, stdout=log, stderr=log)
try:
opener = urllib.request.build_opener(urllib.request.ProxyHandler({}),
urllib.request.HTTPCookieProcessor(http.cookiejar.CookieJar()))
base = f"http://127.0.0.1:{port}"
- deadline = time.monotonic() + 40
- while True:
- try:
- with opener.open(base + "/healthz", timeout=1) as response:
- health = json.load(response)
- break
- except (OSError, urllib.error.URLError):
- if process.poll() is not None or time.monotonic() > deadline:
- raise RuntimeError((root / "runtime.log").read_text(errors="replace"))
- time.sleep(.25)
+ health = wait_health(opener, base, process, root / "runtime.log")
with opener.open(base + "/", timeout=5) as response:
assert 'action="/setup"' in response.read().decode("utf-8")
- form = {"media_dir": str(media), "media_location": "115", "port": str(port)}
+ password = "standalone-smoke-password"
+ form = {"media_dir": str(media), "media_location": "115", "host": "2",
+ "port": str(port), "mdns_name": "peach", "access_enabled": "y",
+ "access_password": password, "access_confirm": password}
request = urllib.request.Request(base + "/setup",
data=urllib.parse.urlencode(form).encode(), headers={"Origin": base})
with opener.open(request, timeout=60) as response:
@@ -60,17 +75,19 @@ def main() -> int:
assert (data / "database" / "ledger.db").is_file()
process.terminate()
process.wait(timeout=15)
+ command = [str(executable), "serve", "--host", "0.0.0.0", "--port", str(port),
+ "--no-ledger-sync"]
process = subprocess.Popen(command, cwd=root, env=environment, stdout=log, stderr=log)
- deadline = time.monotonic() + 40
- while True:
- try:
- with opener.open(base + "/healthz", timeout=1) as response:
- health = json.load(response)
- break
- except (OSError, urllib.error.URLError):
- if process.poll() is not None or time.monotonic() > deadline:
- raise RuntimeError((root / "runtime.log").read_text(errors="replace"))
- time.sleep(.25)
+ health = wait_health(opener, base, process, root / "runtime.log")
+ assert health["mdns_backend"]
+ assert health["mdns_service_host"] == "peach.local"
+ with opener.open(lan_base(port) + "/healthz", timeout=5) as response:
+ assert json.load(response)["ok"]
+ login = urllib.request.Request(base + "/login",
+ data=urllib.parse.urlencode({"token": password, "days": "0"}).encode(),
+ headers={"Origin": base})
+ with opener.open(login, timeout=10) as response:
+ assert response.status == 200
for path in ("/", "/app.css", "/app.js", "/dist/peach-ui.js", "/api/items"):
with opener.open(base + path, timeout=10) as response:
assert response.status == 200, path
@@ -92,7 +109,7 @@ def main() -> int:
assert (data / "config.previous.toml").is_file()
assert (data / "state" / "configuration-reload.request").is_file()
print(json.dumps({"ok": True, "version": health.get("version"),
- "checks": ["oobe", "migrations", "serve", "automatic-login", "pages", "island", "items", "clouddrive-configuration"]}))
+ "checks": ["oobe", "migrations", "lan-bind", "mdns", "password-login", "pages", "island", "items", "clouddrive-configuration"]}))
finally:
process.terminate()
process.wait(timeout=15)
diff --git a/src/peach/routes_pages.py b/src/peach/routes_pages.py
index 50cfa709f..c6683ad27 100644
--- a/src/peach/routes_pages.py
+++ b/src/peach/routes_pages.py
@@ -490,7 +490,11 @@ def _field_html(question, value: str, error: str, note: str) -> str:
f'spellcheck="false" aria-invalid="{"true" if error else "false"}" '
f'value="{escape(value, quote=True)}">')
if question.key == "mdns_name":
- control = f'<div class="affix"><span>https://</span>{control}<span>.local</span></div>'
+ scheme = "http" if distribution.standalone() else "https"
+ control = f'<div class="affix"><span>{scheme}://</span>{control}<span>.local</span></div>'
+ if distribution.standalone():
+ help_text = ("其他设备打开这个地址时要加上上面的端口,例如 "
+ "http://peach.local:8900。首次连接请允许 Windows 专用网络访问。")
elif question.key == "port":
control = f'<div class="affix"><span>localhost:</span>{control}</div>'
else:
@@ -602,8 +606,11 @@ def setup_done_page(applied, *, windows: bool, scan_requested: bool, history_gui
def _normal_url(config) -> str:
- """设置完成之后正常服务的地址。只有这台电脑就给回环,局域网给 `<名字>.local`。"""
- if config.server.host in _LOOPBACK:
+ """设置完成之后本机浏览器要去的地址。
+
+ 独立包即使对局域网监听,本机也走回环;源码部署才走由托盘维护的 HTTPS 固定入口。
+ """
+ if distribution.standalone() or config.server.host in _LOOPBACK:
return f"http://127.0.0.1:{config.server.port}/"
return f"https://{config.server.mdns_name}.local/"
diff --git a/src/peach/tray.py b/src/peach/tray.py
index aa629e2c0..3e62fa353 100644
--- a/src/peach/tray.py
+++ b/src/peach/tray.py
@@ -655,16 +655,21 @@ def normal_url(config) -> str:
def configured_service_specs(config) -> tuple[ServiceSpec, ...]:
- """独立测试包按设置文件启动本机服务;源码入口沿用其生命周期。"""
+ """独立测试包按设置文件启动服务;源码入口沿用其生命周期。
+
+ 独立包不接管 80/443,也不要求安装本机 CA:局域网模式直接在用户填写的高位端口
+ 提供 HTTP,并发布带端口的 mDNS 服务。托盘自己仍从回环地址打开和做健康检查,
+ 不把本机操作绕去网卡、代理或 mDNS。
+ """
from .distribution import standalone
if not standalone():
return build_service_specs(tls_dir=config.directory("secrets") / "tls",
mdns_hostname=normal_hostname(config))
- if config.server.host != "127.0.0.1":
- raise ValueError("独立测试包只支持本机访问,请在配置中选择「只有这台电脑」")
return (ServiceSpec("http", setup_url(config) + "healthz",
- (str(_peach_executable()), "serve", "--host", "127.0.0.1",
- "--port", str(config.server.port), "--no-mdns", "--no-ledger-sync"),
+ (str(_peach_executable()), "serve", "--host", config.server.host,
+ "--port", str(config.server.port),
+ *(("--no-mdns",) if config.server.host == "127.0.0.1" else ()),
+ "--no-ledger-sync"),
True),)
diff --git a/tests/test_complexity_ratchet.py b/tests/test_complexity_ratchet.py
index 6ea1c303d..4d17513e2 100644
--- a/tests/test_complexity_ratchet.py
+++ b/tests/test_complexity_ratchet.py
@@ -56,7 +56,6 @@ BASELINE: dict[str, int] = {
"src/peach/fc2_similarity.py:media_evidence": 34,
"scripts/clean_names.py:run": 33,
"scripts/harvest_studio_icons.py:icon_row": 32,
- "scripts/smoke_desktop.py:main": 32,
"src/peach/jav_cover_fetch.py:best_cover": 32,
"scripts/find_ads.py:find_candidates": 31,
"scripts/rehome_unknown_jav.py:build_plan": 31,
diff --git a/tests/test_configuration_sources.py b/tests/test_configuration_sources.py
index 159d5fd51..896c29bca 100644
--- a/tests/test_configuration_sources.py
+++ b/tests/test_configuration_sources.py
@@ -107,6 +107,7 @@ class MediaConfigurationTests(unittest.TestCase):
packaged = setup_done_page(SimpleNamespace(config=config, tree=tree), windows=True,
scan_requested=False, history_guide=True)
self.assertIn('<a class="setup-enter" href=', packaged)
+ self.assertIn(f'href="http://127.0.0.1:{config.server.port}/taste?onboarding=1"', packaged)
self.assertIn('>导入浏览器历史记录</a>', packaged)
self.assertIn('<details><summary><span>运行信息</span>', packaged)
self.assertNotIn('<details open', packaged)
diff --git a/tests/test_onboarding.py b/tests/test_onboarding.py
index 517c870d2..e457f5262 100644
--- a/tests/test_onboarding.py
+++ b/tests/test_onboarding.py
@@ -16,7 +16,7 @@ from html import escape
from pathlib import Path
from unittest import mock
-from peach import onboarding, routes_pages, settings_file
+from peach import distribution, onboarding, routes_pages, settings_file
NATIVE_WINDOWS = os.name == "nt"
HAS_HTTP_DEPS = all(importlib.util.find_spec(name) for name in ("fastapi", "httpx"))
@@ -474,9 +474,12 @@ class SetupPageTests(_Case):
# 选「只有这台电脑」时局域网地址整项隐藏,输入框同时禁用、不随表单提交。
self.assertIn("field.disabled=!lan", body)
self.assertIn("fieldRow.hidden=!lan", body)
- # 局域网访问地址只填名字,框内前缀 `https://`、后缀 `.local` 拼成完整网址。
- self.assertIn('<div class="affix"><span>https://</span><input', body)
+ # 局域网访问地址只填名字。独立包走自己的高位 HTTP 端口,源码部署才走固定 HTTPS。
+ scheme = "http" if distribution.standalone() else "https"
+ self.assertIn(f'<div class="affix"><span>{scheme}://</span><input', body)
self.assertIn("<span>.local</span>", body)
+ if distribution.standalone():
+ self.assertIn("http://peach.local:8900", body)
# 端口只填写数字,localhost 是不可编辑的固定前缀。
self.assertIn('<div class="affix"><span>localhost:</span><input id="f-port"', body)
# 密码默认关闭;开启后脚本才显示并启用两项输入。
@@ -1041,8 +1044,21 @@ class StandaloneConfigurationTests(_Case):
spec, = configured_service_specs(self.config)
self.assertEqual(spec.health_url, "http://127.0.0.1:9123/healthz")
self.assertIn("9123", spec.command)
+ self.assertIn("--no-mdns", spec.command)
self.assertEqual(normal_url(self.config), "http://127.0.0.1:9123/")
+ def test_standalone_lan_binds_all_interfaces_and_publishes_mdns(self):
+ from dataclasses import replace
+ from peach.tray import configured_service_specs, normal_url
+ lan = replace(self.config, server=replace(
+ self.config.server, host="0.0.0.0", port=9123, mdns_name="peach-test"))
+ spec, = configured_service_specs(lan)
+ self.assertEqual(spec.health_url, "http://127.0.0.1:9123/healthz")
+ self.assertEqual(spec.command[spec.command.index("--host") + 1], "0.0.0.0")
+ self.assertNotIn("--no-mdns", spec.command)
+ self.assertIn("--no-ledger-sync", spec.command)
+ self.assertEqual(normal_url(lan), "http://127.0.0.1:9123/")
+
def test_standalone_version_inspection_does_not_execute_git(self):
from peach.versioning import VersionManager
execute = mock.Mock(side_effect=AssertionError("Git must not run"))