Files
flutter_server_box/lib/hive/hive_adapters.g.yaml
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

222 lines
3.4 KiB
YAML

# Generated by Hive CE
# Manual modifications may be necessary for certain migrations
# Check in to version control
nextTypeId: 10
types:
PrivateKeyInfo:
typeId: 1
nextIndex: 2
fields:
id:
index: 0
key:
index: 1
Snippet:
typeId: 2
nextIndex: 5
fields:
name:
index: 0
script:
index: 1
tags:
index: 2
note:
index: 3
autoRunOn:
index: 4
Spi:
typeId: 3
nextIndex: 15
fields:
name:
index: 0
ip:
index: 1
port:
index: 2
user:
index: 3
pwd:
index: 4
keyId:
index: 5
tags:
index: 6
alterUrl:
index: 7
autoConnect:
index: 8
jumpId:
index: 9
custom:
index: 10
wolCfg:
index: 11
envs:
index: 12
id:
index: 13
customSystemType:
index: 14
VirtKey:
typeId: 4
nextIndex: 45
fields:
esc:
index: 0
alt:
index: 1
home:
index: 2
up:
index: 3
end:
index: 4
sftp:
index: 5
snippet:
index: 6
tab:
index: 7
ctrl:
index: 8
left:
index: 9
down:
index: 10
right:
index: 11
clipboard:
index: 12
ime:
index: 13
pgup:
index: 14
pgdn:
index: 15
slash:
index: 16
backSlash:
index: 17
underscore:
index: 18
plus:
index: 19
equal:
index: 20
minus:
index: 21
parenLeft:
index: 22
parenRight:
index: 23
bracketLeft:
index: 24
bracketRight:
index: 25
braceLeft:
index: 26
braceRight:
index: 27
chevronLeft:
index: 28
chevronRight:
index: 29
colon:
index: 30
semicolon:
index: 31
f1:
index: 32
f2:
index: 33
f3:
index: 34
f4:
index: 35
f5:
index: 36
f6:
index: 37
f7:
index: 38
f8:
index: 39
f9:
index: 40
f10:
index: 41
f11:
index: 42
f12:
index: 43
shift:
index: 44
NetViewType:
typeId: 5
nextIndex: 3
fields:
conn:
index: 0
speed:
index: 1
traffic:
index: 2
ServerFuncBtn:
typeId: 6
nextIndex: 9
fields:
terminal:
index: 0
sftp:
index: 1
container:
index: 2
process:
index: 3
snippet:
index: 5
iperf:
index: 6
systemd:
index: 8
ServerCustom:
typeId: 7
nextIndex: 8
fields:
pveAddr:
index: 1
pveIgnoreCert:
index: 2
cmds:
index: 3
preferTempDev:
index: 4
logoUrl:
index: 5
netDev:
index: 6
scriptDir:
index: 7
WakeOnLanCfg:
typeId: 8
nextIndex: 3
fields:
mac:
index: 0
ip:
index: 1
pwd:
index: 2
SystemType:
typeId: 9
nextIndex: 3
fields:
linux:
index: 0
bsd:
index: 1
windows:
index: 2