Update tauri to 2.0
This commit is contained in:
parent
007246da68
commit
cb3d1e6be1
9 changed files with 5362 additions and 724 deletions
1889
src-tauri/Cargo.lock
generated
1889
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -8,7 +8,7 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "1", features = [] }
|
tauri-build = { version = "2", features = [] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = { version = "1.0", features = [] }
|
anyhow = { version = "1.0", features = [] }
|
||||||
|
@ -18,7 +18,8 @@ r621 = "0.2"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
simplelog = "0.12"
|
simplelog = "0.12"
|
||||||
tauri = { version = "1", features = ["shell-open"] }
|
tauri = { version = "2", features = [] }
|
||||||
|
tauri-plugin-shell = "2"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
tokio = { version = "1.35", features = ["full"] }
|
tokio = { version = "1.35", features = ["full"] }
|
||||||
|
|
||||||
|
|
13
src-tauri/capabilities/migrated.json
Normal file
13
src-tauri/capabilities/migrated.json
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"identifier": "migrated",
|
||||||
|
"description": "permissions that were migrated from v1",
|
||||||
|
"local": true,
|
||||||
|
"windows": [
|
||||||
|
"main"
|
||||||
|
],
|
||||||
|
"permissions": [
|
||||||
|
"core:default",
|
||||||
|
"shell:allow-open",
|
||||||
|
"shell:default"
|
||||||
|
]
|
||||||
|
}
|
1
src-tauri/gen/schemas/acl-manifests.json
Normal file
1
src-tauri/gen/schemas/acl-manifests.json
Normal file
File diff suppressed because one or more lines are too long
1
src-tauri/gen/schemas/capabilities.json
Normal file
1
src-tauri/gen/schemas/capabilities.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","shell:allow-open","shell:default"]}}
|
2054
src-tauri/gen/schemas/desktop-schema.json
Normal file
2054
src-tauri/gen/schemas/desktop-schema.json
Normal file
File diff suppressed because it is too large
Load diff
2054
src-tauri/gen/schemas/linux-schema.json
Normal file
2054
src-tauri/gen/schemas/linux-schema.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -2,13 +2,16 @@
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||||
|
|
||||||
use r621::client::{Authentication, Client};
|
use r621::client::{Authentication, Client};
|
||||||
|
use r621::prelude::Post;
|
||||||
|
use std::sync::Arc;
|
||||||
use tauri::State;
|
use tauri::State;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use std::sync::Arc;
|
|
||||||
use r621::prelude::Post;
|
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn get_posts(query: Option<String>, arcmut_esix_client: State<'_, Arc<Mutex<Client>>>) -> anyhow::Result<Vec<Post>, String> {
|
async fn get_posts(
|
||||||
|
query: Option<String>,
|
||||||
|
arcmut_esix_client: State<'_, Arc<Mutex<Client>>>,
|
||||||
|
) -> anyhow::Result<Vec<Post>, String> {
|
||||||
let mut esix_client = arcmut_esix_client.lock().await;
|
let mut esix_client = arcmut_esix_client.lock().await;
|
||||||
match esix_client.list_posts(None, query, None).await {
|
match esix_client.list_posts(None, query, None).await {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
|
@ -22,7 +25,10 @@ async fn get_posts(query: Option<String>, arcmut_esix_client: State<'_, Arc<Mute
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn get_post(post_id: u64, arcmut_esix_client: State<'_, Arc<Mutex<Client>>>) -> anyhow::Result<Post, String> {
|
async fn get_post(
|
||||||
|
post_id: u64,
|
||||||
|
arcmut_esix_client: State<'_, Arc<Mutex<Client>>>,
|
||||||
|
) -> anyhow::Result<Post, String> {
|
||||||
let mut esix_client = arcmut_esix_client.lock().await;
|
let mut esix_client = arcmut_esix_client.lock().await;
|
||||||
match esix_client.get_post(post_id).await {
|
match esix_client.get_post(post_id).await {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
|
@ -40,16 +46,16 @@ async fn main() {
|
||||||
let user_agent = "eSixClient/1.0 (by pixelhunter on e621)";
|
let user_agent = "eSixClient/1.0 (by pixelhunter on e621)";
|
||||||
let auth = Authentication::Authorized {
|
let auth = Authentication::Authorized {
|
||||||
username: "pixelhunter",
|
username: "pixelhunter",
|
||||||
apikey: "P4pzvnfLSjhQdgCmMfZ8HwUy"
|
apikey: "P4pzvnfLSjhQdgCmMfZ8HwUy",
|
||||||
};
|
};
|
||||||
|
|
||||||
let esix_client = Client::new(auth, user_agent).expect("Could not create esix client");
|
let esix_client = Client::new(auth, user_agent).expect("Could not create esix client");
|
||||||
let arcmut_esix_client = Arc::new(Mutex::new(esix_client));
|
let arcmut_esix_client = Arc::new(Mutex::new(esix_client));
|
||||||
|
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.plugin(tauri_plugin_shell::init())
|
||||||
.invoke_handler(tauri::generate_handler![get_posts, get_post])
|
.invoke_handler(tauri::generate_handler![get_posts, get_post])
|
||||||
.manage(arcmut_esix_client.clone())
|
.manage(arcmut_esix_client.clone())
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,25 +2,12 @@
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "pnpm dev",
|
"beforeDevCommand": "pnpm dev",
|
||||||
"beforeBuildCommand": "pnpm build",
|
"beforeBuildCommand": "pnpm build",
|
||||||
"devPath": "http://localhost:1420",
|
"frontendDist": "../dist",
|
||||||
"distDir": "../dist"
|
"devUrl": "http://localhost:1420"
|
||||||
},
|
|
||||||
"package": {
|
|
||||||
"productName": "esix-client",
|
|
||||||
"version": "0.0.0"
|
|
||||||
},
|
|
||||||
"tauri": {
|
|
||||||
"allowlist": {
|
|
||||||
"all": false,
|
|
||||||
"shell": {
|
|
||||||
"all": false,
|
|
||||||
"open": true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": "all",
|
||||||
"identifier": "com.tauri.dev",
|
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/32x32.png",
|
"icons/32x32.png",
|
||||||
"icons/128x128.png",
|
"icons/128x128.png",
|
||||||
|
@ -29,9 +16,12 @@
|
||||||
"icons/icon.ico"
|
"icons/icon.ico"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"security": {
|
"productName": "esix-client",
|
||||||
"csp": null
|
"mainBinaryName": "esix-client",
|
||||||
},
|
"version": "0.0.0",
|
||||||
|
"identifier": "de.dhalucario.esix-client",
|
||||||
|
"plugins": {},
|
||||||
|
"app": {
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"fullscreen": false,
|
"fullscreen": false,
|
||||||
|
@ -40,6 +30,9 @@
|
||||||
"width": 800,
|
"width": 800,
|
||||||
"height": 600
|
"height": 600
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"security": {
|
||||||
|
"csp": null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue