Files
flutter_server_box/lib/l10n/app_zh.arb
lollipopkit🏳️‍⚧️ 3a615449e3 feat: Windows compatibility (#836)
* feat: win compatibility

* fix

* fix: uptime parse

* opt.: linux uptime accuracy

* fix: windows temperature fetching

* opt.

* opt.: powershell exec

* refactor: address PR review feedback and improve code quality

### Major Improvements:
- **Refactored Windows status parsing**: Broke down large `_getWindowsStatus` method into 13 smaller, focused helper methods for better maintainability and readability
- **Extracted system detection logic**: Created dedicated `SystemDetector` helper class to separate OS detection concerns from ServerProvider
- **Improved concurrency handling**: Implemented proper synchronization for server updates using Future-based locks to prevent race conditions

### Bug Fixes:
- **Fixed CPU percentage parsing**: Removed incorrect '*100' multiplication in BSD CPU parsing (values were already percentages)
- **Enhanced memory parsing**: Added validation and error handling to BSD memory fallback parsing with proper logging
- **Improved uptime parsing**: Added support for multiple Windows date formats and robust error handling with validation
- **Fixed division by zero**: Added safety checks in Swap.usedPercent getter

### Code Quality Enhancements:
- **Added comprehensive documentation**: Documented Windows CPU counter limitations and approach
- **Strengthened error handling**: Added detailed logging and validation throughout parsing methods
- **Improved robustness**: Enhanced BSD CPU parsing with percentage validation and warnings
- **Better separation of concerns**: Each parsing method now has single responsibility

### Files Changed:
- `lib/data/helper/system_detector.dart` (new): System detection helper
- `lib/data/model/server/cpu.dart`: Fixed percentage parsing and added validation
- `lib/data/model/server/memory.dart`: Enhanced fallback parsing and division-by-zero protection
- `lib/data/model/server/server_status_update_req.dart`: Refactored into 13 focused parsing methods
- `lib/data/provider/server.dart`: Improved synchronization and extracted system detection

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: parse & shell fn struct

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-08 16:56:36 +08:00

240 lines
11 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"@@locale": "zh",
"aboutThanks": "感谢以下参与的各位。",
"acceptBeta": "接受测试版更新推送",
"addSystemPrivateKeyTip": "检测到暂无私钥,是否添加系统默认的私钥(~/.ssh/id_rsa",
"added2List": "已添加至任务列表",
"addr": "地址",
"alreadyLastDir": "已是顶级目录",
"authFailTip": "认证失败,请检查连接信息是否正确",
"autoBackupConflict": "仅可启用一个自动备份任务",
"autoConnect": "自动连接",
"autoRun": "自动运行",
"autoUpdateHomeWidget": "自动更新桌面小部件",
"backupTip": "导出数据可通过密码加密,请妥善保管。",
"backupVersionNotMatch": "备份版本不兼容,无法恢复",
"backupPassword": "备份密码",
"backupPasswordTip": "设置密码以加密备份文件。留空则禁用加密。",
"backupPasswordWrong": "备份密码错误",
"backupEncrypted": "备份已加密",
"backupNotEncrypted": "备份未加密",
"backupPasswordSet": "备份密码已设置",
"backupPasswordRemoved": "备份密码已移除",
"battery": "电池",
"bgRun": "后台运行",
"bgRunTip": "此开关只代表程序会尝试在后台运行,具体能否后台运行取决于是否开启了权限。原生 Android 请关闭本 App 的“电池优化”MIUI / HyperOS 请将省电策略改为“无限制”。",
"closeAfterSave": "保存后关闭",
"cmd": "命令",
"collapseUITip": "是否默认折叠 UI 中的长列表",
"conn": "连接",
"container": "容器",
"containerTrySudoTip": "例如:在应用内将用户设置为 aaa但是 Docker 安装在root用户下这时就需要启用此选项",
"convert": "转换",
"copyPath": "复制路径",
"cpuViewAsProgressTip": "以进度条样式显示每个 CPU 的使用率(旧版样式)",
"cursorType": "光标类型",
"customCmd": "自定义命令",
"customCmdDocUrl": "https://github.com/lollipopkit/flutter_server_box/wiki/主页#自定义命令",
"customCmdHint": "\"命令名称\": \"命令\"",
"decode": "解码",
"decompress": "解压缩",
"deleteServers": "批量删除服务器",
"desktopTerminalTip": "启动 SSH 连接所用的终端模拟器命令",
"dirEmpty": "请确保目录为空",
"disconnected": "已断开连接",
"disk": "磁盘",
"diskHealth": "磁盘健康",
"diskIgnorePath": "忽略的磁盘路径",
"displayCpuIndex": "显示 CPU 索引",
"dl2Local": "下载 {fileName} 到本地?",
"dockerEmptyRunningItems": "没有正在运行的容器。\n这可能是因为\n- Docker 安装用户与 App 内配置的用户名不同\n- 环境变量 DOCKER_HOST 没有被正确读取。可以通过在终端内运行 `echo $DOCKER_HOST` 来获取。",
"dockerImagesFmt": "{count} 个镜像",
"dockerNotInstalled": "未安装 Docker",
"dockerStatusRunningAndStoppedFmt": "{runningCount} 个正在运行, {stoppedCount} 个已停止",
"dockerStatusRunningFmt": "{count} 个容器正在运行",
"doubleColumnMode": "双列模式",
"doubleColumnTip": "此选项仅用于启用该功能,是否生效取决于设备宽度",
"editVirtKeys": "编辑虚拟按键",
"editor": "编辑器",
"editorHighlightTip": "代码高亮功能可能影响性能,可选择关闭。",
"emulator": "模拟器",
"encode": "编码",
"envVars": "环境变量",
"experimentalFeature": "实验性功能",
"extraArgs": "额外参数",
"fallbackSshDest": "备选 SSH 目标",
"fdroidReleaseTip": "如果你是从 F-Droid 下载的本应用,推荐关闭此选项",
"fgService": "前台服务",
"fgServiceTip": "开启后,可能会导致部分机型闪退。关闭可能导致部分机型无法后台保持 SSH 连接。请在系统设置内允许 ServerBox 通知权限、后台运行、自我唤醒。",
"fileTooLarge": "文件 '{file}' 过大 '{size}',超过了 {sizeMax}",
"followSystem": "跟随系统",
"font": "字体",
"fontSize": "字体大小",
"force": "强制",
"fullScreen": "全屏模式",
"fullScreenJitter": "全屏模式抖动",
"fullScreenJitterHelp": "用于防止屏幕烧屏",
"fullScreenTip": "当设备旋转为横屏时,是否开启全屏模式。此选项仅作用于服务器 Tab 页。",
"goBackQ": "返回?",
"goto": "前往",
"hideTitleBar": "隐藏标题栏",
"highlight": "代码高亮",
"homeWidgetUrlConfig": "桌面部件链接配置",
"host": "主机",
"httpFailedWithCode": "请求失败,状态码: {code}",
"ignoreCert": "忽略证书",
"image": "镜像",
"imagesList": "镜像列表",
"init": "初始化",
"inner": "内置",
"install": "安装",
"installDockerWithUrl": "请先前往 https://docs.docker.com/engine/install 安装 Docker",
"invalid": "无效",
"jumpServer": "跳板服务器",
"keepForeground": "请将应用保持在前台运行",
"keepStatusWhenErr": "保留上次的服务器状态",
"keepStatusWhenErrTip": "仅限于执行脚本出错",
"keyAuth": "密钥认证",
"letterCache": "输入法字符缓存",
"letterCacheTip": "推荐关闭,但是关闭后无法输入 CJK 等文字",
"license": "证书",
"location": "位置",
"loss": "丢包率",
"madeWithLove": "用❤️制作 by {myGithub}",
"manual": "手动",
"max": "最大",
"maxRetryCount": "服务器尝试重连次数",
"maxRetryCountEqual0": "将无限次重试",
"min": "最小",
"mission": "任务",
"more": "更多",
"moveOutServerFuncBtnsHelp": "开启:可以在服务器 Tab 页的每个卡片下方显示。关闭:在服务器详情页顶部显示。",
"ms": "毫秒",
"needHomeDir": "如果你是群晖用户,[看这里](https://kb.synology.cn/zh-cn/DSM/tutorial/ssh_could_not_chdir_to_home_directory)。其他系统用户需搜索如何创建家目录home directory.",
"needRestart": "需要重启 App",
"net": "网络",
"netViewType": "网络视图类型",
"newContainer": "新建容器",
"noLineChart": "不使用折线图",
"noLineChartForCpu": "CPU 不使用折线图",
"noPrivateKeyTip": "私钥不存在,可能已被删除/配置错误",
"noPromptAgain": "不再提示",
"node": "节点",
"notAvailable": "不可用",
"onServerDetailPage": "在服务器详情页",
"onlyOneLine": "仅显示为一行(可滚动)",
"onlyWhenCoreBiggerThan8": "仅当核心数大于 8 时生效",
"openLastPath": "打开上次的路径",
"openLastPathTip": "将为每台服务器记录其最后访问路径",
"parseContainerStatsTip": "Docker 解析占用状态较为缓慢",
"percentOfSize": "{size} 的 {percent}%",
"permission": "权限",
"pingAvg": "平均:",
"pingInputIP": "请输入目标IP或域名",
"pingNoServer": "没有服务器可用于 Ping\n请在服务器 tab 添加服务器后再试",
"pkg": "包管理",
"plugInType": "插入类型",
"port": "端口",
"preferDiskAmount": "优先显示硬盘容量",
"preview": "预览",
"privateKey": "私钥",
"process": "进程",
"prune": "修剪",
"pushToken": "消息推送 Token",
"pveIgnoreCertTip": "不推荐开启,注意安全隐患!如果你使用的 PVE 默认证书,需要开启该选项",
"pveLoginFailed": "登录失败。无法使用服务器配置中的用户名或密码通过 Linux PAM 方式认证。",
"pveVersionLow": "当前该功能处于测试阶段,仅在 PVE 8+ 上测试过,请谨慎使用",
"read": "读",
"reboot": "重启",
"rememberPwdInMem": "在内存中记住密码",
"rememberPwdInMemTip": "用于容器、挂起等",
"rememberWindowSize": "记住窗口大小",
"remotePath": "远端路径",
"restart": "重启",
"result": "结果",
"rotateAngel": "旋转角度",
"route": "路由",
"run": "运行",
"running": "运行中",
"sameIdServerExist": "已存在相同 id 的服务器",
"save": "保存",
"saved": "已保存",
"second": "秒",
"sensors": "传感器",
"sequence": "顺序",
"server": "服务器",
"serverDetailOrder": "详情页部件顺序",
"serverFuncBtns": "服务器功能按钮",
"serverOrder": "服务器顺序",
"sftpDlPrepare": "准备连接至服务器...",
"sftpEditorTip": "如果为空, 使用App内置的文件编辑器. 如果有值, 这是用远程服务器的编辑器, 例如 `vim` (建议根据 `EDITOR` 自动获取).",
"sftpRmrDirSummary": "在 SFTP 中使用 `rm -r` 来删除文件夹",
"sftpSSHConnected": "SFTP 已连接",
"sftpShowFoldersFirst": "文件夹显示在前",
"showDistLogo": "显示发行版 Logo",
"shutdown": "关机",
"size": "大小",
"snippet": "代码片段",
"softWrap": "自动换行",
"specifyDev": "指定设备",
"specifyDevTip": "例如网络流量统计默认是所有设备,你可以在这里指定特定的设备",
"speed": "速度",
"spentTime": "耗时:{time}",
"sshTermHelp": "在终端可滚动时,横向拖动可以选中文字。点击键盘按钮可以开启/关闭键盘。文件图标会打开当前路径 SFTP。剪切板按钮会在有选中文字时复制内容在未选中并且剪切板有内容时粘贴内容到终端。代码图标会粘贴代码片段到终端并执行。",
"sshTip": "该功能目前处于测试阶段。\n\n请在 {url} 反馈问题,或者加入我们开发。",
"sshVirtualKeyAutoOff": "虚拟按键自动切换",
"start": "开始",
"stat": "统计",
"stats": "统计",
"stop": "停止",
"stopped": "已停止",
"storage": "存储",
"supportFmtArgs": "支持以下格式化参数:",
"suspend": "挂起",
"suspendTip": "suspend 功能需要 root 权限及 systemd 支持。",
"switchTo": "切换到 {val}",
"sync": "同步",
"syncTip": "可能需要重新启动,某些更改才能生效。",
"system": "系统",
"tag": "标签",
"temperature": "温度",
"termFontSizeTip": "此设置会影响终端大小(宽和高)。可以在终端页面缩放来调整当前会话的字体大小",
"terminal": "终端",
"test": "测试",
"textScaler": "字体缩放",
"textScalerTip": "1.0 => 100%(原大小),仅作用于服务器页面部分字体,不建议修改。",
"theme": "主题",
"time": "时间",
"times": "次",
"total": "总共",
"traffic": "流量",
"trySudo": "尝试使用 sudo",
"ttl": "TTL",
"unknown": "未知",
"unkownConvertMode": "未知转换模式",
"update": "更新",
"updateIntervalEqual0": "设置为 0 将不自动刷新服务器状态。\n且无法计算 CPU 使用率。",
"updateServerStatusInterval": "服务器状态刷新间隔",
"upload": "上传",
"upsideDown": "上下交换",
"uptime": "启动时长",
"useCdn": "使用 CDN",
"useCdnTip": "非中国大陆用户推荐使用 CDN是否使用",
"useNoPwd": "将会使用无密码",
"usePodmanByDefault": "默认使用 Podman",
"used": "已用",
"view": "视图",
"viewErr": "查看错误",
"virtKeyHelpClipboard": "如果终端有选中字符,则复制选中字符至剪切板,否则粘贴剪切板内容至终端。",
"virtKeyHelpIME": "打开/关闭键盘",
"virtKeyHelpSFTP": "在 SFTP 中打开当前路径。",
"waitConnection": "请等待连接建立",
"wakeLock": "保持唤醒",
"watchNotPaired": "没有已配对的 Apple Watch",
"webdavSettingEmpty": "WebDav 设置项为空",
"whenOpenApp": "当打开 App 时",
"wolTip": "配置 WOL 后,每次连接服务器时将自动发送唤醒请求",
"write": "写",
"writeScriptFailTip": "写入脚本失败,可能是没有权限/目录不存在等",
"writeScriptTip": "在连接服务器后,会向 `~/.config/server_box` \n | `/tmp/server_box` 写入脚本来监测系统状态,你可以审查脚本内容。"
}