Migrate to Tauri v2 and fix configuration issues
This commit is contained in:
parent
7b772bb1bb
commit
340ce3d834
12
package.json
12
package.json
@ -7,17 +7,19 @@
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview",
|
||||
"tauri": "tauri"
|
||||
"tauri": "tauri",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.4.0",
|
||||
"@tauri-apps/plugin-dialog": "^2.2.0",
|
||||
"@tauri-apps/plugin-opener": "^2",
|
||||
"@tauri-apps/api": "^2.0.0",
|
||||
"@tauri-apps/plugin-dialog": "^2.0.0",
|
||||
"@tauri-apps/plugin-fs": "^2.0.0",
|
||||
"@tauri-apps/plugin-shell": "^2.0.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^2",
|
||||
"@tauri-apps/cli": "^2.0.0",
|
||||
"@types/react": "^18.3.1",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
|
@ -1,48 +1,48 @@
|
||||
[package]
|
||||
name = "plugsnatcher"
|
||||
name = "app"
|
||||
version = "0.1.0"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
license = ""
|
||||
repository = ""
|
||||
edition = "2021"
|
||||
rust-version = "1.77.2"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
# The `_lib` suffix may seem redundant but it is necessary
|
||||
# to make the lib name unique and wouldn't conflict with the bin name.
|
||||
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
|
||||
name = "plugsnatcher_lib"
|
||||
name = "app_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
tauri-build = { version = "2.1.0", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri-plugin-opener = "2"
|
||||
tauri-plugin-dialog = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
zip = "0.6"
|
||||
yaml-rust = "0.4"
|
||||
# walkdir = "2.4" # Not currently used, commented out
|
||||
regex = "1.10" # Still needed elsewhere in the codebase
|
||||
sha2 = "0.10"
|
||||
reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false } # Updated version, enabled rustls
|
||||
# scraper = "0.19.0" # No longer used for SpigotMCCrawler
|
||||
urlencoding = "2.1.3" # Reverted version
|
||||
semver = "1.0"
|
||||
url = "2.5"
|
||||
futures = "0.3"
|
||||
async-trait = "0.1"
|
||||
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] } # Changed features from "full"
|
||||
# --- Add Caching Dependencies ---
|
||||
cached = { version = "0.52", features = ["proc_macro", "async", "tokio"] }
|
||||
async-mutex = "1.4" # For locking cache access within HttpClient
|
||||
# --- End Caching Dependencies ---
|
||||
base64 = "0.21" # For decoding SpigotMC changelog data
|
||||
walkdir = "2.5.0"
|
||||
# Tauri dependencies
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
log = "0.4"
|
||||
tauri = { version = "2.4.0", features = [] }
|
||||
tauri-plugin-log = "2.0.0-rc"
|
||||
tauri-plugin-shell = "~2.0"
|
||||
tauri-plugin-dialog = "~2.0"
|
||||
tauri-plugin-fs = "~2.0"
|
||||
|
||||
[features]
|
||||
# default = ["custom-protocol"]
|
||||
# Plugin scanner dependencies
|
||||
walkdir = "2.3.3"
|
||||
regex = "1.9.1"
|
||||
yaml-rust = "0.4.5"
|
||||
zip = "0.6.6"
|
||||
sha2 = "0.10.7"
|
||||
|
||||
# Network and async dependencies
|
||||
reqwest = { version = "0.11.18", features = ["json"] }
|
||||
tokio = { version = "1.29.1", features = ["full"] }
|
||||
futures = "0.3.28"
|
||||
async-trait = "0.1.71"
|
||||
cached = "0.44.0"
|
||||
urlencoding = "2.1.2"
|
||||
base64 = "0.21.2"
|
||||
|
||||
# Version management
|
||||
semver = "1.0.18"
|
||||
|
@ -1,12 +1,24 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"description": "Default capability set for the main window",
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"opener:default",
|
||||
"dialog:default",
|
||||
"dialog:allow-open"
|
||||
{ "identifier": "core:default" },
|
||||
{ "identifier": "dialog:default" },
|
||||
{ "identifier": "dialog:allow-open" },
|
||||
{ "identifier": "shell:default" },
|
||||
{ "identifier": "shell:allow-open" },
|
||||
{ "identifier": "fs:default" },
|
||||
{
|
||||
"identifier": "fs:allow-read-dir",
|
||||
"allow": ["**", "//**"]
|
||||
},
|
||||
{
|
||||
"identifier": "fs:allow-read-file",
|
||||
"allow": ["**", "//**"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -289,39 +289,51 @@ pub async fn lib_download_plugin_from_repository(
|
||||
}
|
||||
}
|
||||
|
||||
/// Configure and run the Tauri application
|
||||
// Tauri v2 plugin initialization
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
// Build the Tauri application
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
// Plugin discovery commands
|
||||
scan_server_dir,
|
||||
scan_server_dir_sync,
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.setup(|app| {
|
||||
if cfg!(debug_assertions) {
|
||||
app.handle().plugin(
|
||||
tauri_plugin_log::Builder::default()
|
||||
.level(log::LevelFilter::Info)
|
||||
.build(),
|
||||
)?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
// Plugin discovery commands
|
||||
scan_server_dir,
|
||||
scan_server_dir_sync,
|
||||
|
||||
// Plugin repository commands
|
||||
search_plugins,
|
||||
get_plugin_details,
|
||||
// Plugin repository commands
|
||||
search_plugins,
|
||||
get_plugin_details,
|
||||
|
||||
// Update commands
|
||||
update_plugin,
|
||||
check_plugin_updates,
|
||||
check_single_plugin_update_command,
|
||||
backup_plugin_command,
|
||||
// Update commands
|
||||
update_plugin,
|
||||
check_plugin_updates,
|
||||
check_single_plugin_update_command,
|
||||
backup_plugin_command,
|
||||
|
||||
// Plugin management commands
|
||||
download_plugin,
|
||||
set_plugin_repository,
|
||||
get_plugin_versions,
|
||||
load_plugin_data,
|
||||
save_plugin_data,
|
||||
// Plugin management commands
|
||||
download_plugin,
|
||||
set_plugin_repository,
|
||||
get_plugin_versions,
|
||||
load_plugin_data,
|
||||
save_plugin_data,
|
||||
|
||||
// Utility commands
|
||||
get_potential_plugin_matches,
|
||||
compare_versions,
|
||||
is_plugin_compatible,
|
||||
greet
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
// Utility commands
|
||||
get_potential_plugin_matches,
|
||||
compare_versions,
|
||||
is_plugin_compatible,
|
||||
greet
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
@ -2,5 +2,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
plugsnatcher_lib::run();
|
||||
app_lib::run();
|
||||
}
|
||||
|
@ -1,28 +1,31 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"identifier": "com.plugsnatcher.app",
|
||||
"productName": "PlugSnatcher",
|
||||
"version": "0.1.0",
|
||||
"identifier": "com.plugsnatcher.app",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
"devUrl": "http://localhost:1420",
|
||||
"beforeBuildCommand": "npm run build",
|
||||
"frontendDist": "../dist"
|
||||
"frontendDist": "../dist",
|
||||
"devUrl": "http://localhost:1420"
|
||||
},
|
||||
"app": {
|
||||
"security": {
|
||||
"csp": null
|
||||
},
|
||||
"windows": [
|
||||
{
|
||||
"label": "main",
|
||||
"title": "PlugSnatcher",
|
||||
"width": 1024,
|
||||
"height": 768,
|
||||
"minWidth": 800,
|
||||
"minHeight": 600,
|
||||
"resizable": true,
|
||||
"fullscreen": false,
|
||||
"center": true
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
@ -36,7 +39,10 @@
|
||||
]
|
||||
},
|
||||
"plugins": {
|
||||
"shell": {
|
||||
"open": true
|
||||
},
|
||||
"dialog": null,
|
||||
"opener": null
|
||||
"fs": null
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user