Commit Graph
100 Commits
Author SHA1 Message Date
Tunglies 1f78d576a3 feat: migrate logs API from REST to IPC streaming (#4277)
* feat: migrate logs API from REST to IPC streaming

- Replace REST API `/logs` calls with IPC streaming implementation
- Add new `src-tauri/src/ipc/logs.rs` with `LogsMonitor` for real-time log streaming
- Implement duplicate stream prevention with level tracking
- Add frontend-backend communication via Tauri commands for log management
- Remove WebSocket compatibility, maintain IPC-only mode
- Fix duplicate monitoring task startup when toggling log service
- Add proper task lifecycle management with JoinHandle cleanup

* refactor: remove dead code from logs.rs to fix clippy warnings

- Remove unused `timestamp` field from LogItem struct
- Remove unused `client` field from LogsMonitor struct
- Remove unused methods: `is_fresh`, `get_current_monitoring_level`, `get_current_logs`
- Simplify LogsMonitor initialization by removing client dependency
- All clippy warnings with -D warnings now resolved

* refactor: extract duplicate fmt_bytes function to utils module

- Create new utils/format.rs module with fmt_bytes function
- Remove duplicate fmt_bytes implementations from traffic.rs and memory.rs
- Update imports to use shared utils::format::fmt_bytes
- Add comprehensive unit tests for fmt_bytes function
- Ensure DRY principle compliance and code maintainability
2025-07-30 23:11:21 +08:00
Tungliesandrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com> 4905b44c8a fix: resolve speed test functionality issue after IPC migration #4221, #4218 (#4228)
* chore(deps): update cargo dependencies

* fix: sysinfo crate use limit features

* fix: update headers-core dependency and kode-bridge version; enhance system monitor status validation

* fix: extend overall_status type in ISystemMonitorOverview to include 'healthy'

* refactor: update URL encoding strategy in IpcManager and cmdGetProxyDelay function

* fix: resolve speed test functionality issue after IPC migration

* fix: resolve speed test functionality issue after IPC migration #4221, #4218

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-27 02:07:00 +08:00
Tunglies 3048a2ae08 feat: Implement configuration caching mechanism and force-refresh feature**
✨ **New Features**:

* Added API and frontend support for forcibly refreshing Clash configuration cache
* Implemented a configuration cache TTL mechanism (60 seconds) to reduce redundant requests
* Introduced `ProxyRequestCache` system to manage backend data caching
* Automatically refresh frontend state after core operations to enhance user experience

🚀 **Performance Optimizations**:

* Increased Clash configuration refresh interval from 5 seconds to 60 seconds
* Force refresh cache after configuration updates to resolve data inconsistency
* Automatically trigger state refresh after core switch, start, stop, and restart actions

🔧 **Technical Improvements**:

* Removed unused dependencies: `ab_glyph`, `owned_ttf_parser`, `ttf-parser`
* Simplified WebSocket dependency management, unified `tungstenite` version
* Refactored configuration save validation process, improved merge file handling
* Improved error handling and overall user experience
2025-07-24 01:59:25 +08:00
Tunglies 15a1770ee9 feat: migrate mihomo to use kode-bridge IPC on Windows and Unix (#4051)
* Refactor Mihomo API integration and remove crate_mihomo_api

- Removed the `mihomo_api` crate and its dependencies from the project.
- Introduced `IpcManager` for handling IPC communication with Mihomo.
- Implemented IPC methods for managing proxies, connections, and configurations.
- Updated `MihomoManager` to utilize `IpcManager` instead of the removed crate.
- Added platform-specific IPC socket path handling for macOS, Linux, and Windows.
- Cleaned up related tests and configuration files.

* fix: remove duplicate permission entry in desktop capabilities

* refactor: replace MihomoManager with IpcManager and remove Mihomo module

* fix: restore tempfile dependency in dev-dependencies

* fix: update kode-bridge dependency to use git source from the dev branch

* feat: migrate mihomo to use kode-bridge IPC on Windows

This commit implements a comprehensive migration from legacy service IPC to the kode-bridge library for Windows IPC communication. Key changes include:

Replace service_ipc with kode-bridge IpcManager for all mihomo communications
Simplify proxy commands using new caching mechanism with ProxyRequestCache
Add Windows named pipe (\.\pipe\mihomo) and Unix socket IPC endpoint configuration
Update Tauri permissions and dependencies (dashmap, tauri-plugin-notification)
Add IPC logging support and improve error handling
Fix Windows IPC path handling in directory utilities
This migration enables better cross-platform IPC support and improved performance for mihomo proxy core communication.

* doc: add IPC communication with Mihomo kernel, removing Restful API dependency

* fix: standardize logging type naming from IPC to Ipc for consistency

* refactor: clean up and optimize code structure across multiple components and services

- Removed unnecessary comments and whitespace in various files.
- Improved code readability and maintainability by restructuring functions and components.
- Updated localization files for consistency and accuracy.
- Enhanced performance by optimizing hooks and utility functions.
- General code cleanup in settings, pages, and services to adhere to best practices.

* fix: simplify URL formatting in test_proxy_delay method

* fix: update kode-bridge dependency to version 0.1.3 and change source to crates.io

* fix: update macOS target versions in development workflow

* Revert "fix: update macOS target versions in development workflow"

This reverts commit b9831357e4.

* feat: enhance IPC path handling for Unix systems and improve directory safety checks

* feat: add conditional compilation for Unix-specific IPC path handling

* chore: update cagro.lock

* feat: add external controller configuration and UI support

* Refactor proxy and connection management to use IPC-based commands

- Updated `get_proxies` function in `proxy.rs` to call the new IPC command.
- Renamed `get_refresh_proxies` to `get_proxies` in `ipc/general.rs` for consistency.
- Added new IPC commands for managing proxies, connections, and configurations in `cmds.ts`.
- Refactored API calls in various components to use the new IPC commands instead of HTTP requests.
- Improved error handling and response management in the new IPC functions.
- Cleaned up unused API functions in `api.ts` and redirected relevant calls to `cmds.ts`.
- Enhanced connection management features including health checks and updates for proxy providers.

* chore: update dependencies and improve error handling in IPC manager

* fix: downgrade zip dependency from 4.3.0 to 4.2.0

* feat: Implement traffic and memory data monitoring service

- Added `TrafficService` and `TrafficManager` to manage traffic and memory data collection.
- Introduced commands to get traffic and memory data, start and stop the traffic service.
- Integrated IPC calls for traffic and memory data retrieval in the frontend.
- Updated `AppDataProvider` and `EnhancedTrafficStats` components to utilize new data fetching methods.
- Removed WebSocket connections for traffic and memory data, replaced with IPC polling.
- Added logging for better traceability of data fetching and service status.

* refactor: unify external controller handling and improve IPC path resolution

* fix: replace direct IPC path retrieval with guard function for external controller

* fix: convert external controller IPC path to string for proper insertion in config map

* fix: update dependencies and improve IPC response handling

* fix: remove unnecessary unix conditional for ipc path import

* Refactor traffic and memory monitoring to use IPC stream; remove TrafficService and TrafficManager. Introduce new IPC-based data retrieval methods for traffic and memory, including formatted data and system overview. Update frontend components to utilize new APIs for enhanced data display and management.

* chore: bump crate rand version to 0.9.2

* feat: Implement enhanced traffic monitoring system with data compression and sampling

- Introduced `useTrafficMonitorEnhanced` hook for advanced traffic data management.
- Added `TrafficDataSampler` class for handling raw and compressed traffic data.
- Implemented reference counting to manage data collection based on component usage.
- Enhanced data validation with `SystemMonitorValidator` for API responses.
- Created diagnostic tools for monitoring performance and error tracking.
- Updated existing hooks to utilize the new enhanced monitoring features.
- Added utility functions for generating and formatting diagnostic reports.

* feat(ipc): improve URL encoding and error handling for IPC requests

- Add percent-encoding for URL paths to handle special characters properly
- Enhance error handling in update_proxy with proper logging
- Remove excessive debug logging to reduce noise
- Update kode-bridge dependency to v0.1.5
- Fix JSON parsing error handling in PUT requests

Changes include:
- Proper URL encoding for connection IDs, proxy names, and test URLs
- Enhanced error handling with fallback responses in updateProxy
- Comment out verbose debug logs in traffic monitoring and data validation
- Update dependency version for improved IPC functionality

* feat: major improvements in architecture, traffic monitoring, and data validation

* Refactor traffic graph components: Replace EnhancedTrafficGraph with EnhancedCanvasTrafficGraph, improve rendering performance, and enhance visual elements. Remove deprecated code and ensure compatibility with global data management.

* chore: update UPDATELOG.md for v2.4.0 release, refine traffic monitoring system details, and enhance IPC functionality

* chore: update UPDATELOG.md to reflect removal of deprecated MihomoManager and unify IPC control

* refactor: remove global traffic service testing method from cmds.ts

* Update src/components/home/enhanced-canvas-traffic-graph.tsx

* Update src/hooks/use-traffic-monitor-enhanced.ts

* Update src/components/layout/layout-traffic.tsx

* refactor: remove debug state management from LayoutTraffic component

---------
2025-07-24 00:49:55 +08:00
wonfen 034885d810 feat: introduce event-driven proxy manager and optimize proxy config updates 2025-06-21 21:56:15 +08:00
wonfen ac7307b1f7 feat: enhance profile management and proxy refresh with improved event listening and state updates 2025-06-17 11:38:53 +08:00
Tunglies 1bcb6646c4 fix: unify default latency test URL and update workflows/backend logic
- All delay test logic, Rust MihomoManager, API, cmds, delay.ts, settings, and group editor now use the Cloudflare 204 test URL
- Fixed outdated URLs in docs and comments
- Fix Github Actions workflow: unexpected neeeds run
2025-06-02 14:07:54 +08:00
Tunglies d5c0b09a2f fix: update default latency test URL to use HTTPS 2025-06-02 12:41:41 +08:00
Tunglies 1ddbe7c2cc feat: add service uninstall functionality and improve service operation flow 2025-05-13 01:56:19 +08:00
Tunglies 5b6c9be99f feat: better service status and TUN mode usable checks in Setting Page 2025-05-12 19:04:21 +08:00
wonfen 8296675574 refactor: notification system 2025-05-04 22:17:08 +08:00
wonfen d6a79316a6 feat: toggle next auto-update time on subscription card click and show update result feedback 2025-04-25 17:17:34 +08:00
逐雁南飛 b70cad537c 添加代理主机的设置,允许代理设置为其他IP(非127.0.0.1) (#2963)
允许下拉选择ip地址(支持IPv6)、localhost、以及当前系统的主机名,同时兼容手工输入
2025-04-17 16:47:21 +08:00
wonfen 98be9621a6 feat: retry subscription fetch using Clash proxy on failure 2025-04-03 14:55:28 +08:00
wonfen 52a15bb281 feat: detect admin mode and warn about auto-start unavailability 2025-03-31 03:22:24 +08:00
Tunglies 7ede91599c fix: standardize RunningMode handling between frontend and backend
This commit improves the type consistency between the Rust backend and TypeScript frontend by:

1. Modifying the Rust `get_running_mode()` command to return a String instead of RunningMode enum directly
2. Removing the RunningMode enum and IRunningMode interface from TypeScript types
3. Using string literals for mode comparison in frontend components
4. Standardizing on capitalized mode names (e.g., "Sidecar" instead of "sidecar")

These changes ensure proper serialization/deserialization between backend and frontend,
making the code more maintainable and reducing potential inconsistencies.
2025-03-26 22:04:16 +08:00
Tunglies ca0cf4552c add: RunningMode Display implementation and TypeScript enum 2025-03-26 17:01:48 +08:00
Tunglies 1ace560531 feat: add front-end system service management functions 2025-03-26 16:22:13 +08:00
Tunglies 91ccb3045c feat: implement lightweight mode functionality and update related settings 2025-03-20 03:23:14 +08:00
wonfen 530669d288 fix: auto launch 2025-03-17 13:51:52 +08:00
wonfen 6239f81f36 feat: sync auto-start status 2025-03-17 09:48:44 +08:00
wonfen 1f99cee78b feat: home page 2025-03-14 13:31:34 +08:00
wonfen e1905aced4 feat: enhance latency test logging and error handling 2025-03-09 04:22:34 +08:00
0XE 7ea7ca1415 fix: issues #2838 (#2886) 2025-03-04 20:46:17 +08:00
wonfen 07bdc108ed feat: show service mode installation prompts in user mode 2025-03-03 14:42:31 +08:00
Tunglies aff504bddc feat: add export diagnostic info functionality (#2856) 2025-03-03 05:58:12 +08:00
wonfen d54ba48c11 feat: enhance script validation and error handling 2025-02-26 05:21:14 +08:00
Tunglies ebe0899eb1 perf: imporve clash mode switching performance on the main window (#2667) 2025-02-09 07:45:46 +08:00
huzibaca 52899d4def chore: remove unused code 2024-11-21 11:13:11 +08:00
huzibaca a89a828b35 fix: serde::json passing IVerge to the front end without deserialization 2024-11-21 06:01:56 +08:00
huzibaca 9ebd96611a refactor: logger fetch logic 2024-11-18 05:58:06 +08:00
huzibaca b5e0374946 feat: add webdav backup 2024-11-12 02:55:02 +08:00
huzibaca c22e4e5e2c chore: update 2024-11-08 21:46:15 +08:00
huzibaca 9b2b447b8b feat: Modify startup logic and install services by default 2024-10-10 00:34:36 +08:00
huzibaca a0b266fef8 fix: after importing a subscription, it cannot be automatically switched to the current subscription. 2024-09-13 18:17:14 +08:00
huzibaca 1b2509d5bc refactor: url scheme implementation 2024-09-13 03:21:55 +08:00
huzibaca 6cc81fe6b8 chore: update 2024-09-02 19:33:17 +08:00
MystiPanda 32edc0f1fe chore: remove unnecessary console log 2024-07-18 23:37:54 +08:00
MystiPanda f2372a13e8 fix: try to fix install service 2024-07-16 12:07:23 +08:00
MystiPanda 57fa48aef4 feat: display network interface 2024-07-13 14:15:13 +08:00
Avan 5a8e0749c2 feature: copy clash env (#1391)
* feat: copy clash env

* style: use ContentCopyRounded replace CopyAll
2024-07-13 01:03:46 +08:00
MystiPanda a865465514 feat: get network interface 2024-07-07 18:13:10 +08:00
Sukka 4f5227782a perf: replace Array#map Array#filter chain w/ Array#reduce (#1203) 2024-06-15 12:22:33 +08:00
MystiPanda a20d4959bf refactor: remove grant logic 2024-06-13 16:07:56 +08:00
MystiPanda b9ec94d835 feat: Support PAC Mode 2024-05-26 17:59:39 +08:00
MystiPanda 4a37e49798 feat: support ico format for tray icon (#911) 2024-04-22 20:43:15 +08:00
MystiPanda daf726ebbf feat: Try to cache remote images
#603
2024-03-15 16:43:39 +08:00
MystiPanda d214c8e01b feat: Allow open devtools 2024-03-11 20:19:21 +08:00
MystiPanda c2852c8a82 refactor: Optimize implementation of Custom tray icon 2024-02-24 11:25:22 +08:00
MystiPanda bf3a281987 fix: Config data display error
#417
2024-02-21 10:02:28 +08:00