Создание временной лицензии
Some checks failed
CI / backend (push) Failing after 8s
CI / frontend (push) Failing after 3s

This commit is contained in:
2025-12-01 11:47:45 +00:00
parent adbf40240c
commit 667d3c205a

View File

@@ -4,11 +4,13 @@ from pathlib import Path
from ..utils.encoding import variant_base64_encode
from ..utils.crypto import encrypt_bytes
class LicenseType:
Professional: int = 1
Educational: int = 3
Personal: int = 4
def generate_license_file(
user_name: str,
version: str,
@@ -26,11 +28,13 @@ def generate_license_file(
minor_version: int = int(minor_str)
except Exception as e:
raise ValueError(f"Неверный формат версии: {version}") from e
# Формирование строки лицензии (исправлено: убрали лишний #, интегрировали цифры в один блок)
# Формирование строки лицензии
license_str: str = (
f"{lic_type}#{user_name}|{major_version}{minor_version}"
f"#{count}#{major_version}3{minor_version}6{minor_version}#0#0#0#"
)
# Шифрование и кодирование
encrypted: bytes = encrypt_bytes(0x0787, license_str.encode("utf-8"))
encoded: str = variant_base64_encode(encrypted).decode("ascii")
@@ -40,4 +44,5 @@ def generate_license_file(
filepath = Path(temp_dir.name) / "Custom.mxtpro"
with ZipFile(filepath, "w") as zf:
zf.writestr("Pro.key", encoded)
return str(filepath), temp_dir