full compile system build. 2. beam_spliter, MMI and spiral classes added
Build and Release mxPIC Wheels / Build on ubuntu-latest (release) Failing after 7m8s
Build and Release mxPIC Wheels / Build on windows-latest (release) Has been cancelled
Build and Release mxPIC Wheels / Publish to GitHub Releases (release) Has been cancelled

This commit is contained in:
2026-05-07 17:10:00 +08:00
parent dda69d5b84
commit d7c19ed782
115 changed files with 5448 additions and 509 deletions
+17 -11
View File
@@ -7,12 +7,16 @@ import os
from datetime import datetime
from pathlib import Path
# This MUST match the key in your generator exactly.
# Because this file is compiled via Cython to a .so/.pyd file,
# This MUST match the key in your generator exactly.
# --- SECURITY CONSTANTS ---
_SECRET_KEY = b"mxPIC_Super_Secret_Master_Key_2026!"
_ENV_VAR_NAME = "LIC_MXPIC_OPTIHK_DIR"
# --- THE DEVELOPER WHITELIST ---
# Add your team's MAC addresses here. Use uppercase.
_DEVELOPER_MACS = {
"D4:54:8B:F1:46:49", # Qin Yue's Workstation
}
def _get_local_mac() -> str:
"""Retrieves the physical MAC address of the current machine."""
mac = uuid.getnode()
@@ -24,18 +28,22 @@ def _locate_license_file() -> Path:
if env_path_str:
path_obj = Path(env_path_str)
# If the user pointed to a directory, append the default filename
if path_obj.is_dir():
return path_obj / "mxpic.lic"
# Otherwise, assume they pointed directly to the file itself
return path_obj
else:
# Fallback: Look in the current working directory where the script is run
return Path("mxpic.lic")
def verify_license() -> None:
"""Verifies the license file. Halts execution if invalid."""
# 1. IMMEDIATE BYPASS: Check the Developer Whitelist first
local_mac = _get_local_mac()
if local_mac in _DEVELOPER_MACS:
# Silently approve and exit the verification function
return
# 2. STANDARD VERIFICATION: For normal customers
lic_file = _locate_license_file()
if not lic_file.exists():
@@ -48,21 +56,19 @@ def verify_license() -> None:
with open(lic_file, "r", encoding="utf-8") as f:
lic = json.load(f)
local_mac = _get_local_mac()
# 1. Check MAC match
# Check MAC match
if lic["mac_address"] != local_mac:
print(f"\n❌ mxPIC FATAL ERROR: License registered to different machine.")
print(f"Registered: {lic['mac_address']} | Local: {local_mac}")
sys.exit(1)
# 2. Check Expiration
# Check Expiration
exp_date = datetime.strptime(lic["expiration"], "%Y-%m-%d")
if datetime.now() > exp_date:
print(f"\n❌ mxPIC FATAL ERROR: License expired on {lic['expiration']}.")
sys.exit(1)
# 3. Verify Signature
# Verify Signature
message = f"{lic['mac_address']}|{lic['expiration']}".encode('utf-8')
expected_sig = hmac.new(_SECRET_KEY, message, hashlib.sha256).hexdigest()