Peach: Local-first video metadata scraper and media manager.
fix(onboarding): 账本不可读时保留配置页入口
longmeidaod3355c95b7ec
diff --git a/src/peach/routes_pages.py b/src/peach/routes_pages.pyindex fcb8c9ad2..b64c01bbf 100644--- a/src/peach/routes_pages.py+++ b/src/peach/routes_pages.py@@ -19,6 +19,7 @@ import gzipimport hashlibimport jsonimport os+import sqlite3import sysimport threadingfrom collections import OrderedDict@@ -312,8 +313,12 @@ def index(request: Request, args: dict[str, str] = Depends(require_page_auth)):from .client_updates import runtime_identityhtml = settings.page_path.read_text(encoding="utf-8")from .web_tutorial import q_tutorial_progress- if q_tutorial_progress(request.app.state.web_contract)['completed']:- html = html.replace('id="tutorialBtn"', 'id="tutorialBtn" hidden', 1)+ try:+ if q_tutorial_progress(request.app.state.web_contract)['completed']:+ html = html.replace('id="tutorialBtn"', 'id="tutorialBtn" hidden', 1)+ except sqlite3.Error:+ # 账本不可读时仍可进入配置;教程客户端保留“未取得状态”的提示与重试入口。+ passentries = {'peach-client-runtime': runtime_identity()}if shape is not None:entries['peach-entity-shape'] = shapediff --git a/tests/test_fastapi_api.py b/tests/test_fastapi_api.pyindex 3375ba6fb..a8ab8035d 100644--- a/tests/test_fastapi_api.py+++ b/tests/test_fastapi_api.py@@ -3873,6 +3873,10 @@ class UnconfiguredMachineTests(unittest.IsolatedAsyncioTestCase):ready = await client.get("/healthz?ready=1")self.assertEqual(ready.status_code, 503)self.assertFalse(ready.json()["ready"])+ for path in ('/', '/settings/library'):+ page = await client.get(path)+ self.assertEqual(page.status_code, 200)+ self.assertIn('id="tutorialBtn"', page.text)self.assertEqual([record.levelname for record in captured.records], ["WARNING"])self.assertIn("数据库准备完成后重启服务", captured.output[0])self.assertNotIn(str(database), captured.output[0])