This commit is contained in:
2026-01-14 01:33:25 -08:00
parent 226367a6ea
commit e27e13b64c
10 changed files with 760 additions and 63 deletions

View File

@@ -48,6 +48,13 @@ _PROVIDER_DEPENDENCIES: Dict[str, List[Tuple[str, str]]] = {
"soulseek": [("aioslsk", "aioslsk>=1.6.0")],
}
# Dependencies required when ZeroTier features are configured (auto-install when enabled)
_ZEROTIER_DEPENDENCIES: List[Tuple[str, str]] = [
("flask", "flask>=2.3.0"),
("flask_cors", "flask-cors>=3.0.1"),
("werkzeug", "werkzeug>=2.3.0"),
]
def florencevision_missing_modules() -> List[str]:
return [
@@ -144,5 +151,29 @@ def maybe_auto_install_configured_tools(config: Dict[str, Any]) -> None:
label = f"{provider_name.title()} provider"
_install_requirements(label, requirements)
# ZeroTier: if a zerotier section is present OR a zerotier store is configured,
# optionally auto-install Flask-based remote server dependencies so the
# `remote_storage_server.py` and CLI helper will run out-of-the-box.
try:
zerotier_cfg = (config or {}).get("zerotier")
store_cfg = (config or {}).get("store") if isinstance(config, dict) else {}
store_has_zerotier = isinstance(store_cfg, dict) and bool(store_cfg.get("zerotier"))
if (isinstance(zerotier_cfg, dict) and zerotier_cfg) or store_has_zerotier:
auto_install = True
if isinstance(zerotier_cfg, dict) and "auto_install" in zerotier_cfg:
auto_install = _as_bool(zerotier_cfg.get("auto_install"), True)
if auto_install:
missing = [
requirement
for import_name, requirement in _ZEROTIER_DEPENDENCIES
if not _try_import(import_name)
]
if missing:
_install_requirements("ZeroTier", missing)
except Exception:
# Don't let optional-dep logic raise at startup
pass
__all__ = ["maybe_auto_install_configured_tools", "florencevision_missing_modules"]