From 8ac31773842d221f080ec23c64af4a0fabb202a8 Mon Sep 17 00:00:00 2001 From: Warren Date: Tue, 30 Jun 2026 10:28:35 +0800 Subject: [PATCH] Upgrade Tauri 1.x to 2.x: fix config format + add plugins --- markbase-tauri/src-tauri/Cargo.toml | 7 +- markbase-tauri/src-tauri/src/main.rs | 5 +- markbase-tauri/src-tauri/tauri.conf.json | 96 ++++++++---------------- 3 files changed, 39 insertions(+), 69 deletions(-) diff --git a/markbase-tauri/src-tauri/Cargo.toml b/markbase-tauri/src-tauri/Cargo.toml index 0fb4e02..3532453 100644 --- a/markbase-tauri/src-tauri/Cargo.toml +++ b/markbase-tauri/src-tauri/Cargo.toml @@ -12,12 +12,15 @@ rust-version = "1.60" [workspace] [build-dependencies] -tauri-build = { version = "1.5.6", features = [] } +tauri-build = { version = "2.0", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.8.3", features = ["fs-all", "path-all", "http-all", "shell-all"] } +tauri = { version = "2.0", features = [] } +tauri-plugin-fs = "2.0" +tauri-plugin-http = "2.0" +tauri-plugin-shell = "2.0" tokio = { version = "1.0", features = ["full"] } sysinfo = "0.30" chrono = { version = "0.4", features = ["serde"] } diff --git a/markbase-tauri/src-tauri/src/main.rs b/markbase-tauri/src-tauri/src/main.rs index 0570388..7d122fb 100644 --- a/markbase-tauri/src-tauri/src/main.rs +++ b/markbase-tauri/src-tauri/src/main.rs @@ -6,6 +6,9 @@ use commands::*; fn main() { tauri::Builder::default() + .plugin(tauri_plugin_fs::init()) + .plugin(tauri_plugin_http::init()) + .plugin(tauri_plugin_shell::init()) .invoke_handler(tauri::generate_handler![ get_tree, list_files, @@ -59,4 +62,4 @@ fn main() { ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); -} +} \ No newline at end of file diff --git a/markbase-tauri/src-tauri/tauri.conf.json b/markbase-tauri/src-tauri/tauri.conf.json index dd692b4..9981a3d 100644 --- a/markbase-tauri/src-tauri/tauri.conf.json +++ b/markbase-tauri/src-tauri/tauri.conf.json @@ -1,74 +1,38 @@ { + "$schema": "https://schema.tauri.app/config/2", + "productName": "Momentry Display Engine", + "version": "0.1.0", + "identifier": "com.momentry.markbase", "build": { "beforeBuildCommand": "cd src && npm run build", "beforeDevCommand": "cd src && npm run dev", - "devPath": "http://localhost:5173", - "distDir": "../src/dist" + "devUrl": "http://localhost:5173", + "frontendDist": "../src/dist" }, - "package": { - "productName": "Momentry Display Engine", - "version": "0.1.0" + "bundle": { + "active": true, + "category": "DeveloperTool", + "copyright": "Copyright © 2026 Momentry", + "icon": [ + "icons/32x32.png", + "icons/128x128.png", + "icons/128x128@2x.png", + "icons/icon.icns", + "icons/icon.ico" + ], + "longDescription": "Momentry Display Engine - A Tauri-based desktop application for MarkBase management", + "macOS": { + "entitlements": null, + "exceptionDomain": "", + "frameworks": [], + "providerShortName": null, + "signingIdentity": null + }, + "shortDescription": "Momentry Display Engine", + "targets": "all" }, - "tauri": { - "allowlist": { - "all": false, - "fs": { - "all": true, - "scope": ["$RESOURCE/**", "$APPDATA/**", "$HOME/**"] - }, - "path": { - "all": true - }, - "http": { - "all": true, - "request": true, - "scope": ["http://localhost:11438/**", "http://localhost:11439/**"] - }, - "shell": { - "all": true, - "execute": true, - "open": true - } - }, - "bundle": { - "active": true, - "category": "DeveloperTool", - "copyright": "Copyright © 2026 Momentry", - "deb": { - "depends": [] - }, - "externalBin": [], - "icon": [ - "icons/32x32.png", - "icons/128x128.png", - "icons/128x128@2x.png", - "icons/icon.icns", - "icons/icon.ico" - ], - "identifier": "com.momentry.markbase", - "longDescription": "Momentry Display Engine - A Tauri-based desktop application for MarkBase management", - "macOS": { - "entitlements": null, - "exceptionDomain": "", - "frameworks": [], - "providerShortName": null, - "signingIdentity": null - }, - "resources": ["../../data/**"], - "shortDescription": "Momentry Display Engine", - "targets": "all", - "windows": { - "certificateThumbprint": null, - "digestAlgorithm": "sha256", - "timestampUrl": "" - } - }, - "security": { - "csp": null - }, - "updater": { - "active": false - }, + "app": { + "withGlobalTauri": false, "windows": [ { "fullscreen": false, @@ -80,4 +44,4 @@ } ] } -} +} \ No newline at end of file