chore(platforms): seperating permissions and inits on different platforms
This commit is contained in:
861
frontend/src-tauri/Cargo.lock
generated
861
frontend/src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -30,9 +30,15 @@ chrono = "0.4"
|
||||
tauri-plugin-log = "2"
|
||||
tauri-plugin-sharetarget = "0.1.6"
|
||||
tauri-plugin-fs = "2"
|
||||
tauri-plugin-dialog = "2.2.1"
|
||||
tauri-plugin-opener = "2.2.6"
|
||||
tauri-plugin-sharetarget = "0.1.6"
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies]
|
||||
cocoa = "0.26"
|
||||
|
||||
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
||||
tauri-plugin-global-shortcut = "2.0.0-beta.12"
|
||||
|
||||
[target."cfg(target_os = \"android\")".dependencies]
|
||||
tauri-plugin-sharetarget = "0.1.6"
|
||||
|
@ -1,35 +0,0 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"core:window:allow-start-dragging",
|
||||
"http:default",
|
||||
"core:window:allow-show",
|
||||
"core:window:allow-set-focus",
|
||||
{
|
||||
"path": "$APPDATA/databases/*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"identifier": "http:default",
|
||||
"allow": [
|
||||
{
|
||||
"url": "https://haystack.johncosta.tech"
|
||||
},
|
||||
{
|
||||
"url": "http://localhost:3040"
|
||||
},
|
||||
{
|
||||
"url": "http://192.168.1.199:3040"
|
||||
}
|
||||
]
|
||||
},
|
||||
"log:default",
|
||||
"fs:default",
|
||||
"fs:default"
|
||||
]
|
||||
}
|
16
frontend/src-tauri/capabilities/desktop.toml
Normal file
16
frontend/src-tauri/capabilities/desktop.toml
Normal file
@ -0,0 +1,16 @@
|
||||
identifier = "Desktop"
|
||||
description = "Capabilities for desktop platforms"
|
||||
windows = ["main"]
|
||||
platforms = ["linux", "macOS", "windows"]
|
||||
|
||||
permissions = [
|
||||
"core:default",
|
||||
"core:window:allow-start-dragging",
|
||||
"fs:default",
|
||||
"http:default",
|
||||
{ identifier = "http:default", allow = [
|
||||
{ url = "https://haystack.johncosta.tech" },
|
||||
{ url = "http://localhost:3040" },
|
||||
{ url = "http://192.168.1.199:3040" }
|
||||
] },
|
||||
]
|
16
frontend/src-tauri/capabilities/mobile.toml
Normal file
16
frontend/src-tauri/capabilities/mobile.toml
Normal file
@ -0,0 +1,16 @@
|
||||
identifier = "Mobile"
|
||||
description = "Capabilities for mobile platforms"
|
||||
windows = ["main"]
|
||||
platforms = ["android", "iOS"]
|
||||
|
||||
permissions = [
|
||||
"core:default",
|
||||
"fs:default",
|
||||
"http:default",
|
||||
"sharetarget:default",
|
||||
{ identifier = "http:default", allow = [
|
||||
{ url = "https://haystack.johncosta.tech" },
|
||||
{ url = "http://localhost:3040" },
|
||||
{ url = "http://192.168.1.199:3040" }
|
||||
] },
|
||||
]
|
@ -8,13 +8,12 @@ mod window;
|
||||
use state::new_shared_watcher_state;
|
||||
use window::setup_window;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))]
|
||||
pub fn desktop() {
|
||||
let watcher_state = new_shared_watcher_state();
|
||||
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_log::Builder::new().build())
|
||||
.plugin(tauri_plugin_store::Builder::new().build())
|
||||
.plugin(tauri_plugin_http::init())
|
||||
.plugin(tauri_plugin_sharetarget::init())
|
||||
@ -38,3 +37,19 @@ pub fn run() {
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "ios", target_os = "android"))]
|
||||
pub fn android() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_store::Builder::new().build())
|
||||
.plugin(tauri_plugin_http::init())
|
||||
.plugin(tauri_plugin_sharetarget::init())
|
||||
.setup(|app| {
|
||||
setup_window(app)?;
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running android tauri application");
|
||||
}
|
||||
|
@ -2,5 +2,9 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
haystack_lib::run()
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))]
|
||||
haystack_lib::desktop();
|
||||
|
||||
#[cfg(any(target_os = "ios", target_os = "android"))]
|
||||
haystack_lib::android();
|
||||
}
|
||||
|
Reference in New Issue
Block a user