commit 89788e68e6b7cb3b5ff7d329eaee3a979c752858 Author: moliclay <3305134074@qq.com> Date: Sat Sep 19 14:43:19 2026 +0800 上传文件至「/」 diff --git a/main.py b/main.py new file mode 100644 index 0000000..86e18e8 --- /dev/null +++ b/main.py @@ -0,0 +1,33 @@ +import sys +import os +from src.security import validate_license +LICENSE_PATH = os.path.expanduser("~/.app_license") + + +def check_license(): + """强制许可证验证""" + if not os.path.exists(LICENSE_PATH): + print("错误:未找到许可证文件") + return False + + with open(LICENSE_PATH, 'r') as f: + license_code = f.read().strip() + + valid, message = validate_license(license_code) + if not valid: + print(f"授权失败: {message}") + return False + return True + + +def main(): + print("=== 软件启动验证 ===") + if not check_license(): + sys.exit(1) + + print("授权验证成功!欢迎使用本软件") + # 此处添加主程序逻辑 + + +if __name__ == "__main__": + main() \ No newline at end of file