feat: add runtime listen-only switch and API controls
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled

This commit is contained in:
2026-03-03 10:42:47 +08:00
parent 00166d7ebf
commit ed0bc2a56d
3 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
from __future__ import annotations
import threading
_lock = threading.Lock()
_listen_only_mode = False
def set_listen_only(enabled: bool) -> bool:
global _listen_only_mode
with _lock:
_listen_only_mode = bool(enabled)
return _listen_only_mode
def is_listen_only() -> bool:
with _lock:
return _listen_only_mode