* refactor(sftp): Optimize file download logic and SSH command execution handling
Replace manual chunked downloads with a more concise `sftp.download` method
Consistently use `utf8.decode` to process SSH command output
Remove redundant code and comments, and simplify the logic
* chore: Update `dartssh2` submodule
* feat (Temperature Display): Added an option to switch between degrees Celsius and millicelsius
Allows users to switch temperature units in server settings, resolving the issue of incorrect temperature display on some devices
* chore: Add a participnt
* fix(sftp): Fixed a resource leak issue during file downloads and SSH command execution
Ensured that remote and local file handles are properly closed during file downloads to prevent resource leaks. Additionally, improved error handling during SSH command execution to ensure that all streams are either successfully completed or properly handled in the event of an error.
* feat (Connection Statistics): Restored the server connection statistics feature
* perf(store): Optimize data storage performance and implement caching mechanisms
- Implement caching mechanisms in SnippetStore and ServerStore to reduce redundant loading
- Refactor ConnectionStatsStore to use indexes and optimize query performance
- Adopt a more efficient approach when cleaning up expired records
- Add a maximum record limit to prevent data bloat
* perf(store): Optimize data storage performance and add a caching mechanism
Add a caching mechanism to PrivateKeyStore to reduce redundant loading
Make the cleanup and index rebuilding of ConnectionStatsStore asynchronous
Add database compression and size statistics
Display database size in the interface and optimize compression operations
* fix (Cache): Fixed cache invalidation and join statistics issues
- Added a cache invalidation call to the reload method
- Fixed an error in the calculation of join statistics timestamps
- Optimized the cache index rebuild logic
- Added tooltips and click effects for join statistics
* refactor(connection_stats): Convert file operations from synchronous to asynchronous and optimize record cleanup logic
Convert the database size retrieval method from synchronous to asynchronous to prevent UI blocking
Optimize server record cleanup logic by directly deleting redundant records instead of rebuilding indexes
* fix(connection_stats): Fixed an initialization issue when the index database is empty
During Stores initialization, the code now checks whether `connectionStats.indexDbKeys` is empty; if so, it calls `rebuildIndexAndCompact` to rebuild and compact the database. Additionally, the implementation of the `_pruneExcessRecords` method has been optimized to use tuples instead of temporary lists, thereby improving performance. A `mounted` check has been added at the UI layer to prevent state update issues during asynchronous operations.
* fix(server): Improved error string matching logic to more accurately identify connection issues
Error strings are now uniformly converted to lowercase for comparison, and matching criteria have been expanded to cover a wider range of error scenarios, including timeouts, authentication failures, and network errors
* fix(PrivateKeyStore): Fixed an issue where the cache state was not updated when clearing the cache
When clearing the private key store, ensure that the internal cache state is updated simultaneously to maintain consistency
* refactor(store): Add close methods and clean up subscription logic
Add close methods to PrivateKeyStore, SnippetStore, and ServerStore to unsubscribe
Unify cache cleanup logic to prevent memory leaks
* fix(store): Add a cache update suppression mechanism to prevent circular updates
Add an _suppressWatch flag to multiple Store classes to suppress cache invalidation during internal operations
Add a _putWithoutInvalidatingCache method to prevent recursive watchers from being triggered during data updates
* refactor(store): Improve caching and state management using try-finally
In PrivateKeyStore, ServerStore, and SnippetStore:
1. Remove redundant close methods
2. Use try-finally to ensure the _suppressWatch state is reset correctly
3. Optimize cache invalidation logic
4. Standardize transaction handling for update operations
* refactor(store): Optimize data storage operations and fix potential issues
- Ensure the safety and consistency of list operations in ConnectionStatsStore
- Replace direct calls to `box.put` with the `set` method in SnippetStore and ServerStore
- Extract decoding logic for PrivateKeyStore into a separate method
- Add logic to update server-hopping relationships
* fix: Fixed an issue where asynchronous operations were not being waited on and optimized storage operations
Fixed several issues where asynchronous operations were not being waited on to ensure data consistency
Added the _suppressWatch control to ServerStore and PrivateKeyStore
Optimized index management in ConnectionStatsStore to maintain record order
Added a new GitHub participant
* fix: Fixed potential state issues and memory leaks in asynchronous operations
Fixed potential state issues that could occur on the server edit page after a delete operation; added a mounted check
Changed the statistics clearing operation in connection_stats to run asynchronously
Optimized asynchronous operations in PrivateKeyStore and fixed potential memory leaks
* refactor(store): Convert asynchronous methods to synchronous ones to simplify the code
Fixed an issue where asynchronous operations were not handled correctly on the connection statistics page
* fix: Added mounted check and error handling for connection logs
Added a mounted check in _ConnectionStatsPageState to prevent the state from being updated after the component is unmounted
Added a try-catch block for connection logs in ServerNotifier to catch and log potential storage exceptions
* chore: Update submodules and dependencies
Update the fl_lib and circle_chart submodules to the latest commit
Upgrade the hive_ce_generator dependency from 1.9.2 to 1.11.0
* build: Updated dependency versions
Updated fl_chart to 1.2.0, json_serializable to 6.13.0, and test to 1.29.0
Replaced flutter_secure_storage_macos with flutter_secure_storage_darwin
Removed the animations and screenshot dependencies, which are no longer in use
* chore: Update French i18n
- Update Riverpod-related dependencies to the latest versions
- Remove the app_links and gtk plugins
- Update the reference path for hive_ce
- Adjust the provider implementation in the generated code
* 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
* feat(PVE): Added display of PVE connection loading steps
Added a detailed display of loading steps during the PVE connection process, including stages such as establishing an SSH tunnel, authentication, and data retrieval
Also optimized the sorting of PVE storage content and the logic for handling connection errors
* feat(pve): Added error handling and prompts for PVE two-factor authentication
Added error handling for PVE servers when two-factor authentication is enabled, along with relevant error types and localized prompts
* feat(PVE): Added support for PVE passwords during key-based authentication
- Added the `pvePwd` field to the `ServerCustom` model
- Added a PVE password input field to the edit page (displayed only during key-based authentication)
- Updated multilingual files to support PVE-related loading states and password prompts
- Optimized PVE connection logic to support password verification during key-based authentication
* 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.
* refactor(ssh): Remove terminal copy button and streamline clipboard functionality
Update dependency versions and remove the copy button from the terminal page, integrating clipboard functionality into the terminal controller.
* refactor(ssh): Optimize clipboard paste functionality implementation
Convert the _OnTerminalPaste method to an asynchronous implementation and remove duplicate _paste methods.
* refactor(ssh): Rename clipboard operation function and add new functionality
Renamed _onTerminalPaste to _onClipboardAction and expanded its functionality
Now supports copying selected text to the clipboard and performing paste operations when no text is selected
* fix: Fixed an issue where clipboard operations did not wait for asynchronous completion.
* fix(ssh): Fixed terminal paste operation return logic
Prevented redundant _onTerminalPaste calls after terminal paste operations
- Update the fl_lib submodule to the latest commit
- Remove dependency comments using submodules from pubspec.yaml
- Upgrade local_auth and related platform implementations to new versions
* refactor(Settings page): Simplify the click handling logic of the cancel button
* fix(backup_service): Add a cancel button in the restore backup dialog
* refactor(Settings Page): Refactor the ordered list component and optimize state management
- Extract the logic for building list items into a separate method to improve maintainability
- Add animation effects to enhance the dragging experience
- Use PageStorageKey to maintain the scroll position
- Optimize the state management logic of the checkbox
- Add new contributors in github_id.dart
* fix: Add SafeArea to the settings page to prevent content from being obscured
Add SafeArea wrapping content in multiple settings pages to prevent content from being obscured by the navigation bar on certain devices, thereby enhancing user experience
* refactor: Extract file list retrieval method and optimize asynchronous loading of iOS settings page
Extract the `_getEntities` method from an inline function to a class member method to enhance code readability
Preload watch context and push token in the iOS settings page to avoid repeatedly creating Futures
* fix: Add a `key` attribute to the ChoiceChipX component to avoid rendering issues
* refactor(Settings page): Refactor the platform-related settings logic and merge the Android settings into the main page
Migrate the Android platform settings from a standalone page to the main settings page, and remove redundant Android settings page files
Adjust the platform setting logic, retaining only the special setting entry for the iOS platform
* build: Update fl_lib dependency to v1.0.363
* feat(Settings): Add persistent disable state for cards and virtual keys
Add persistent storage functionality for server detail cards and SSH virtual key disable status
Modify the logic of relevant pages to support the saving and restoration of disabled states
* refactor(setting): Simplify save logic and optimize file sorting performance
In the settings page, remove the unnecessary `enabledList` filtering and directly save the `_order` list
Optimize the sorting logic on the local file page by first retrieving the file status before proceeding with sorting
* fix: Optimize data filtering and backup service error handling on the settings page
Fix the data filtering logic in the settings page to only process key-value pairs with specific prefixes
Add error handling to the backup service, capture and display merge failure exceptions
* fix(Settings page): Fixed the issue where disabled items were not included in the order settings and asynchronously saved preference settings
Fix the issue where disabled items in the virtual keyboard and service details order settings are not included in the order list
Change the preference setting saving method to an asynchronous operation, and add a mounted check to prevent updating the state after the component is unmounted
* refactor: Optimize the reordering logic and remove redundant sorting methods
Narrow the scope of state updates in the reordering logic to only encompass the parts where data is actually modified
Remove the unused sorting methods in `_local.dart` to simplify the code
* refactor(view): Optimize the refresh logic of the local file page
Refactor the refresh method that directly calls setState into a unified _refresh method
Use the `_entitiesFuture` to cache the list of files to obtain results and avoid redundant calculations
* Update lib/view/page/storage/local.dart
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* build: Replace flutter_markdown with flutter_markdown_plus
* build: Update fl_lib dependency to v1.0.361 and synchronize related dependencies
Update the fl_lib dependency version in the pubspec.yaml and pubspec.lock files to v1.0.361, and simultaneously update the dependency versions of camera_avfoundation and objective_c
* build: Add flutter_markdown_plus dependency
* build: update the git reference of fl_lib
* fix: Fix the issue with the display of the window title bar
When initializing the window, add the configuration to set the title bar display, ensuring consistency with user settings
* build: Update fl_lib to main for changes
* build: Update fl_lib dependency to version v1.0.359
* feat(localization): Add validation prompt for invalid host formats
Add validation for host formats, allowing only IPv4, IPv6, and domain name formats
Add regular expression validation for host format on the server editing page
Update multilingual files to add the invalidHostFormat field
* chore: Update dependent package versions to the latest
* fix(server edit): Update the hostname regular expression to support IPv6 zone identifiers
Modify the regular expression for hostname validation to add support for IPv6 zone identifiers (such as %en0)
* refactor(server): Replace Future.wait with an explicit list of futures to enhance readability
Refactor the nested map and async functions into explicit for loops and future lists to make the code logic clearer
* fix(server): Fixed the auto-refresh logic and concurrency control issues
- Add `_refreshCompleter` to prevent concurrent refreshes
- Fixed the issue where the status was not updated after the automatic refresh timer was canceled
- Remove the invalid check for `duration == 1`
* refactor(server): Optimize the server refresh logic by filtering out servers that do not need to be refreshed in advance
Move the server filtering logic outside the loop and use the `where` method to filter the servers that need to be refreshed, avoiding repeated condition checks within the loop. This improves code readability and reduces redundant condition checks.
* refactor: Optimize server refresh logic to enhance readability
Break down complex conditional checks into clearer steps, separating the logic for server refresh and rate limiter reset. Replace chained calls with explicit loops to make the code easier to maintain and understand.
* refactor(server): Remove `updateFuture` from `ServerState` and use the `_isRefreshing` flag instead
Simplify the server refresh logic, replace Future state tracking with a boolean flag, and avoid unnecessary state updates
* refactor(server_detail): Extract the setting items as local variables to improve performance
Extract the globally set items that are accessed repeatedly as local variables, reduce unnecessary state retrieval operations, and optimize page performance
* refactor: Rename `_displayCpuIndexSetting` to `_displayCpuIndex` for consistency
* refactor(server): Fix the issue of parallel blocking in server refresh
The original code uses Future.wait to wait for all refresh operations to complete, but in fact, there is no need to wait for the results of these operations. Instead, directly calling ignore() to ignore the results can avoid blocking caused by the slowest server
* fix: Adjust the order of logging and default value settings
Ensure to set the default value after recording the invalid duration warning
* refactor(server): Rename _refreshCompleter to _refreshInProgress to enhance readability
Change the variable name from `_refreshCompleter` to `_refreshInProgress`, so that it more accurately reflects the actual purpose of the variable, which is to indicate whether the refresh operation is in progress
* refactor(server): Remove unnecessary refresh progress status management
Simplify the server refresh logic, remove the unused _refreshInProgress state variable and related Completer handling, making the code more concise and straightforward
* chore: Update dependent package versions
Update the following dependent package versions:
- camera_web has been upgraded from 0.3.5 to 0.3.5+3
- ffi has been upgraded from 2.1.4 to 2.1.5
- hive_ce_flutter is upgraded from 2.3.3 to 2.3.4
- watcher is upgraded from 1.1.4 to 1.2.1
* opt.
---------
Co-authored-by: lollipopkit🏳️⚧️ <10864310+lollipopkit@users.noreply.github.com>
* fix#757
* fix#757
* apply the code recommendations from sourcery ai
* Make sure raw is non-empty data
* Modified the way to judge gbk, fixed the problem that null cannot throw an error