-
Notifications
You must be signed in to change notification settings - Fork 53
feat: enhance instance details and server management #1169 #1338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -65,6 +65,9 @@ use tokio; | |||||||||||||||||
| use tokio::sync::Semaphore; | ||||||||||||||||||
| use url::Url; | ||||||||||||||||||
| use zip::read::ZipArchive; | ||||||||||||||||||
| // [new] | ||||||||||||||||||
| //use base64::{Engine as _, engine::general_purpose}; | ||||||||||||||||||
|
||||||||||||||||||
| //use base64::{Engine as _, engine::general_purpose}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处删除了其他 PR 的修复逻辑
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of the secondary sort by name (.then_with(|| a.name.to_lowercase().cmp(&b.name.to_lowercase()))) changes the existing behavior. When instances have the same version, they will no longer be sorted alphabetically by name. This appears to be an unrelated change to the PR's stated purpose of adding server management functionality. If this is intentional, it should be documented in the PR description or made in a separate commit. If unintentional, the secondary sort should be restored.
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new Tauri command add_server_to_instance is not registered in the invoke_handler in src-tauri/src/lib.rs. This command will not be accessible from the frontend and will cause runtime errors when invoked. You need to add instance::commands::add_server_to_instance to the tauri::generate_handler![] macro in lib.rs.
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new Tauri command delete_server_from_instance is not registered in the invoke_handler in src-tauri/src/lib.rs. This command will not be accessible from the frontend and will cause runtime errors when invoked. You need to add instance::commands::delete_server_from_instance to the tauri::generate_handler![] macro in lib.rs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请与项目其他代码统一,使用英文注释
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version field is hardcoded as "Unknown" instead of retrieving the actual server version. The GameServerInfo structure appears to have version information from the query_servers_online function, but it's not being mapped to the PingResult. Consider adding a version field to GameServerInfo or extracting it from the server response.
| version: "Unknown".to_string(), | |
| version: res.version.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请使用 Enums 返回错误
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These error messages are hardcoded in Chinese ("服务器未响应" and "查询失败"). For consistency with the rest of the codebase, error messages should be in English since they will be displayed in the frontend's error handling which can then apply proper i18n. Change these to English messages like "Server did not respond" and "Query failed".
| Err("服务器未响应".to_string()) | |
| } | |
| } | |
| Err(e) => Err(format!("查询失败: {:?}", e)), | |
| Err("Server did not respond".to_string()) | |
| } | |
| } | |
| Err(e) => Err(format!("Query failed: {:?}", e)), |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new Tauri command ping_server is not registered in the invoke_handler in src-tauri/src/lib.rs. This command will not be accessible from the frontend and will cause runtime errors when invoked. You need to add instance::commands::ping_server to the tauri::generate_handler![] macro in lib.rs.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,212 @@ | ||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||
| Badge, | ||||||||||||||||||||||||||||||||||||
| Box, | ||||||||||||||||||||||||||||||||||||
| Button, | ||||||||||||||||||||||||||||||||||||
| FormControl, | ||||||||||||||||||||||||||||||||||||
| FormLabel, | ||||||||||||||||||||||||||||||||||||
| HStack, | ||||||||||||||||||||||||||||||||||||
| Image, | ||||||||||||||||||||||||||||||||||||
| Input, | ||||||||||||||||||||||||||||||||||||
| Modal, | ||||||||||||||||||||||||||||||||||||
| ModalBody, | ||||||||||||||||||||||||||||||||||||
| ModalCloseButton, | ||||||||||||||||||||||||||||||||||||
| ModalContent, | ||||||||||||||||||||||||||||||||||||
| ModalFooter, | ||||||||||||||||||||||||||||||||||||
| ModalHeader, | ||||||||||||||||||||||||||||||||||||
| ModalOverlay, | ||||||||||||||||||||||||||||||||||||
| Skeleton, | ||||||||||||||||||||||||||||||||||||
| Text, | ||||||||||||||||||||||||||||||||||||
| VStack, | ||||||||||||||||||||||||||||||||||||
| } from "@chakra-ui/react"; | ||||||||||||||||||||||||||||||||||||
| import { invoke } from "@tauri-apps/api/core"; | ||||||||||||||||||||||||||||||||||||
| import { useEffect, useState } from "react"; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| interface AddServerModalProps { | ||||||||||||||||||||||||||||||||||||
| isOpen: boolean; | ||||||||||||||||||||||||||||||||||||
| onClose: () => void; | ||||||||||||||||||||||||||||||||||||
| onAdd: (name: string, address: string) => void; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| export const AddServerModal = ({ | ||||||||||||||||||||||||||||||||||||
| isOpen, | ||||||||||||||||||||||||||||||||||||
| onClose, | ||||||||||||||||||||||||||||||||||||
| onAdd, | ||||||||||||||||||||||||||||||||||||
| }: AddServerModalProps) => { | ||||||||||||||||||||||||||||||||||||
| const [name, setName] = useState(""); | ||||||||||||||||||||||||||||||||||||
| const [address, setAddress] = useState(""); | ||||||||||||||||||||||||||||||||||||
| const [queryResult, setQueryResult] = useState<any>(null); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
| const [isQuerying, setIsQuerying] = useState(false); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||||
| if (!address || !address.includes(".") || address.length < 3) { | ||||||||||||||||||||||||||||||||||||
| setQueryResult(null); | ||||||||||||||||||||||||||||||||||||
| setIsQuerying(false); | ||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+41
to
+45
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| const delayTimer = setTimeout(async () => { | ||||||||||||||||||||||||||||||||||||
| setIsQuerying(true); | ||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||
| const result = await invoke("ping_server", { address }); | ||||||||||||||||||||||||||||||||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不符合前端 service-handleService 格式规范 |
||||||||||||||||||||||||||||||||||||
| setQueryResult(result); | ||||||||||||||||||||||||||||||||||||
| } catch (err) { | ||||||||||||||||||||||||||||||||||||
| setQueryResult({ error: true }); | ||||||||||||||||||||||||||||||||||||
| } finally { | ||||||||||||||||||||||||||||||||||||
| setIsQuerying(false); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| }, 600); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
| }, 600); | |
| }, 1200); |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default server name "Minecraft Server" is hardcoded in English. For consistency with the i18n system, this should use a translation key or be derived from the server's MOTD (which is already available in queryResult if the ping succeeds).
| if (address.trim()) { | |
| onAdd(name || "Minecraft Server", address.trim()); | |
| const trimmedAddress = address.trim(); | |
| if (trimmedAddress) { | |
| const trimmedName = name.trim(); | |
| const motd = | |
| queryResult && typeof queryResult === "object" | |
| ? // Prefer a "clean" MOTD text if available, otherwise fall back to a direct MOTD field | |
| (queryResult.motd && | |
| (queryResult.motd.clean || queryResult.motd.text || queryResult.motd)) || | |
| queryResult.motd | |
| : undefined; | |
| const resolvedName = | |
| (trimmedName as string) || | |
| (typeof motd === "string" ? motd : "") || | |
| trimmedAddress; | |
| onAdd(resolvedName, trimmedAddress); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
本项目其他 modal 从未单独定义 overlay、content、modal 内 input 的 css 格式
组件单独定义的 style 参数过多
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
未使用 i18n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
未使用 i18n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
未使用 i18n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
未使用 i18n
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This component contains hardcoded Chinese text strings instead of using the i18n translation system. All user-facing text should be internationalized using the t() function with locale keys. The following strings need to be moved to locale files: "添加服务器" (line 85), "名称 (可选)" (line 91), "地址 (IP / 域名)" (line 104), "无法解析或连接服务器" (line 151), "Minecraft Server" (line 169), "在线" (line 177), "输入地址后自动预览" (line 187), "取消" (line 196), "确定添加" (line 204).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请删除 vibe 痕迹