diff --git a/cli_launcher.py b/cli_launcher.py index d2f05cd2..a89b4689 100755 --- a/cli_launcher.py +++ b/cli_launcher.py @@ -1317,7 +1317,39 @@ def _ensure_web_image(src_dir: str, tag: str, force_pull: bool = False) -> bool: return _build_web_image(src_dir, tag) +def _ensure_rpc_module() -> bool: + try: + import core.rpc # noqa: F401 + return True + except ImportError: + pass + + core_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "core") + init_path = os.path.join(core_dir, "__init__.py") + rpc_path = os.path.join(core_dir, "rpc.py") + + url = "https://raw.githubusercontent.com/Vladless/Solo_bot/dev/core/rpc.py" + try: + req = Request(url) + with urlopen(req, timeout=15) as resp: + data = resp.read() + except Exception: + return False + + try: + os.makedirs(core_dir, exist_ok=True) + if not os.path.exists(init_path): + with open(init_path, "w") as f: + f.write("") + with open(rpc_path, "wb") as f: + f.write(data) + return True + except Exception: + return False + + def _check_feature(name: str) -> bool: + _ensure_rpc_module() try: from core.rpc import check_feature @@ -1329,12 +1361,13 @@ def _check_feature(name: str) -> bool: def _verify_license_for_web(code: str, password: str) -> tuple[bool, str]: + _ensure_rpc_module() try: from core.rpc import verify_web_license return verify_web_license(code, password) except Exception: - return False, "" + return False, "Не удалось загрузить модуль проверки лицензии" def _ensure_docker(): diff --git a/utils/versioning.py b/utils/versioning.py index 12d4a9dd..a3385c2c 100644 --- a/utils/versioning.py +++ b/utils/versioning.py @@ -92,4 +92,4 @@ def get_git_commit_number() -> str: def get_version() -> str: - return f"v.6-b1904261111 {get_git_commit_number()}" + return f"v.6-b2004260306 {get_git_commit_number()}"