Skip to content

feat: 内置 Web 管理面板并移除闭源授权组件 - #1

Merged
NovolineGast merged 3 commits into
mainfrom
trae/agent-1CnGDA
Aug 20, 2026
Merged

feat: 内置 Web 管理面板并移除闭源授权组件#1
NovolineGast merged 3 commits into
mainfrom
trae/agent-1CnGDA

Conversation

@NovolineGast

Copy link
Copy Markdown
Owner

🎯 Changes

1. Web 管理面板集成

  • 将 React 前端与 JWT REST API 直接内置到 Go 和 Python 授权服务器中。
  • 授权服务器现在在同一端口(13337)同时提供原生授权协议和 Web 管理界面。
  • 更新 DEPLOYMENT.mdadmin-web/README.md,说明部署和访问方式。
  • docker-compose.ymlDockerfile 更新,支持前端多阶段构建并嵌入服务器。
  • Go 和 Python 服务器新增 JWT 认证、CORS 中间件、Web 面板 REST API(如 /api/init, /api/login, /api/dashboard/stats 等)。
  • 密钥生成格式更新为 PREFIX-XXXX-XXXX-XXXX

2. 移除闭源授权组件与开放客户端实现

  • 移除 Authorization.dllVMProtect SDK 二进制及工程文件等闭源商业组件。
  • native_jvm.cpp 中实现开放的授权客户端,直接通过 POST /login 验证密钥。
  • 授权客户端支持从环境变量 YCP_LICENSE_KEYlicense.key 文件或交互式输入获取密钥。
  • obfuscator 模块中移除对闭源组件的依赖和引用,包括头文件、链接库和嵌入逻辑。
  • obfuscator/src/main/java/com/yumegod/obfuscator/YumeCloudProtection.java 中授权 URL 可配置。

3. VMProtect 加壳降级为可选组件

  • vmp.exe.vmp 工程文件缺失时,自动跳过 VMProtect 加壳,直接打包未加壳的原生库。
  • obfuscator/src/main/resources/sources/VMProtectSDK.h 替换为开源 no-op 桩实现,并提供说明。
  • 链接库调整,仅当用户提供 VMProtectSDK64.lib 时才链接 VMProtect SDK。

4. 功能增强与优化

  • 密钥表新增 login_count 列,用于统计客户端登录次数,Reset 命令可清零。
  • 数据库路径支持通过 YCP_DB_PATH 环境变量配置。
  • 移除 obfuscator 中“愚蠢用户”检测逻辑。
  • 新增 Util.java 中的 copyResourceIfExists()escapeString() 方法。

💡 Technical Highlights

  • 一体化部署: 将 Web 管理面板直接内置到授权服务器二进制中,简化部署流程,实现单一端口服务。
  • 开放性与可配置性: 移除闭源依赖,采用开放的授权客户端实现,并提供授权服务器地址的可配置性,增强系统的透明度和灵活性。
  • 渐进式保护: VMProtect 加壳降级为可选组件,允许用户根据需求选择是否启用,降低了对特定商业工具的强制依赖。
  • 多阶段 Docker 构建: 利用 Docker 多阶段构建优化镜像大小和构建效率,将前端构建与后端编译集成到同一流程中。
  • Go/Python Web 框架集成: 在 Go (Gin) 和 Python (Flask) 中实现 JWT 认证、RESTful API 和 SPA 静态文件服务,展示了跨语言 Web 开发的通用模式。

NovolineGast and others added 3 commits August 20, 2026 16:03
Co-authored-by: traeagent <traeagent@users.noreply.github.com>
Co-authored-by: traeagent <traeagent@users.noreply.github.com>
Co-authored-by: traeagent <traeagent@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 20, 2026 18:29
@NovolineGast
NovolineGast merged commit 61ae549 into main Aug 20, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

此 PR 将 Web 管理面板(React 构建产物)直接内置到 Go/Gin 与 Python/Flask 授权服务器中,并同步引入 JWT + REST API 以支持同端口(13337)同时提供授权协议与 Web 管理界面;同时移除闭源授权组件与 VMProtect 相关工程文件,将加壳能力降级为“可选商业组件”,默认开源构建可正常工作。

Changes:

  • server_goserver_python 中新增/集成 Web 面板静态资源与 REST API(JWT、统计、密钥管理等),并支持 YCP_DB_PATH 配置数据库路径、增加 login_count 统计字段。
  • obfuscator 移除闭源 Authorization.dll 依赖,提供开放授权客户端实现(POST /login),并将 VMProtect SDK/工程文件调整为缺失时自动跳过的可选流程。
  • 更新 Docker 多阶段构建、docker-compose、部署文档与前端开发代理配置,以配套一体化部署方式。

Reviewed changes

Copilot reviewed 28 out of 41 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
server_python/web/vault.svg 新增 Web 面板图标资源
server_python/web/index.html 新增 Web 面板入口 HTML(引用构建产物)
server_python/web/assets/index-mKCh-jFT.css 新增前端构建产物 CSS
server_python/Dockerfile 多阶段构建:编译前端并拷贝到 Python 镜像
server_python/app.py Flask:JWT/CORS、REST API、SPA 静态文件回退、DB 路径与登录统计
server_go/web/vault.svg 新增 Web 面板图标资源
server_go/web/index.html 新增 Web 面板入口 HTML(引用构建产物)
server_go/web/assets/index-mKCh-jFT.css 新增前端构建产物 CSS
server_go/main.go Gin:embed 前端、JWT/CORS、REST API、DB 路径与登录统计、SPA NoRoute
server_go/go.mod 补充 Gin 及其间接依赖声明
server_go/go.sum 新增/更新 Go 依赖校验信息
server_go/Dockerfile 多阶段构建:编译前端并嵌入 Go 二进制
obfuscator/src/main/resources/sources/YumeCloud_NativeLibrary.vmp 删除:VMProtect 工程文件(商业组件)
obfuscator/src/main/resources/sources/YumeCloud_NativeLibrary_NoAuth.vmp 删除:VMProtect 工程文件(商业组件)
obfuscator/src/main/resources/sources/VMProtectSDK.h 替换为开源 no-op 兼容桩头文件
obfuscator/src/main/resources/sources/native_jvm.hpp 调整接口:使用开放授权客户端函数签名
obfuscator/src/main/resources/sources/native_jvm.cpp 新增开放授权客户端(HTTP POST /login、多来源密钥、交互输入)
obfuscator/src/main/resources/sources/native_jvm_output.cpp 移除闭源 DLL 字节与注入逻辑占位
obfuscator/src/main/resources/sources/Authorization.h 删除:闭源授权头文件
obfuscator/src/main/resources/default-config.json 新增 native.auth_url 默认配置项
obfuscator/src/main/java/com/yumegod/obfuscator/YumeCloudProtection.java 移除“愚蠢用户”检测;授权 URL 可配置;VMProtect 资源复制改为可选
obfuscator/src/main/java/com/yumegod/obfuscator/utils/Util.java 新增 copyResourceIfExists()escapeString()
obfuscator/src/main/java/com/yumegod/obfuscator/jobf/transformer/Transformer.java 移除未使用/不再需要的 transformer 引用
obfuscator/src/main/java/com/yumegod/obfuscator/j2c/tasks/Protect.java VMProtect 缺失时跳过加壳并直接打包原生库
obfuscator/src/main/java/com/yumegod/obfuscator/j2c/tasks/Compile.java 移除闭源链接;新增 WinSock2;VMProtect lib 按存在性链接
obfuscator/src/main/java/com/yumegod/obfuscator/j2c/source/MainSourceBuilder.java 生成的 JNI 入口改为调用开放授权客户端;移除闭源 DLL 嵌入
obfuscator/src/main/java/com/yumegod/obfuscator/j2c/source/ClassSourceBuilder.java 移除 Authorization.h include,保留 VMProtectSDK.h
docker-compose.yml 构建上下文改为仓库根;分别指定 Go/Python Dockerfile
DEPLOYMENT.md 更新结构说明与“Web 面板已内置”的部署访问指引
admin-web/README.md 更新为“前端源码保留 + 构建产物嵌入服务器”的新定位说明
admin-web/frontend/vite.config.js 开发代理 /api 目标端口改为 13337

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread server_python/app.py
Comment on lines +86 to +93
c.execute("SELECT value FROM settings WHERE name='jwt_secret'")
row = c.fetchone()
if row is None:
secret = secrets.token_hex(32)
c.execute("INSERT INTO settings (name, value) VALUES ('jwt_secret', ?)", (secret,))
conn.commit()
else:
secret = row[0]
Comment thread server_python/app.py
Comment on lines +315 to +317
auth_header = request.headers.get('Authorization', '')
token = auth_header.replace('Bearer ', '')
app_name = validate_jwt(token)
Comment thread server_python/app.py
Comment on lines 203 to 207
for _ in range(amount):
key, expire_date = generate_key(app_name, days)
c.execute("INSERT INTO keys (key_id, app_name, expire_date, created_at) VALUES (?, ?, ?, ?)",
(key, app_name, expire_date, datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
(key, app_name, expire_date, datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
keys.append(key)
Comment thread server_go/main.go
Comment on lines +415 to +420
var exists int
err := db.QueryRow("SELECT 1 FROM applications WHERE app_name=?", req.AppName).Scan(&exists)
if err == nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Admin already exists for app: " + req.AppName})
return
}
Comment thread server_go/main.go
Comment on lines 259 to +263
var keys []string
for i := 0; i < amount; i++ {
keyID, expireDate := generateKey(appName, days)
_, err := db.Exec("INSERT INTO keys (key_id, app_name, expire_date, created_at) VALUES (?, ?, ?, ?)",
keyID, appName, expireDate, time.Now().Format("2006-01-02 15:04:05"))
keyID, appName, expireDate, time.Now().Format(dbTimeLayout))
Comment on lines 42 to 45
if (YumeCloudProtection.auth) {
includes.append("#include \"Authorization.h\"");
}
StringBuilder dllBytes = new StringBuilder();
if (YumeCloudProtection.auth) {
dllBytes.append("unsigned char dllBytes[] = {");
InputStream dll = MainSourceBuilder.class.getResourceAsStream("/sources/Authorization.dll");
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = dll.read(buffer)) != -1) {
for (int j = 0; j < bytesRead; j++) {
dllBytes.append((int) buffer[j] & 0xFF).append(",");
}
}
dllBytes.append("};").append("\n");
dllBytes.append("size_t dllSize = sizeof(dllBytes);").append("\n");
authorization = " if (!native_jvm::utils::auth(VMProtectDecryptStringA(\"" + YumeCloudProtection.applicationName
+ "\"), VMProtectDecryptStringA(\"" + YumeCloudProtection.authorizationURL + "login\"))) return JNI_ERR;\n";
}
request += "Connection: close\r\n\r\n";
request += body;

ok = send(fd, request.c_str(), (int) request.size(), 0) == (int) request.size();
Comment on lines +266 to +268
put(&it, sizeof(it));
put_word(class_atom);
put_wstr(title);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants