Features:
- Opencode AI chat interface
- SSH tunnel for secure API communication
- Auto-install Opencode on remote servers
- API key management with server-side storage
- Session history and management
- Integration with flutter_server_box server list
* feat: Added Port Forwarding Functionality
Implemented port forwarding functionality, including the following major changes:
- Added a port forwarding configuration model and related state management
- Added a port forwarding page and interaction logic
- Implemented forwarding connections between local and remote ports
- Integrated into the server features menu
- Added necessary Hive adapters and storage support
- Updated plugin configurations across all platforms to support the new feature
* feat (Port Forwarding): Added multilingual support and optimized implementation
Added multilingual support for the port forwarding feature, including Chinese, English, and other languages
Optimized the port forwarding implementation by adding connection management and error handling
Fixed an issue with state persistence when updating port forwarding configurations
Updated related dependencies and submodules
* fix(port_forward): Fixed port forwarding error handling and redesigned the configuration dialog
Handled uncaught errors when port forwarding is disabled or during connection attempts
Extracted the configuration dialog into a standalone component and added port range validation
* fix(port_forward): Fixed issues with port forwarding connection management and UI layout
Fixed an issue where port forwarding connections were not closed properly; now uses `clientGetter` to delay the retrieval of `SSHClient`
Added cleanup logic when connections are closed to prevent memory leaks
Added a `mounted` check in `PortForwardPage` to prevent operations from executing after the component is unmounted
Wrapped the configuration dialog content in a `SingleChildScrollView` to prevent content overflow
* fix(port_forward): Fixed a concurrent modification exception that occurred when closing a port forwarding connection
Fixed a concurrent modification exception that could occur when closing a local forwarding entry by copying the connection list to prevent modifications to the collection during iteration. Also improved the UI by using theme colors and added error handling for configuration saving.
* fix(port_forward_provider): Fixed an issue where entries were not properly removed when port forwarding was stopped
When port forwarding is stopped, ensure that the corresponding entries are removed from the _forwards map. Additionally, before adding a new forwarding rule, check for and close any existing forwarding rules with the same ID to prevent resource leaks.
* refactor(l1n): Remove unused localization and remote host port translations
* fix(port_forward_provider): Handle errors when closing port forwarding
Add error handling to prevent the program from crashing due to exceptions when closing port forwarding
* refactor(port_forward): Refactor port forwarding state management to use serverId
Directly link port forwarding state management to the server ID to simplify parameter passing
Remove direct dependencies on Spi and use serverId as the core identifier instead
Update relevant providers and page logic to accommodate the new state structure
* fix(port_forward): Fixed a race condition issue in port forwarding operations
Added an _inFlight collection to prevent duplicate operations
Added a _saving state when saving configurations to prevent duplicate submissions
Automatically cleans up forwarding when changes in server connection status are detected
* refactor(port_forward_provider): Remove unnecessary concurrency control logic
Simplify the `toggleForward` method by removing concurrency control for the `_inFlight` collection, as it is not required in the current scenario
* fix(ssh): Ensure that the private key ends with a newline character
Fixes an issue where SSH private key files were not written with a newline character at the end, preventing parsing errors in certain SSH clients
Update the package
* fix(server_func_btns): Fixed an issue with the order of SSH command parameters and added file permission settings
Added permission settings for private key files on non-Windows platforms to ensure secure access. Additionally, the order of SSH command parameters was adjusted to ensure that connection parameters are passed correctly.
* 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>