feat(license): 支持授权文件导入并固定生产公钥指纹校验
This commit is contained in:
@@ -28,7 +28,26 @@ APP = ROOT / "CostReview" / "app"
|
||||
|
||||
# 与开发环境同大版本的 embeddable 包(多备几个补丁号,第一个能下载的胜出)
|
||||
EMBED_VERSIONS = ["3.13.9", "3.13.11", "3.13.12", "3.13.14", "3.13.5", "3.13.2"]
|
||||
DEPS = ["pywebview==6.2.1", "openpyxl==3.1.5", "xlrd==2.0.1"]
|
||||
|
||||
|
||||
def _deps_from_requirements():
|
||||
"""包内依赖唯一来源 = 仓库根 requirements.txt(决策 43)。
|
||||
|
||||
曾因这里另维护一份硬编码清单漏掉 cryptography/httpx,导致交付包顶层 import
|
||||
api_server 即崩(授权门禁依赖 cryptography)。单源化后 requirements.txt 缺失
|
||||
或为空直接构建失败,宁可不出包也不出残包。
|
||||
"""
|
||||
req = ROOT / "requirements.txt"
|
||||
if not req.is_file():
|
||||
raise RuntimeError("找不到 %s——包内依赖清单只有这一份来源" % req)
|
||||
deps = [ln.strip() for ln in req.read_text(encoding="utf-8").splitlines()
|
||||
if ln.strip() and not ln.strip().startswith("#")]
|
||||
if not deps:
|
||||
raise RuntimeError("requirements.txt 为空,拒绝构建")
|
||||
return deps
|
||||
|
||||
|
||||
DEPS = _deps_from_requirements()
|
||||
|
||||
BAT_GUI = (
|
||||
"@echo off\r\n"
|
||||
@@ -133,8 +152,7 @@ def write_license_build_config(app_target):
|
||||
"ENFORCE = True\n"
|
||||
"PRODUCT_ID = %r\n"
|
||||
"SELFHEAL_SECONDS = 300\n"
|
||||
"PINNED_KEYS = %s\n" % (RELEASE_API_BASE, RELEASE_PRODUCT_ID,
|
||||
json.dumps(keys, ensure_ascii=False, indent=4)),
|
||||
"PINNED_KEYS = %r\n" % (RELEASE_API_BASE, RELEASE_PRODUCT_ID, keys),
|
||||
encoding="utf-8")
|
||||
log("授权信任根已烧入 → server/license_client/license_build_config.py(公钥 %d 把)" % len(keys))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user