滑块验证支持其他架构
This commit is contained in:
parent
d5eb2e282d
commit
883af478a8
84
README.md
84
README.md
@ -234,20 +234,43 @@ xianyu-auto-reply/
|
||||
# 1. 创建数据目录
|
||||
mkdir -p xianyu-auto-reply
|
||||
|
||||
# 2. 一键启动容器
|
||||
docker run -d -p 8080:8080 --restart always -v $PWD/xianyu-auto-reply/:/app/data/ --name xianyu-auto-reply registry.cn-shanghai.aliyuncs.com/zhinian-software/xianyu-auto-reply:1.0.4
|
||||
# 2. 一键启动容器(自动选择架构)
|
||||
docker run -d \
|
||||
-p 8080:8080 \
|
||||
--restart always \
|
||||
-v $PWD/xianyu-auto-reply/:/app/data/ \
|
||||
--name xianyu-auto-reply \
|
||||
registry.cn-shanghai.aliyuncs.com/zhinian-software/xianyu-auto-reply:1.0.4
|
||||
|
||||
# 3. 访问系统
|
||||
# http://localhost:8080
|
||||
```
|
||||
|
||||
**ARM64服务器** (Oracle Cloud, AWS Graviton, 树莓派等):
|
||||
```bash
|
||||
# Docker会自动选择ARM64镜像,也可以明确指定架构
|
||||
docker run -d \
|
||||
-p 8080:8080 \
|
||||
--restart always \
|
||||
--platform linux/arm64 \
|
||||
-v $PWD/xianyu-auto-reply/:/app/data/ \
|
||||
--name xianyu-auto-reply \
|
||||
registry.cn-shanghai.aliyuncs.com/zhinian-software/xianyu-auto-reply:1.0.4
|
||||
```
|
||||
|
||||
**Windows用户**:
|
||||
```cmd
|
||||
# 创建数据目录
|
||||
mkdir xianyu-auto-reply
|
||||
|
||||
# 启动容器
|
||||
docker run -d -p 8080:8080 -v %cd%/xianyu-auto-reply/:/app/data/ --name xianyu-auto-reply registry.cn-shanghai.aliyuncs.com/zhinian-software/xianyu-auto-reply:1.0.4
|
||||
docker run -d -p 8080:8080 --restart always -v %cd%/xianyu-auto-reply/:/app/data/ --name xianyu-auto-reply registry.cn-shanghai.aliyuncs.com/zhinian-software/xianyu-auto-reply:1.0.4
|
||||
```
|
||||
|
||||
**多架构说明**:
|
||||
- ✅ Docker会自动选择匹配当前系统架构的镜像
|
||||
- ✅ 支持 x86_64 (amd64) 和 ARM64 (aarch64)
|
||||
- ✅ 无需修改命令,一条命令适配所有架构
|
||||
```
|
||||
|
||||
### 方式二:从源码构建部署
|
||||
@ -319,11 +342,26 @@ python Start.py
|
||||
- **Python**: 3.11+
|
||||
- **Node.js**: 16+ (用于JavaScript执行)
|
||||
- **系统**: Windows/Linux/macOS
|
||||
- **架构**: x86_64 (amd64) / ARM64 (aarch64)
|
||||
- **内存**: 建议2GB+
|
||||
- **存储**: 建议10GB+
|
||||
- **Docker**: 20.10+ (Docker部署)
|
||||
- **Docker Compose**: 2.0+ (Docker部署)
|
||||
|
||||
### 🖥️ 支持的架构
|
||||
|
||||
| 架构 | 说明 | 适用场景 |
|
||||
|------|------|---------|
|
||||
| **x86_64 (amd64)** | Intel/AMD处理器 | 传统服务器、PC、虚拟机 |
|
||||
| **ARM64 (aarch64)** | ARM处理器 | ARM服务器、树莓派4+、Apple M系列 |
|
||||
|
||||
**ARM云服务器**:
|
||||
- ✅ Oracle Cloud - Ampere A1 (永久免费4核24GB)
|
||||
- ✅ AWS - Graviton2/3实例
|
||||
- ✅ 阿里云 - 倚天710实例
|
||||
- ✅ 腾讯云 - 星星海ARM实例
|
||||
- ✅ 华为云 - 鲲鹏ARM实例
|
||||
|
||||
### ⚙️ 环境变量配置(可选)
|
||||
|
||||
系统支持通过环境变量进行配置,主要配置项包括:
|
||||
@ -655,29 +693,37 @@ CPU_LIMIT=2.0 # CPU限制(核心数)
|
||||
|
||||
## 🔧 高级功能
|
||||
|
||||
### 二进制模块编译(可选)
|
||||
### 滑块验证模块说明
|
||||
|
||||
为了提升性能和代码安全性,可以将核心模块编译为二进制文件:
|
||||
本项目的滑块验证模块采用**二进制分发**方式:
|
||||
|
||||
```bash
|
||||
# 1. 安装 Nuitka(已在 requirements.txt 中)
|
||||
pip install nuitka ordered-set zstandard
|
||||
**🔐 源代码保护**
|
||||
- ✅ 核心源代码保存在**私有仓库**中(不公开)
|
||||
- ✅ 通过GitHub Actions自动编译所有平台
|
||||
- ✅ 主项目只包含编译后的二进制文件
|
||||
|
||||
# 2. 运行编译脚本
|
||||
python build_binary_module.py
|
||||
**📦 二进制文件**
|
||||
|
||||
# 3. 编译完成后会生成 .pyd (Windows) 或 .so (Linux) 文件
|
||||
# Python 会自动优先加载二进制版本
|
||||
```
|
||||
项目已包含预编译的二进制模块(`utils/` 目录):
|
||||
- Windows: `xianyu_slider_stealth.cp3XX-win_amd64.pyd`
|
||||
- Linux: `xianyu_slider_stealth.cpython-3XX-x86_64-linux-gnu.so`
|
||||
- macOS: `xianyu_slider_stealth.cpython-3XX-darwin.so`
|
||||
- 类型提示: `xianyu_slider_stealth.pyi`
|
||||
|
||||
**Docker 部署自动编译**:
|
||||
- Docker 构建时会自动检测并编译相关模块
|
||||
- 无需手动操作,构建完成即可使用
|
||||
**🔄 更新二进制模块**
|
||||
|
||||
**编译优势**:
|
||||
- ⚡ 性能提升:编译后的代码执行效率更高
|
||||
如需更新滑块验证模块:
|
||||
1. 从私有仓库的 Releases 页面下载最新版本
|
||||
2. 解压并复制到 `utils/` 目录
|
||||
3. 提交更新到主项目
|
||||
|
||||
**⚡ 模块优势**
|
||||
- 🚀 高性能:编译后执行效率更高
|
||||
- 🔒 代码保护:二进制文件难以反编译
|
||||
- 🛡️ 授权管理:集成授权期限验证
|
||||
- 🛡️ 授权管理:内置授权期限验证
|
||||
- 🌍 多平台:支持Windows/Linux/macOS
|
||||
|
||||
**注意**: 滑块验证模块源代码不在此项目中,如需修改请联系维护者。
|
||||
|
||||
### AI回复配置
|
||||
1. 在用户设置中配置OpenAI API密钥
|
||||
|
||||
@ -1,155 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
把 utils/xianyu_slider_stealth.py 编译为可直接 import 的二进制扩展模块(.pyd/.so)
|
||||
- 使用 Nuitka 的 --module 模式
|
||||
- 输出文件放到 utils/ 目录,名称为 xianyu_slider_stealth.<abi>.pyd/.so
|
||||
- 这样 Python 将优先加载二进制扩展而不是同名 .py
|
||||
"""
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
SRC = Path("utils/xianyu_slider_stealth.py")
|
||||
OUT_DIR = Path("utils")
|
||||
|
||||
|
||||
def ensure_nuitka():
|
||||
try:
|
||||
import nuitka # noqa: F401
|
||||
print("✓ Nuitka 已安装")
|
||||
return True
|
||||
except Exception:
|
||||
print("✗ 未检测到 Nuitka。请先允许我安装: pip install nuitka ordered-set zstandard")
|
||||
return False
|
||||
|
||||
|
||||
def clean_old_files():
|
||||
"""清理旧的编译产物"""
|
||||
import os
|
||||
import glob
|
||||
|
||||
patterns = [
|
||||
"utils/xianyu_slider_stealth.*.pyd",
|
||||
"utils/xianyu_slider_stealth.*.so",
|
||||
"utils/xianyu_slider_stealth.build",
|
||||
"utils/xianyu_slider_stealth.dist"
|
||||
]
|
||||
|
||||
for pattern in patterns:
|
||||
for file_path in glob.glob(pattern):
|
||||
try:
|
||||
if os.path.isfile(file_path):
|
||||
os.remove(file_path)
|
||||
print(f"✓ 已删除旧文件: {file_path}")
|
||||
elif os.path.isdir(file_path):
|
||||
import shutil
|
||||
shutil.rmtree(file_path)
|
||||
print(f"✓ 已删除旧目录: {file_path}")
|
||||
except Exception as e:
|
||||
print(f"⚠️ 无法删除 {file_path}: {e}")
|
||||
|
||||
|
||||
def check_permissions():
|
||||
"""检查目录权限"""
|
||||
try:
|
||||
test_file = OUT_DIR / "test_write.tmp"
|
||||
test_file.write_text("test")
|
||||
test_file.unlink()
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"✗ 目录权限检查失败: {e}")
|
||||
print("💡 请尝试以管理员身份运行此脚本")
|
||||
return False
|
||||
|
||||
|
||||
def build():
|
||||
OUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# 检查权限
|
||||
if not check_permissions():
|
||||
return 1
|
||||
|
||||
# 清理旧文件
|
||||
print("🧹 清理旧的编译产物...")
|
||||
clean_old_files()
|
||||
|
||||
cmd = [
|
||||
sys.executable, "-m", "nuitka",
|
||||
"--module",
|
||||
"--output-dir=%s" % str(OUT_DIR),
|
||||
"--remove-output",
|
||||
"--assume-yes-for-downloads",
|
||||
"--show-progress",
|
||||
"--python-flag=no_docstrings",
|
||||
"--python-flag=no_warnings",
|
||||
"--enable-plugin=anti-bloat",
|
||||
# 降低内存占用,避免容器内 OOM
|
||||
"--lto=no",
|
||||
"--jobs=1",
|
||||
str(SRC)
|
||||
]
|
||||
|
||||
print("执行编译命令:\n ", " ".join(cmd))
|
||||
try:
|
||||
result = subprocess.run(cmd, text=True, timeout=300) # 5分钟超时
|
||||
if result.returncode != 0:
|
||||
print("✗ 编译失败 (Nuitka 返回非零)")
|
||||
print("💡 可能的解决方案:")
|
||||
print(" 1. 以管理员身份运行此脚本")
|
||||
print(" 2. 关闭杀毒软件的实时保护")
|
||||
print(" 3. 检查是否有其他Python进程在运行")
|
||||
return 1
|
||||
except subprocess.TimeoutExpired:
|
||||
print("✗ 编译超时 (5分钟)")
|
||||
return 1
|
||||
except Exception as e:
|
||||
print(f"✗ 编译过程中发生错误: {e}")
|
||||
return 1
|
||||
|
||||
# 列出 utils 目录下的产物
|
||||
built = sorted(p for p in OUT_DIR.glob("xianyu_slider_stealth.*.pyd"))
|
||||
if not built:
|
||||
built = sorted(p for p in OUT_DIR.glob("xianyu_slider_stealth.*.so"))
|
||||
if not built:
|
||||
print("✗ 未找到编译产物。请检查输出日志。")
|
||||
return 2
|
||||
|
||||
print("\n✓ 编译产物:")
|
||||
for p in built:
|
||||
print(" -", p)
|
||||
return 0
|
||||
|
||||
|
||||
def main():
|
||||
print("🔨 开始编译 xianyu_slider_stealth 模块...")
|
||||
print("📁 项目目录:", Path.cwd())
|
||||
|
||||
if not SRC.exists():
|
||||
print(f"✗ 源文件不存在: {SRC}")
|
||||
return 1
|
||||
|
||||
print(f"📄 源文件: {SRC}")
|
||||
print(f"📂 输出目录: {OUT_DIR}")
|
||||
|
||||
if not ensure_nuitka():
|
||||
return 2
|
||||
|
||||
# 检查是否以管理员身份运行(Windows)
|
||||
import os
|
||||
if os.name == 'nt': # Windows
|
||||
try:
|
||||
import ctypes
|
||||
is_admin = ctypes.windll.shell32.IsUserAnAdmin()
|
||||
if not is_admin:
|
||||
print("⚠️ 建议以管理员身份运行此脚本以避免权限问题")
|
||||
except:
|
||||
pass
|
||||
|
||||
return build()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
|
||||
BIN
utils/xianyu_slider_stealth.cp311-win_amd64.pyd
Normal file
BIN
utils/xianyu_slider_stealth.cp311-win_amd64.pyd
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
utils/xianyu_slider_stealth.cpython-311-darwin.so
Normal file
BIN
utils/xianyu_slider_stealth.cpython-311-darwin.so
Normal file
Binary file not shown.
BIN
utils/xianyu_slider_stealth.cpython-311-i386-linux-gnu-386.so
Normal file
BIN
utils/xianyu_slider_stealth.cpython-311-i386-linux-gnu-386.so
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
utils/xianyu_slider_stealth.cpython-312-darwin.so
Normal file
BIN
utils/xianyu_slider_stealth.cpython-312-darwin.so
Normal file
Binary file not shown.
BIN
utils/xianyu_slider_stealth.cpython-312-i386-linux-gnu-386.so
Normal file
BIN
utils/xianyu_slider_stealth.cpython-312-i386-linux-gnu-386.so
Normal file
Binary file not shown.
Binary file not shown.
BIN
utils/xianyu_slider_stealth.cpython-312-x86_64-linux-gnu.so
Normal file
BIN
utils/xianyu_slider_stealth.cpython-312-x86_64-linux-gnu.so
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user