feat(subscription): add membership access preflight
This commit is contained in:
@@ -122,6 +122,9 @@ DEFAULT_CONFIG = {
|
||||
"ratio": "1:1",
|
||||
},
|
||||
},
|
||||
"subscription": {
|
||||
"last_notice_id": "",
|
||||
},
|
||||
}
|
||||
|
||||
DEFAULT_AI_MODELS_CONFIG = {
|
||||
@@ -706,6 +709,25 @@ def cdp_ready_timeout(config=None) -> int:
|
||||
return int(_config_or_load(config).get("cdp_ready_timeout", 60))
|
||||
|
||||
|
||||
def subscription_notice_id(config=None) -> str:
|
||||
section = _config_or_load(config).get("subscription", {})
|
||||
if not isinstance(section, dict):
|
||||
return ""
|
||||
return str(section.get("last_notice_id") or "").strip()
|
||||
|
||||
|
||||
def save_subscription_notice_id(notice_id, path=CONFIG_PATH) -> dict:
|
||||
"""Persist the last server notification version without storing credentials."""
|
||||
|
||||
config = load_config(path)
|
||||
section = config.get("subscription", {})
|
||||
if not isinstance(section, dict):
|
||||
section = {}
|
||||
section["last_notice_id"] = str(notice_id or "").strip()
|
||||
config["subscription"] = section
|
||||
return save_config(config, path=path)
|
||||
|
||||
|
||||
def ai_config(config=None) -> dict:
|
||||
return copy.deepcopy(_config_or_load(config).get("ai", DEFAULT_CONFIG["ai"]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user