mirror of
https://gitcode.com/JianFeeeee/ModelRouter.git
synced 2026-11-07 09:47:23 +00:00
## ① 桌面版此前**完全没有插件系统**(渠道页根本不存在) GUI 内嵌内核的 config.yaml 由 main.js 生成,唯独漏了 `plugin_dir` —— 而内核刻意不给它默认值(运维显式开启)。后果:桌面版 `plugin_dir: ""`, `/api/plugins` 返回空列表,channels 插件(多平台账号登录、凭据保管、自动 领取)在桌面端**完全不可见**。实测复现:同一份配置去掉 plugin_dir 就是 `plugins: []`,加上就有 billing/channels/quota/usage 四个。 修法: - 新 profile 直接写 `plugin_dir: <profile>/plugins`; - **老 profile 回填**(用户已有 config.yaml,不写就只有老用户永远没有插件)—— 新增 `ensurePluginDirConfigured()`,只在缺少该键时追加,其余内容不动; - 插件树由内核 SeedBundled 播种(按文件补齐,用户改过的副本优先保留)。 ## ② 升级后渠道修复**下发不到桌面用户** 内核播种规则是「文件缺失才写」,所以桌面用户升级 GUI 后 `channels.lua` 仍是旧版 —— 我们发的渠道修复对桌面用户静默失效。桌面版必须自己处理: 按 app 版本打戳(`.plugin-seed-version`),版本变化时删掉 4 个内置插件文件 让新内核重新播种,旧副本留 `.prev-<旧版本>` 可人工恢复;用户自建插件不碰。 逻辑抽到 `cmd/gui/plugin-sync.js`(无 Electron 依赖),配 6 条 node 单测。 ## ③ 登录一律拉起默认浏览器(三条路径都覆盖) 桌面版的内容区是加载内核 WebUI 的 iframe,渠道登录链接是 `target=_blank`。 此前只处理了 `setWindowOpenHandler`,另两条路径仍会把 Electron 窗口带到 第三方页面。现在三条路径统一外抛: 1. `window.open` / target=_blank → setWindowOpenHandler 2. 顶层同标签跳转 → will-navigate 3. iframe 内导航 → will-frame-navigate **loopback 例外必须保留**:channels 的服务端浏览器(noVNC)就在 `127.0.0.1:<port>` 的 iframe 里,拦掉它会让 VNC 登录失效。 实测(打包后的 GUI + Xvfb + CDP 驱动真实窗口): [gui] open in default browser: https://example.com/mr-windowopen-probe [gui] open in default browser: https://example.com/mr-navigate-probe [gui] open in default browser: https://example.com/mr-frame-probe [gui] open in default browser: https://xiaohuanxiong.com/login?code=…(真实商汤登录链接) 顶层 URL 保持在内核页面(跳转被拦下),loopback iframe 正常加载。 ## ④ 顺手 - GUI 版本号 1.9.7 → 2.0.42(与内核同版本发版;package-lock 里还是 1.9.3, 一并同步); - `make gui-test` 跑桌面壳单测。 验证:打包后的 GUI 启动即 `/api/plugins` 列出 channels(ui.page=channels), 插件目录播种 4 个内置插件;外链四类实测均走默认浏览器。
93 lines
2.3 KiB
JSON
93 lines
2.3 KiB
JSON
{
|
|
"name": "modelrouter-gui",
|
|
"version": "2.0.42",
|
|
"description": "ModelRouter Desktop — embedded ModelRouter core with tray",
|
|
"author": "ModelRouter",
|
|
"main": "main.js",
|
|
"license": "Proprietary",
|
|
"scripts": {
|
|
"start": "electron . --no-sandbox",
|
|
"dev": "electron . --no-sandbox --dev",
|
|
"core:linux": "node scripts/prepare-core.js linux",
|
|
"core:win": "node scripts/prepare-core.js win",
|
|
"dist:linux": "npm run core:linux && electron-builder --linux deb rpm AppImage",
|
|
"dist:debian": "npm run core:linux && electron-builder --linux deb",
|
|
"dist:win": "npm run core:win && electron-builder --win nsis",
|
|
"dist:dir": "npm run core:linux && electron-builder --dir"
|
|
},
|
|
"devDependencies": {
|
|
"electron": "^33.0.0",
|
|
"electron-builder": "^26.15.3"
|
|
},
|
|
"build": {
|
|
"appId": "com.modelrouter.gui",
|
|
"productName": "ModelRouter",
|
|
"linux": {
|
|
"target": [
|
|
"deb",
|
|
"rpm",
|
|
"AppImage"
|
|
],
|
|
"category": "Network",
|
|
"icon": "build/icon.png",
|
|
"maintainer": "ModelRouter",
|
|
"synopsis": "ModelRouter Desktop",
|
|
"desktop": {
|
|
"entry": {
|
|
"StartupWMClass": "modelrouter-gui"
|
|
}
|
|
},
|
|
"extraResources": [
|
|
{
|
|
"from": "bin/llmsproxy",
|
|
"to": "bin/llmsproxy"
|
|
},
|
|
{
|
|
"from": "build/icon.png",
|
|
"to": "build/icon.png"
|
|
}
|
|
]
|
|
},
|
|
"directories": {
|
|
"output": "../build/gui-dist"
|
|
},
|
|
"mac": {
|
|
"target": "dmg",
|
|
"icon": "build/icon.png",
|
|
"extraResources": [
|
|
{
|
|
"from": "build/icon.png",
|
|
"to": "build/icon.png"
|
|
}
|
|
]
|
|
},
|
|
"win": {
|
|
"target": "nsis",
|
|
"icon": "build/icon.ico",
|
|
"extraResources": [
|
|
{
|
|
"from": "bin/llmsproxy.exe",
|
|
"to": "bin/llmsproxy.exe"
|
|
},
|
|
{
|
|
"from": "bin/lua51.dll",
|
|
"to": "bin/lua51.dll"
|
|
},
|
|
{
|
|
"from": "build/icon.png",
|
|
"to": "build/icon.png"
|
|
}
|
|
]
|
|
},
|
|
"files": [
|
|
"main.js",
|
|
"plugin-sync.js",
|
|
"preload.js",
|
|
"renderer/**/*",
|
|
"build/**/*",
|
|
"!node_modules/**/*"
|
|
],
|
|
"asar": true
|
|
},
|
|
"homepage": "https://gitcode.com/JianFeeeee/ModelRouter"
|
|
} |