功能: 添加服务器版本管理器(下载/更新/降级 Factorio 服务端)#443
Open
BAYUNZIYUE wants to merge 94 commits into
Open
Conversation
- save.go: 修复 fmt.Errorf 中 %%v 导致编译失败 (20+处) - mod_modInfo.go: 修复依赖解析 parts[2] 越界崩溃 - mod_modInfo.go: 修复 base 依赖覆盖 FactorioVersion 为更低版本 (如 2.0→0.18) - version_compat_test.go: 新增 GEC 兼容性测试 (2.1/2.0/1.0 边界情况)
- mod_portal.go: 发布版兼容性从 Compatible(>=) 改为 GEC() 修复 2.1 服务器错误标为兼容的 portal 发布版 - mod_Mods.go: DepOp 从硬编码 >= 改为传递 modInfo.DepOp
- mod_portal_handler.go: Mod not found 时返回 404 + JSON - Mod.jsx: portal.info 失败时 try/catch 静默跳过更新检查
来源: joey00797-cell/factorio-server-manager develop (93a92ea) 合并内容: - mod_sync.go: 从存档自动同步模组 (level.dat0 解析 + 门户下载) - i18n: i18next 框架 (EN/RU) + 新增 zh-CN 翻译 - DLC 分组: ModList 中 elevated-rails/quality/space-age 聚合行 - DLC 模组显示: 从 mod-list.json 读取无 zip 的 DLC 模组 - LoadMods.jsx 重写: checkbox 选择同步 + WebSocket 进度 - ChangeLangDialog: 语言切换对话框 - 路由: GetModsFromSave / SyncModsFromSave 保留我们的: - save.go: readFromV2 完整 2.0 解析器 (跳过 Joey 的 +12 字节补丁) - Controls.jsx: 完整版本管理器 (跳过 Joey 的简易安装面板) - mod_sync.go DownloadMod 适配: nil progress callback
- common 命名空间: signIn/username/password 等登录页翻译 - i18n.js: ns 配置 + zh-CN 资源 - zh.json: 67 个顶层键 + 嵌套翻译 (完整镜像 en.json) - ChangeLangDialog: 添加简体中文按钮 - zh-common.json: 独立 common 命名空间翻译
合并后 Joey 的组件使用独立命名空间 (controls/console/logs/mods/saves/ serverSettings/serverVersion/userManagement/layout) 但 i18n.js 只注册了 translation/common 两个,导致页面显示原始键名。 - 创建 9 个 zh-*.json 命名空间翻译文件 - i18n.js 注册全部 ns + 加载对应资源 - 补全大小写键名 (STOPPED/RUNNING/serverStatus 等)
- Layout.jsx: 恢复 FSM 管理区的刷新模组按钮 (fsm_refresh_mods) - Mods.jsx: 移除 LoadMods 中未使用的共享 auth 属性 (Joey 版本自管 auth) - zh-layout.json / en.json: 添加 refresh 翻译键
- zh-layout.json: 12 keys (main_title, logout, refresh...) - zh-controls.json: 22 keys (RUNNING, STOPPED, saveStopServer...) - zh-console.json: 6 keys - zh-logs.json: 4 keys - zh-mods.json: 49 keys (confirmDeleteAllMods, loadingModList...) - zh-saves.json: 16 keys (createSave, uploadSave...) - zh-serverSettings.json: 32 keys (showTranslation, hideTranslation...) - zh-serverVersion.json: 24 keys (installSuccess, upToDate, fetchFailed...) - zh-userManagement.json: 24 keys (changePassword, passwordMismatch...) - zh.json: 新增 refresh 键 - en.json: 补全 Layout.jsx 引用的嵌套键
根因: Mod 组件 useEffect([mod]) 每次轮询都重新检查更新,导致 153 个 portal.info() 并发请求 + addUpdatableMod 连锁状态更新 → React 组件树崩溃 → 黑屏。 - Mod.jsx: portal.info 仅首次挂载检查一次 (checked flag) - Mods.jsx: addUpdatableMod 去重,避免重复添加触发多余渲染
根因: portal API 404 返回 {message:...} 对象,axios 拦截器将其传入
window.flash(),Flash 组件渲染 Object → React error OpenFactorioServerManager#31 → 全局黑屏。
- 404 响应静默跳过(portal 模组不存在是预期行为)
- 对象响应安全转为字符串(message 字段或 JSON.stringify)
- 仅非预期错误触发 flash 提示
- CHANGELOG: 新增 v0.12.0 条目,记录 50+ 项变更 (Added/Changed/Fixed/Removed) - ROADMAP: 标记已完成项 (版本管理器/2.1兼容/i18n中文/并发下载/存档解析...)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
为 FSM 添加完整的 Factorio 服务端版本管理功能,支持从官方 API 下载、安装、切换 Factorio 版本。
功能
技术实现
src/factorio/version_manager.gosrc/factorio/version_status.gosrc/api/version_handler.gosrc/api/routes.goui/App/views/ServerVersion.jsxui/api/resources/server.jsui/locales/