Upgrade tauri to v2
This commit is contained in:
4097
src-tauri/Cargo.lock
generated
4097
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -12,14 +12,22 @@ edition = "2021"
|
||||
rust-version = "1.61"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1.5.5", features = [] }
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0.109"
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
tauri = { version = "1.8.0", features = ["api-all", "devtools", "updater"] }
|
||||
tauri-plugin-localhost = "0.1.0"
|
||||
tauri-plugin-window-state = "0.1.1"
|
||||
tauri = { version = "2", features = [ "devtools"] }
|
||||
tauri-plugin-localhost = "2"
|
||||
tauri-plugin-window-state = "2"
|
||||
tauri-plugin-clipboard-manager = "2"
|
||||
tauri-plugin-notification = "2"
|
||||
tauri-plugin-fs = "2"
|
||||
tauri-plugin-shell = "2"
|
||||
tauri-plugin-http = "2"
|
||||
tauri-plugin-process = "2"
|
||||
tauri-plugin-os = "2"
|
||||
tauri-plugin-dialog = "2"
|
||||
|
||||
[features]
|
||||
# by default Tauri runs in production mode
|
||||
@@ -28,3 +36,11 @@ default = [ "custom-protocol" ]
|
||||
# this feature is used used for production builds where `devPath` points to the filesystem
|
||||
# DO NOT remove this
|
||||
custom-protocol = [ "tauri/custom-protocol" ]
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||
tauri-plugin-global-shortcut = "2"
|
||||
tauri-plugin-updater = "2"
|
||||
|
||||
[lib]
|
||||
name = "app_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
tauri_build::build()
|
||||
}
|
||||
|
||||
15
src-tauri/capabilities/desktop.json
Normal file
15
src-tauri/capabilities/desktop.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"identifier": "desktop-capability",
|
||||
"platforms": [
|
||||
"macOS",
|
||||
"windows",
|
||||
"linux"
|
||||
],
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
"updater:default",
|
||||
"global-shortcut:default"
|
||||
]
|
||||
}
|
||||
82
src-tauri/capabilities/migrated.json
Normal file
82
src-tauri/capabilities/migrated.json
Normal file
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"identifier": "migrated",
|
||||
"description": "permissions that were migrated from v1",
|
||||
"local": true,
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"fs:allow-read-file",
|
||||
"fs:allow-write-file",
|
||||
"fs:allow-read-dir",
|
||||
"fs:allow-copy-file",
|
||||
"fs:allow-mkdir",
|
||||
"fs:allow-remove",
|
||||
"fs:allow-remove",
|
||||
"fs:allow-rename",
|
||||
"fs:allow-exists",
|
||||
"core:window:allow-create",
|
||||
"core:window:allow-center",
|
||||
"core:window:allow-request-user-attention",
|
||||
"core:window:allow-set-resizable",
|
||||
"core:window:allow-set-maximizable",
|
||||
"core:window:allow-set-minimizable",
|
||||
"core:window:allow-set-closable",
|
||||
"core:window:allow-set-title",
|
||||
"core:window:allow-maximize",
|
||||
"core:window:allow-unmaximize",
|
||||
"core:window:allow-minimize",
|
||||
"core:window:allow-unminimize",
|
||||
"core:window:allow-show",
|
||||
"core:window:allow-hide",
|
||||
"core:window:allow-close",
|
||||
"core:window:allow-set-decorations",
|
||||
"core:window:allow-set-always-on-top",
|
||||
"core:window:allow-set-content-protected",
|
||||
"core:window:allow-set-size",
|
||||
"core:window:allow-set-min-size",
|
||||
"core:window:allow-set-max-size",
|
||||
"core:window:allow-set-position",
|
||||
"core:window:allow-set-fullscreen",
|
||||
"core:window:allow-set-focus",
|
||||
"core:window:allow-set-icon",
|
||||
"core:window:allow-set-skip-taskbar",
|
||||
"core:window:allow-set-cursor-grab",
|
||||
"core:window:allow-set-cursor-visible",
|
||||
"core:window:allow-set-cursor-icon",
|
||||
"core:window:allow-set-cursor-position",
|
||||
"core:window:allow-set-ignore-cursor-events",
|
||||
"core:window:allow-start-dragging",
|
||||
"core:webview:allow-print",
|
||||
"shell:allow-execute",
|
||||
"shell:allow-open",
|
||||
"dialog:allow-open",
|
||||
"dialog:allow-save",
|
||||
"dialog:allow-message",
|
||||
"dialog:allow-ask",
|
||||
"dialog:allow-confirm",
|
||||
"http:default",
|
||||
"notification:default",
|
||||
"global-shortcut:allow-is-registered",
|
||||
"global-shortcut:allow-register",
|
||||
"global-shortcut:allow-register-all",
|
||||
"global-shortcut:allow-unregister",
|
||||
"global-shortcut:allow-unregister-all",
|
||||
"os:allow-platform",
|
||||
"os:allow-version",
|
||||
"os:allow-os-type",
|
||||
"os:allow-family",
|
||||
"os:allow-arch",
|
||||
"os:allow-exe-extension",
|
||||
"os:allow-locale",
|
||||
"os:allow-hostname",
|
||||
"process:allow-restart",
|
||||
"process:allow-exit",
|
||||
"clipboard-manager:allow-read-text",
|
||||
"clipboard-manager:allow-write-text",
|
||||
"core:app:allow-app-show",
|
||||
"core:app:allow-app-hide",
|
||||
"clipboard-manager: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 @@
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["updater:default","global-shortcut:default"],"platforms":["macOS","windows","linux"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","fs:allow-read-file","fs:allow-write-file","fs:allow-read-dir","fs:allow-copy-file","fs:allow-mkdir","fs:allow-remove","fs:allow-remove","fs:allow-rename","fs:allow-exists","core:window:allow-create","core:window:allow-center","core:window:allow-request-user-attention","core:window:allow-set-resizable","core:window:allow-set-maximizable","core:window:allow-set-minimizable","core:window:allow-set-closable","core:window:allow-set-title","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-set-decorations","core:window:allow-set-always-on-top","core:window:allow-set-content-protected","core:window:allow-set-size","core:window:allow-set-min-size","core:window:allow-set-max-size","core:window:allow-set-position","core:window:allow-set-fullscreen","core:window:allow-set-focus","core:window:allow-set-icon","core:window:allow-set-skip-taskbar","core:window:allow-set-cursor-grab","core:window:allow-set-cursor-visible","core:window:allow-set-cursor-icon","core:window:allow-set-cursor-position","core:window:allow-set-ignore-cursor-events","core:window:allow-start-dragging","core:webview:allow-print","shell:allow-execute","shell:allow-open","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","http:default","notification:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-register-all","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","os:allow-platform","os:allow-version","os:allow-os-type","os:allow-family","os:allow-arch","os:allow-exe-extension","os:allow-locale","os:allow-hostname","process:allow-restart","process:allow-exit","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text","core:app:allow-app-show","core:app:allow-app-hide","clipboard-manager:default"]}}
|
||||
6860
src-tauri/gen/schemas/desktop-schema.json
Normal file
6860
src-tauri/gen/schemas/desktop-schema.json
Normal file
File diff suppressed because it is too large
Load Diff
6860
src-tauri/gen/schemas/linux-schema.json
Normal file
6860
src-tauri/gen/schemas/linux-schema.json
Normal file
File diff suppressed because it is too large
Load Diff
61
src-tauri/src/lib.rs
Normal file
61
src-tauri/src/lib.rs
Normal file
@@ -0,0 +1,61 @@
|
||||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
// #[cfg(target_os = "macos")]
|
||||
// mod menu;
|
||||
|
||||
// use tauri::{webview::WebviewWindowBuilder, WebviewUrl};
|
||||
|
||||
// fn main() {
|
||||
// let port: u16 = 44548;
|
||||
|
||||
// let mut context = tauri::generate_context!();
|
||||
// let url = format!("http://localhost:{}", port).parse().unwrap();
|
||||
// let window_url = WebviewUrl::External(url);
|
||||
// // context.config_mut().build.frontend_dist = WebviewWindowBuilder::Url(window_url.clone());
|
||||
// // context.config_mut().build.dev_url = WebviewWindowBuilder::Url(window_url.clone());
|
||||
|
||||
// context.config_mut().build.frontend_dist = WebviewWindowBuilder::new(app, "Cinny", window_url.clone());
|
||||
// context.config_mut().build.dev_url = WebviewWindowBuilder::new(app, "Cinny", window_url.clone());
|
||||
// let builder = tauri::Builder::default();
|
||||
|
||||
// #[cfg(target_os = "macos")]
|
||||
// let builder = builder.menu(menu::menu());
|
||||
|
||||
// builder
|
||||
// .plugin(tauri_plugin_localhost::Builder::new(port).build())
|
||||
// .plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
// .run(context)
|
||||
// .expect("error while building tauri application")
|
||||
// }
|
||||
|
||||
use tauri::{webview::WebviewWindowBuilder, WebviewUrl};
|
||||
|
||||
pub fn run() {
|
||||
let port: u16 = 44548;
|
||||
let context = tauri::generate_context!();
|
||||
|
||||
let builder = tauri::Builder::default();
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
let builder = builder.menu(menu::menu());
|
||||
|
||||
builder
|
||||
.plugin(tauri_plugin_localhost::Builder::new(port).build())
|
||||
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
.setup(move |app| {
|
||||
let url = format!("http://localhost:{}", port).parse().unwrap();
|
||||
let window_url = WebviewUrl::External(url);
|
||||
|
||||
WebviewWindowBuilder::new(app, "main".to_string(), window_url)
|
||||
.title("Cinny")
|
||||
.build()?;
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.run(context)
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -1,30 +1,5 @@
|
||||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod menu;
|
||||
|
||||
use tauri::{utils::config::AppUrl, WindowUrl};
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
let port = 44548;
|
||||
|
||||
let mut context = tauri::generate_context!();
|
||||
let url = format!("http://localhost:{}", port).parse().unwrap();
|
||||
let window_url = WindowUrl::External(url);
|
||||
// rewrite the config so the IPC is enabled on this URL
|
||||
context.config_mut().build.dist_dir = AppUrl::Url(window_url.clone());
|
||||
context.config_mut().build.dev_path = AppUrl::Url(window_url.clone());
|
||||
let builder = tauri::Builder::default();
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
let builder = builder.menu(menu::menu());
|
||||
|
||||
builder
|
||||
.plugin(tauri_plugin_localhost::Builder::new(port).build())
|
||||
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
.run(context)
|
||||
.expect("error while building tauri application")
|
||||
}
|
||||
app_lib::run();
|
||||
}
|
||||
@@ -5,10 +5,7 @@ pub(crate) fn menu() -> Menu {
|
||||
.add_submenu(Submenu::new(
|
||||
"Cinny",
|
||||
Menu::new()
|
||||
.add_native_item(MenuItem::About(
|
||||
"Cinny".to_string(),
|
||||
AboutMetadata::new(),
|
||||
))
|
||||
.add_native_item(MenuItem::About("Cinny".to_string(), AboutMetadata::new()))
|
||||
.add_native_item(MenuItem::Separator)
|
||||
.add_native_item(MenuItem::Hide)
|
||||
.add_native_item(MenuItem::HideOthers)
|
||||
@@ -29,8 +26,7 @@ pub(crate) fn menu() -> Menu {
|
||||
))
|
||||
.add_submenu(Submenu::new(
|
||||
"View",
|
||||
Menu::new()
|
||||
.add_native_item(MenuItem::EnterFullScreen),
|
||||
Menu::new().add_native_item(MenuItem::EnterFullScreen),
|
||||
))
|
||||
.add_submenu(Submenu::new(
|
||||
"Window",
|
||||
@@ -38,4 +34,4 @@ pub(crate) fn menu() -> Menu {
|
||||
.add_native_item(MenuItem::Minimize)
|
||||
.add_native_item(MenuItem::Zoom),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,63 +1,65 @@
|
||||
{
|
||||
"package": {
|
||||
"productName": "Cinny",
|
||||
"version": "4.8.1"
|
||||
},
|
||||
"build": {
|
||||
"distDir": "../cinny/dist",
|
||||
"devPath": "http://localhost:8080",
|
||||
"beforeDevCommand": "cd cinny && npm start",
|
||||
"beforeBuildCommand": "cd cinny && npm run build"
|
||||
},
|
||||
"tauri": {
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"identifier": "in.cinny.app",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"resources": [],
|
||||
"externalBin": [],
|
||||
"copyright": "",
|
||||
"category": "SocialNetworking",
|
||||
"shortDescription": "Yet another matrix client",
|
||||
"longDescription": "",
|
||||
"deb": {
|
||||
"depends": []
|
||||
},
|
||||
"macOS": {
|
||||
"frameworks": [],
|
||||
"minimumSystemVersion": "",
|
||||
"exceptionDomain": "",
|
||||
"signingIdentity": null,
|
||||
"providerShortName": null,
|
||||
"entitlements": null
|
||||
},
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": "",
|
||||
"wix": {
|
||||
"bannerPath": "wix/banner.bmp",
|
||||
"dialogImagePath": "wix/dialogImage.bmp"
|
||||
}
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": "",
|
||||
"wix": {
|
||||
"bannerPath": "wix/banner.bmp",
|
||||
"dialogImagePath": "wix/dialogImage.bmp"
|
||||
}
|
||||
},
|
||||
"updater": {
|
||||
"active": true,
|
||||
"endpoints": [
|
||||
"https://github.com/cinnyapp/cinny-desktop/releases/download/tauri/release.json"
|
||||
],
|
||||
"dialog": true,
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE2NDc3NDBGMTAzNTk1NUYKUldSZmxUVVFEM1JIRnRuMjVRTkFOQ21lUFI5KzRMU0s4OWtBS1RNRUVCNE9LcE9GcExNZ2M2NHoK"
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"resources": [],
|
||||
"externalBin": [],
|
||||
"copyright": "",
|
||||
"category": "SocialNetworking",
|
||||
"shortDescription": "Yet another matrix client",
|
||||
"longDescription": "",
|
||||
"macOS": {
|
||||
"frameworks": [],
|
||||
"minimumSystemVersion": "",
|
||||
"exceptionDomain": "",
|
||||
"signingIdentity": null,
|
||||
"providerShortName": null,
|
||||
"entitlements": null
|
||||
},
|
||||
"allowlist": {
|
||||
"all": true
|
||||
"linux": {
|
||||
"deb": {
|
||||
"depends": []
|
||||
}
|
||||
},
|
||||
"createUpdaterArtifacts": "v1Compatible"
|
||||
},
|
||||
"build": {
|
||||
"beforeBuildCommand": "cd cinny && npm run build",
|
||||
"frontendDist": "../cinny/dist",
|
||||
"beforeDevCommand": "cd cinny && npm start",
|
||||
"devUrl": "http://localhost:8080"
|
||||
},
|
||||
"productName": "Cinny",
|
||||
"mainBinaryName": "Cinny",
|
||||
"version": "4.8.1",
|
||||
"identifier": "in.cinny.app",
|
||||
"plugins": {
|
||||
"updater": {
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE2NDc3NDBGMTAzNTk1NUYKUldSZmxUVVFEM1JIRnRuMjVRTkFOQ21lUFI5KzRMU0s4OWtBS1RNRUVCNE9LcE9GcExNZ2M2NHoK",
|
||||
"endpoints": [
|
||||
"https://github.com/cinnyapp/cinny-desktop/releases/download/tauri/release.json"
|
||||
]
|
||||
}
|
||||
},
|
||||
"app": {
|
||||
"security": {
|
||||
"csp": "script-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc: http://ipc.localhost"
|
||||
},
|
||||
"windows": [
|
||||
{
|
||||
@@ -67,11 +69,9 @@
|
||||
"center": true,
|
||||
"resizable": true,
|
||||
"fullscreen": false,
|
||||
"fileDropEnabled": false
|
||||
"dragDropEnabled": false,
|
||||
"useHttpsScheme": true
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": "script-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user