This commit is contained in:
949036910@qq.com
2026-05-27 22:31:34 +08:00
parent 3641422037
commit 50ab92d8f5
3 changed files with 26 additions and 11 deletions

View File

@@ -29,8 +29,8 @@ pub mod oss;
pub mod publish_db; pub mod publish_db;
pub mod publish_store; pub mod publish_store;
use tauri::Manager;
use tauri::{Manager, WebviewUrl, WebviewWindowBuilder};
#[cfg_attr(mobile, tauri::mobile_entry_point)] #[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() { pub fn run() {
let _ = env_logger::try_init(); let _ = env_logger::try_init();
@@ -45,6 +45,7 @@ pub fn run() {
.manage(video_store::VideoStore::new()) .manage(video_store::VideoStore::new())
.manage(publish_store::PublishStore::new()) .manage(publish_store::PublishStore::new())
.setup(|app| { .setup(|app| {
let handle = app.handle().clone(); let handle = app.handle().clone();
let heartbeat_handle = handle.clone(); let heartbeat_handle = handle.clone();
let oem_id = oem_id::load_oem_id(&handle); let oem_id = oem_id::load_oem_id(&handle);
@@ -78,6 +79,28 @@ pub fn run() {
.map_err(|e| -> Box<dyn std::error::Error> { e.into() })?; .map_err(|e| -> Box<dyn std::error::Error> { e.into() })?;
api_client::spawn_heartbeat_loop(heartbeat_handle); 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(()) Ok(())
}) })
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| { .plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {

View File

@@ -12,15 +12,7 @@
"app": { "app": {
"withGlobalTauri": true, "withGlobalTauri": true,
"windows": [ "windows": [
{
"label": "main",
"title": "aiclient",
"width": 800,
"height": 600,
"maximized": true,
"decorations": false,
"resizable": true
}
], ],
"security": { "security": {
"csp": null, "csp": null,