Files
tw2/qingjian_cs/app/runtime_switch.py
jimi ed0bc2a56d
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
feat: add runtime listen-only switch and API controls
2026-03-03 10:42:47 +08:00

21 lines
354 B
Python

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