INNER CODE UNIT · Python
_is_windows_desktop
slive777/OpenAver · web/app.py:560
def _is_windows_desktop() -> bool:
"""True のみ Windows 桌面 App(feature/82 T4:OPENAVER_STANDALONE env + win32 雙重條件)。
非桌面 / 非 Windows → False,Settings 中不渲染 close_action 下拉。"""
return os.environ.get("OPENAVER_STANDALONE") == "1" and sys.platform == "win32"
def _is_mac_desktop() -> bool:
"""True 僅限 macOS 桌面 App(OPENAVER_STANDALONE=1 AND darwin)。"""
return os.environ.get("OPENAVER_STANDALONE") == "1" and sys.platform == "darwin"
def get_common_context(request: Request) -> dict:
"""取得共用的模板 Context (包含設定)"""
from core.config import load_config, mutate_config
from core.i18n import t as _t, get_merged_translations, detect_locale_from_accept_language
config = load_config()
# Font size mapping