Update to tauri v2

This commit is contained in:
Nicola Spadari
2024-06-16 02:29:59 +02:00
parent 93877e5f1f
commit 7b71c8bca9
14 changed files with 6114 additions and 1269 deletions

2112
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,13 +7,15 @@ license = "MIT"
repository = "https://github.com/NicolaSpadari/nuxtor"
edition = "2021"
[lib]
name = "nuxtor_lib"
crate-type = ["staticlib", "cdylib", "rlib", "lib"]
[build-dependencies]
tauri-build = { version = "1", features = [] }
tauri-build = { version = "2.0.0-beta", features = [] }
[dependencies]
tauri = { version = "1", features = ["notification-all", "shell-all", "system-tray"] }
tauri = { version = "2.0.0-beta", features = ["tray-icon"] }
tauri-plugin-shell = "2.0.0-beta"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
[features]
custom-protocol = [ "tauri/custom-protocol" ]

View File

@@ -0,0 +1,32 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "main",
"description": "Capabilities for the main window",
"windows": [
"main"
],
"permissions": [
"path:default",
"event:default",
"window:default",
"app:default",
"resources:default",
"menu:default",
{
"identifier": "shell:allow-execute",
"allow": [
{
"name": "exec-sh",
"cmd": "sh",
"args": [
"-c",
{
"validator": "\\S+"
}
],
"sidecar": false
}
]
}
]
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"main":{"identifier":"main","description":"Capabilities for the main window","local":true,"windows":["main"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default",{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]}]}}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

8
src-tauri/src/lib.rs Normal file
View File

@@ -0,0 +1,8 @@
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_shell::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

View File

@@ -1,28 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use tauri::{CustomMenuItem, SystemTray, SystemTrayMenu, SystemTrayEvent};
fn main() {
let opt_quit = CustomMenuItem::new("quit", "Quit");
let tray_menu = SystemTrayMenu::new()
.add_item(opt_quit);
let system_tray = SystemTray::new()
.with_menu(tray_menu);
tauri::Builder::default()
.system_tray(system_tray)
.on_system_tray_event(| _app, event | match event {
SystemTrayEvent::MenuItemClick { id, .. } => {
match id.as_str() {
"quit" => {
std::process::exit(0)
}
_ => {}
}
}
_ => {}
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
nuxtor_lib::run();
}

View File

@@ -1,79 +1,56 @@
{
"package": {
"productName": "nuxtor",
"version": "1.0.0"
"bundle": {
"active": true,
"targets": "all",
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
},
"build": {
"distDir": "../dist",
"devPath": "http://localhost:3000",
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm generate"
},
"tauri": {
"systemTray": {
"iconPath": "./icons/icon.png",
"iconAsTemplate": true
},
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.nicolaspadari.nuxtor",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [],
"externalBin": [],
"copyright": "",
"category": "DeveloperTool",
"shortDescription": "",
"longDescription": "",
"deb": {},
"macOS": {},
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"updater": {
"active": false
},
"allowlist": {
"shell": {
"all": true,
"open": true,
"scope": [
{
"name": "cmd",
"cmd": "cmd",
"args": ["/C", { "validator": "\\S+" }]
},
{
"name": "pwsh",
"cmd": "pwsh",
"args": ["-Command", { "validator": "\\S+" }]
}
]
},
"notification": {
"all": true
}
},
"windows": [
{
"title": "Nuxtor",
"width": 1920,
"height": 1080,
"resizable": true,
"fullscreen": false
}
],
"security": {
"csp": null
}
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [],
"externalBin": [],
"copyright": "",
"category": "DeveloperTool",
"shortDescription": "",
"longDescription": "",
"macOS": {},
"linux": {
"deb": {}
}
}
},
"build": {
"beforeBuildCommand": "pnpm generate",
"frontendDist": "../dist",
"beforeDevCommand": "pnpm dev",
"devUrl": "http://localhost:3000"
},
"productName": "nuxtor",
"version": "1.0.0",
"identifier": "com.nicolaspadari.nuxtor",
"plugins": {},
"app": {
"windows": [
{
"title": "Nuxtor",
"width": 1920,
"height": 1080,
"resizable": true,
"fullscreen": false
}
],
"security": {
"csp": null
},
"trayIcon": {
"iconPath": "./icons/icon.png",
"iconAsTemplate": true
}
}
}