Merge pull request #249 from PastaPastaPasta/feat/tauri-v2-support

feat: upgrade to tauri 2.0
This commit is contained in:
Igor Katson 2024-10-02 21:08:32 +01:00 committed by GitHub
commit 6fffe6d90b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 965 additions and 575 deletions

1452
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,8 @@
"": {
"name": "rqbit",
"dependencies": {
"@tauri-apps/api": "^1.5.1",
"@tauri-apps/api": "^2.0.1",
"@tauri-apps/plugin-shell": "^2.0.0",
"lodash.debounce": "^4.0.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
@ -1058,14 +1059,10 @@
}
},
"node_modules/@tauri-apps/api": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-1.6.0.tgz",
"integrity": "sha512-rqI++FWClU5I2UBp4HXFvl+sBWkdigBkxnpJDQUWttNyG7IZP4FwQGhTNL5EOw0vI8i6eSAJ5frLqO7n7jbJdg==",
"engines": {
"node": ">= 14.6.0",
"npm": ">= 6.6.0",
"yarn": ">= 1.19.1"
},
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.0.1.tgz",
"integrity": "sha512-eoQWT+Tq1qSwQpHV+nw1eNYe5B/nm1PoRjQCRiEOS12I1b+X4PUcREfXVX8dPcBT6GrzWGDtaecY0+1p0Rfqlw==",
"license": "Apache-2.0 OR MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/tauri"
@ -1259,6 +1256,15 @@
"node": ">= 10"
}
},
"node_modules/@tauri-apps/plugin-shell": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-shell/-/plugin-shell-2.0.0.tgz",
"integrity": "sha512-OpW2+ycgJLrEoZityWeWYk+6ZWP9VyiAfbO+N/O8VfLkqyOym8kXh7odKDfINx9RAotkSGBtQM4abyKfJDkcUg==",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@tauri-apps/api": "^2.0.0"
}
},
"node_modules/@types/babel__core": {
"version": "7.20.5",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",

View file

@ -9,7 +9,8 @@
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "^1.5.1",
"@tauri-apps/api": "^2.0.1",
"@tauri-apps/plugin-shell": "^2.0.0",
"lodash.debounce": "^4.0.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",

View file

@ -10,10 +10,10 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "1.5", features = [] }
tauri-build = { version = "2", features = [] }
[dependencies]
tauri = { version = "1.6.7", features = ["shell-open"] }
tauri = { version = "2", features = [] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
librqbit = { path = "../../crates/librqbit", features = [
@ -32,6 +32,7 @@ tracing = "0.1"
serde_with = "3.4.0"
parking_lot = "0.12.1"
gethostname = "0.5.0"
tauri-plugin-shell = "2"
[features]
# this feature is used for production builds or when `devPath` points to the filesystem

View file

@ -391,6 +391,7 @@ async fn start() {
let state = State::new(init_logging_result).await;
tauri::Builder::default()
.plugin(tauri_plugin_shell::init())
.manage(state)
.invoke_handler(tauri::generate_handler![
torrents_list,

View file

@ -2,35 +2,25 @@
"build": {
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build",
"devPath": "http://localhost:1420",
"distDir": "../dist"
"frontendDist": "../dist",
"devUrl": "http://localhost:1420"
},
"package": {
"productName": "rqbit-desktop"
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
},
"tauri": {
"allowlist": {
"all": false,
"shell": {
"all": false,
"open": true
}
},
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.rqbit.desktop",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
},
"security": {
"csp": null
},
"productName": "rqbit-desktop",
"mainBinaryName": "rqbit-desktop",
"identifier": "com.rqbit.desktop",
"plugins": {},
"app": {
"windows": [
{
"fullscreen": false,
@ -39,6 +29,9 @@
"width": 1024,
"height": 600
}
]
],
"security": {
"csp": null
}
}
}
}

View file

@ -9,7 +9,7 @@ import {
SessionStats,
} from "rqbit-webui/src/api-types";
import { InvokeArgs, invoke } from "@tauri-apps/api/tauri";
import { InvokeArgs, invoke } from "@tauri-apps/api/core";
interface InvokeErrorResponse {
error_kind: string;

View file

@ -1,6 +1,6 @@
import { StrictMode } from "react";
import ReactDOM from "react-dom/client";
import { invoke } from "@tauri-apps/api";
import { invoke } from "@tauri-apps/api/core";
import { CurrentDesktopState, RqbitDesktopConfig } from "./configuration";
import { RqbitDesktop } from "./rqbit-desktop";
import "./styles/index.css";