From 50ab92d8f58075d9bb31c395efb8cd21bdb60347 Mon Sep 17 00:00:00 2001 From: "949036910@qq.com" <> Date: Wed, 27 May 2026 22:31:34 +0800 Subject: [PATCH] 11 --- src-tauri/src/app_config.rs | 2 +- src-tauri/src/lib.rs | 25 ++++++++++++++++++++++++- src-tauri/tauri.conf.json | 10 +--------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src-tauri/src/app_config.rs b/src-tauri/src/app_config.rs index 8bd40ea..df77461 100644 --- a/src-tauri/src/app_config.rs +++ b/src-tauri/src/app_config.rs @@ -43,7 +43,7 @@ pub fn api_base() -> String { "http://81.71.163.140:8001".to_string() } }) -} +} /// 将库表 `name` 转为 Node 环境变量名(不含前缀),如 `llm.api_key` → `LLM_API_KEY`。 pub fn normalize_config_key(name: &str) -> String { diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index af8c031..8a46931 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -29,8 +29,8 @@ pub mod oss; pub mod publish_db; pub mod publish_store; -use tauri::Manager; +use tauri::{Manager, WebviewUrl, WebviewWindowBuilder}; #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { let _ = env_logger::try_init(); @@ -45,6 +45,7 @@ pub fn run() { .manage(video_store::VideoStore::new()) .manage(publish_store::PublishStore::new()) .setup(|app| { + let handle = app.handle().clone(); let heartbeat_handle = handle.clone(); let oem_id = oem_id::load_oem_id(&handle); @@ -78,6 +79,28 @@ pub fn run() { .map_err(|e| -> Box { e.into() })?; api_client::spawn_heartbeat_loop(heartbeat_handle); + let url = if cfg!(debug_assertions) { + WebviewUrl::External( + "http://localhost:1420/" + .parse() + .unwrap() + ) + } else { + WebviewUrl::External( + "http://81.70.234.81/images/newyaoyan/index.html" + .parse() + .unwrap() + ) + }; + + WebviewWindowBuilder::new( + app, + "main", + url, + ) + .title("MyApp") + .build()?; + Ok(()) }) .plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| { diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index cb0be6a..f1258b6 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -12,15 +12,7 @@ "app": { "withGlobalTauri": true, "windows": [ - { - "label": "main", - "title": "aiclient", - "width": 800, - "height": 600, - "maximized": true, - "decorations": false, - "resizable": true - } + ], "security": { "csp": null,