fixes button

This commit is contained in:
2026-06-26 14:45:42 +03:00
parent 84a007f9d0
commit cdb731d837
33 changed files with 594 additions and 99 deletions
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
"""Deploy-time master password (emergency fallback for web + Qt).
Read order:
1. BUTTONTASK_MASTER_PASSWORD environment variable
2. <config>/.master file (created once at deploy via bt-set-master)
The file is not part of OTA packages and is not committed to git.
"""
import os
from pathlib import Path
from config_store import config_path
MASTER_FILENAME = ".master"
def master_password_path():
env = os.environ.get("BUTTONTASK_MASTER_FILE")
if env:
return Path(env)
return config_path().parent / MASTER_FILENAME
def load_master_password():
env = (os.environ.get("BUTTONTASK_MASTER_PASSWORD") or "").strip()
if env:
return env
path = master_password_path()
try:
if path.is_file():
return path.read_text(encoding="utf-8").strip()
except OSError:
pass
return ""