diff --git a/easytier-gui/src-tauri/src/lib.rs b/easytier-gui/src-tauri/src/lib.rs index 0fa1a01..089a18d 100644 --- a/easytier-gui/src-tauri/src/lib.rs +++ b/easytier-gui/src-tauri/src/lib.rs @@ -8,7 +8,8 @@ use easytier::proto::api::manage::{ WebClientServiceClientFactory, }; use easytier::rpc_service::remote_client::{ - ListNetworkInstanceIdsJsonResp, ListNetworkProps, RemoteClientManager, Storage, + GetNetworkMetasResponse, ListNetworkInstanceIdsJsonResp, ListNetworkProps, RemoteClientManager, + Storage, }; use easytier::{ common::config::{ConfigLoader, FileLoggerConfig, LoggingConfigBuilder, TomlConfigLoader}, @@ -249,6 +250,19 @@ fn load_configs(configs: Vec, enabled_networks: Vec) -> R Ok(()) } +#[tauri::command] +async fn get_network_metas( + app: AppHandle, + instance_ids: Vec, +) -> Result { + CLIENT_MANAGER + .get() + .unwrap() + .handle_get_network_metas(app, instance_ids) + .await + .map_err(|e| e.to_string()) +} + #[cfg(not(target_os = "android"))] fn toggle_window_visibility(app: &tauri::AppHandle) { if let Some(window) = app.get_webview_window("main") { @@ -667,6 +681,7 @@ pub fn run() { validate_config, get_config, load_configs, + get_network_metas, ]) .on_window_event(|_win, event| match event { #[cfg(not(target_os = "android"))] diff --git a/easytier-gui/src/auto-imports.d.ts b/easytier-gui/src/auto-imports.d.ts index 65e9849..21da4e5 100644 --- a/easytier-gui/src/auto-imports.d.ts +++ b/easytier-gui/src/auto-imports.d.ts @@ -27,6 +27,7 @@ declare global { const getCurrentInstance: typeof import('vue')['getCurrentInstance'] const getCurrentScope: typeof import('vue')['getCurrentScope'] const getEasytierVersion: typeof import('./composables/backend')['getEasytierVersion'] + const getNetworkMetas: typeof import('./composables/backend')['getNetworkMetas'] const h: typeof import('vue')['h'] const initMobileVpnService: typeof import('./composables/mobile_vpn')['initMobileVpnService'] const inject: typeof import('vue')['inject'] @@ -139,6 +140,7 @@ declare module 'vue' { readonly getCurrentInstance: UnwrapRef readonly getCurrentScope: UnwrapRef readonly getEasytierVersion: UnwrapRef + readonly getNetworkMetas: UnwrapRef readonly h: UnwrapRef readonly initMobileVpnService: UnwrapRef readonly inject: UnwrapRef diff --git a/easytier-gui/src/composables/backend.ts b/easytier-gui/src/composables/backend.ts index 1543aa2..c1c5da6 100644 --- a/easytier-gui/src/composables/backend.ts +++ b/easytier-gui/src/composables/backend.ts @@ -1,5 +1,6 @@ import { invoke } from '@tauri-apps/api/core' import { Api, type NetworkTypes } from 'easytier-frontend-lib' +import { GetNetworkMetasResponse } from 'node_modules/easytier-frontend-lib/dist/modules/api' import { getAutoLaunchStatusAsync } from '~/modules/auto_launch' type NetworkConfig = NetworkTypes.NetworkConfig @@ -63,3 +64,7 @@ export async function sendConfigs() { let autoStartInstIds = getAutoLaunchStatusAsync() ? JSON.parse(localStorage.getItem('autoStartInstIds') || '[]') : [] return await invoke('load_configs', { configs: networkList, enabledNetworks: autoStartInstIds }) } + +export async function getNetworkMetas(instanceIds: string[]) { + return await invoke('get_network_metas', { instanceIds }) +} diff --git a/easytier-gui/src/modules/api.ts b/easytier-gui/src/modules/api.ts index 4868499..e212d4b 100644 --- a/easytier-gui/src/modules/api.ts +++ b/easytier-gui/src/modules/api.ts @@ -40,5 +40,8 @@ export class GUIRemoteClient implements Api.RemoteClient { return { error: e + "" }; } } + async get_network_metas(instance_ids: string[]): Promise { + return await backend.getNetworkMetas(instance_ids); + } } \ No newline at end of file diff --git a/easytier-web/frontend-lib/src/components/RemoteManagement.vue b/easytier-web/frontend-lib/src/components/RemoteManagement.vue index 433ba40..c94503a 100644 --- a/easytier-web/frontend-lib/src/components/RemoteManagement.vue +++ b/easytier-web/frontend-lib/src/components/RemoteManagement.vue @@ -1,5 +1,5 @@