From 09708bd9a4ac80819aba87807749c7af48d37a5f Mon Sep 17 00:00:00 2001 From: ericwyuan Date: Fri, 28 Aug 2026 09:29:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(fam-core):=20=E4=BF=AE=E5=A4=8D=20/api/stat?= =?UTF-8?q?us=20=E5=92=8C=20/api/ss/status=20500=EF=BC=88=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=20Webhook=20=E9=87=8D=E6=9E=84=E9=81=97=E7=95=99?= =?UTF-8?q?=E6=AD=BB=E5=BC=95=E7=94=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上次"移除 SS Webhook 可选路径"重构(cf3d145)删掉了 MotionNotifier 的 camera_name_to_id/_ss_name_to_id/_camera_loaded 三个属性初始化,但 status() 方法忘记同步删除对它们的引用,导致任何调用 status() 的地方 (/api/status、/api/ss/status)直接抛 AttributeError 500——这两个端点 自那次重构部署后就一直是坏的,服务状态页无法访问。 顺带修 test_auth.py 里断言 /api/ss/webhook 应该被鉴权白名单放行的过时 测试——这个端点本身已经在同一次重构里被彻底删除(motion_bp.py 不再 注册该路由),白名单移除是对的,是测试没跟上。 已在 NAS 上部署验证:登录后 /api/status 恢复正常返回。 Co-Authored-By: Claude Sonnet 5 --- fam-core/src/fam_core/motion_notifier/motion_notifier.py | 2 -- fam-core/tests/test_auth.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/fam-core/src/fam_core/motion_notifier/motion_notifier.py b/fam-core/src/fam_core/motion_notifier/motion_notifier.py index 720090a..c62a989 100644 --- a/fam-core/src/fam_core/motion_notifier/motion_notifier.py +++ b/fam-core/src/fam_core/motion_notifier/motion_notifier.py @@ -360,8 +360,6 @@ class MotionNotifier: "running": self.is_alive(), "enabled": self.enabled, "poll_enabled": self.poll_enabled, - "camera_map": {**self.camera_name_to_id, **self._ss_name_to_id}, - "camera_loaded": self._camera_loaded, "last_event_id": self._last_event_id, "zero_dur_pending": len(self._zero_dur_ids), "last_poll_at": self._last_poll_at.isoformat() if self._last_poll_at else None, diff --git a/fam-core/tests/test_auth.py b/fam-core/tests/test_auth.py index d526868..0ab66b9 100644 --- a/fam-core/tests/test_auth.py +++ b/fam-core/tests/test_auth.py @@ -93,7 +93,7 @@ def test_is_authed_false_without_cookie(): def test_whitelist_exact_paths(): for path in ('/login', '/api/login', '/api/logout', '/api/auth/check', - '/health', '/favicon.ico', '/api/ss/webhook'): + '/health', '/favicon.ico'): assert auth._is_whitelisted(path) is True