Upgrade Tauri 1.x to 2.x: fix config format + add plugins

This commit is contained in:
Warren
2026-06-30 10:28:35 +08:00
parent e45cb96d07
commit 8ac3177384
3 changed files with 39 additions and 69 deletions
+5 -2
View File
@@ -12,12 +12,15 @@ rust-version = "1.60"
[workspace] [workspace]
[build-dependencies] [build-dependencies]
tauri-build = { version = "1.5.6", features = [] } tauri-build = { version = "2.0", features = [] }
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } 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"] } tokio = { version = "1.0", features = ["full"] }
sysinfo = "0.30" sysinfo = "0.30"
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4", features = ["serde"] }
+3
View File
@@ -6,6 +6,9 @@ use commands::*;
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_http::init())
.plugin(tauri_plugin_shell::init())
.invoke_handler(tauri::generate_handler![ .invoke_handler(tauri::generate_handler![
get_tree, get_tree,
list_files, list_files,
+9 -45
View File
@@ -1,43 +1,18 @@
{ {
"$schema": "https://schema.tauri.app/config/2",
"productName": "Momentry Display Engine",
"version": "0.1.0",
"identifier": "com.momentry.markbase",
"build": { "build": {
"beforeBuildCommand": "cd src && npm run build", "beforeBuildCommand": "cd src && npm run build",
"beforeDevCommand": "cd src && npm run dev", "beforeDevCommand": "cd src && npm run dev",
"devPath": "http://localhost:5173", "devUrl": "http://localhost:5173",
"distDir": "../src/dist" "frontendDist": "../src/dist"
},
"package": {
"productName": "Momentry Display Engine",
"version": "0.1.0"
},
"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": { "bundle": {
"active": true, "active": true,
"category": "DeveloperTool", "category": "DeveloperTool",
"copyright": "Copyright © 2026 Momentry", "copyright": "Copyright © 2026 Momentry",
"deb": {
"depends": []
},
"externalBin": [],
"icon": [ "icon": [
"icons/32x32.png", "icons/32x32.png",
"icons/128x128.png", "icons/128x128.png",
@@ -45,7 +20,6 @@
"icons/icon.icns", "icons/icon.icns",
"icons/icon.ico" "icons/icon.ico"
], ],
"identifier": "com.momentry.markbase",
"longDescription": "Momentry Display Engine - A Tauri-based desktop application for MarkBase management", "longDescription": "Momentry Display Engine - A Tauri-based desktop application for MarkBase management",
"macOS": { "macOS": {
"entitlements": null, "entitlements": null,
@@ -54,21 +28,11 @@
"providerShortName": null, "providerShortName": null,
"signingIdentity": null "signingIdentity": null
}, },
"resources": ["../../data/**"],
"shortDescription": "Momentry Display Engine", "shortDescription": "Momentry Display Engine",
"targets": "all", "targets": "all"
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"security": {
"csp": null
},
"updater": {
"active": false
}, },
"app": {
"withGlobalTauri": false,
"windows": [ "windows": [
{ {
"fullscreen": false, "fullscreen": false,