feat: update to tauri beta, add permissions (#862)

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@crabnebula.dev>
This commit is contained in:
Tillmann
2024-02-04 03:14:41 +09:00
committed by GitHub
parent 506ce4835b
commit d198c01486
387 changed files with 21883 additions and 943 deletions
+4 -4
View File
@@ -9,14 +9,14 @@ rust-version = { workspace = true }
links = "tauri-plugin-deep-link"
[package.metadata.docs.rs]
rustc-args = [ "--cfg", "docsrs" ]
rustdoc-args = [ "--cfg", "docsrs" ]
targets = [ "x86_64-linux-android" ]
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
targets = ["x86_64-linux-android"]
[build-dependencies]
serde = { workspace = true }
serde_json = { workspace = true }
tauri-build = { workspace = true }
tauri-plugin = { workspace = true, features = ["build"] }
[dependencies]
serde = { workspace = true }
+7 -5
View File
@@ -6,6 +6,8 @@
mod config;
use config::{AssociatedDomain, Config};
const COMMANDS: &[&str] = &["get_current"];
// TODO: Consider using activity-alias in case users may have multiple activities in their app.
// TODO: Do we want to support the other path* configs too?
fn intent_filter(domain: &AssociatedDomain) -> String {
@@ -30,9 +32,9 @@ fn intent_filter(domain: &AssociatedDomain) -> String {
}
fn main() {
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
if let Err(error) = tauri_plugin::Builder::new(COMMANDS)
.android_path("android")
.run()
.try_build()
{
println!("{error:#}");
if !(cfg!(docsrs) && std::env::var("TARGET").unwrap().contains("android")) {
@@ -40,8 +42,8 @@ fn main() {
}
}
if let Some(config) = tauri_build::config::plugin_config::<Config>("deep-link") {
tauri_build::mobile::update_android_manifest(
if let Some(config) = tauri_plugin::plugin_config::<Config>("deep-link") {
tauri_plugin::mobile::update_android_manifest(
"DEEP LINK PLUGIN",
"activity",
config
@@ -55,7 +57,7 @@ fn main() {
#[cfg(target_os = "macos")]
{
tauri_build::mobile::update_entitlements(|entitlements| {
tauri_plugin::mobile::update_entitlements(|entitlements| {
entitlements.insert(
"com.apple.developer.associated-domains".into(),
config
+3 -3
View File
@@ -10,13 +10,13 @@
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.13",
"@tauri-apps/api": "2.0.0-beta.0",
"@tauri-apps/plugin-deep-link": "2.0.0-alpha.4"
},
"devDependencies": {
"@tauri-apps/cli": "2.0.0-alpha.20",
"@tauri-apps/cli": "2.0.0-beta.0",
"internal-ip": "^8.0.0",
"typescript": "^5.2.2",
"vite": "^5.0.6"
"vite": "^5.0.12"
}
}
@@ -2,4 +2,6 @@
# will have compiled files and executables
/target/
/capabilities/schemas
.cargo
@@ -23,7 +23,7 @@ tauri = { workspace = true }
tauri-plugin-deep-link = { path = "../../../" }
[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
# this feature is used for production builds or when `devUrl` points to the filesystem and the built-in dev server is disabled.
# If you use cargo directly instead of tauri's cli you can use this feature flag to switch between tauri's `dev` and `build` modes.
# DO NOT REMOVE!!
custom-protocol = [ "tauri/custom-protocol" ]
@@ -2,8 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri::Manager;
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[tauri::command]
fn greet(name: &str) -> String {
@@ -15,7 +13,7 @@ pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_deep_link::init())
.setup(|app| {
app.listen_global("deep-link://new-url", |url| {
app.listen("deep-link://new-url", |url| {
dbg!(url);
});
Ok(())
@@ -29,8 +29,13 @@
},
"deep-link": {
"domains": [
{ "host": "fabianlars.de", "pathPrefix": ["/intent"] },
{ "host": "tauri.app" }
{
"host": "fabianlars.de",
"pathPrefix": ["/intent"]
},
{
"host": "tauri.app"
}
]
}
},
+1 -1
View File
@@ -24,6 +24,6 @@
"LICENSE"
],
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.13"
"@tauri-apps/api": "2.0.0-beta.0"
}
}
@@ -0,0 +1 @@
schemas/
+1
View File
@@ -0,0 +1 @@
schemas/
@@ -0,0 +1,13 @@
# Automatically generated - DO NOT EDIT!
"$schema" = "../../schemas/schema.json"
[[permission]]
identifier = "allow-get-current"
description = "Enables the get_current command without any pre-configured scope."
commands.allow = ["get_current"]
[[permission]]
identifier = "deny-get-current"
description = "Denies the get_current command without any pre-configured scope."
commands.deny = ["get_current"]
@@ -0,0 +1,14 @@
# Permissions
## allow-get-current
Enables the get_current command without any pre-configured scope.
## deny-get-current
Denies the get_current command without any pre-configured scope.
## default
Allows reading the opened deep link via the get_current command
@@ -0,0 +1,4 @@
"$schema" = "schemas/schema.json"
[default]
description = "Allows reading the opened deep link via the get_current command"
permissions = ["allow-get-current"]
+1 -1
View File
@@ -1 +1 @@
if("__TAURI__"in window){var __TAURI_PLUGIN_DEEPLINK__=function(e){"use strict";function n(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}async function r(e,n={},r){return window.__TAURI_INTERNALS__.invoke(e,n,r)}var t;async function _(e,t,_){return r("plugin:event|listen",{event:e,windowLabel:_?.target,handler:n(t)}).then((n=>async()=>async function(e,n){await r("plugin:event|unlisten",{event:e,eventId:n})}(e,n)))}async function i(){return await r("plugin:deep-link|get_current")}return"function"==typeof SuppressedError&&SuppressedError,function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled"}(t||(t={})),e.getCurrent=i,e.onOpenUrl=async function(e){const n=await i();return null!=n&&e(n),await _("deep-link://new-url",(n=>e(n.payload)))},e}({});Object.defineProperty(window.__TAURI__,"deepLink",{value:__TAURI_PLUGIN_DEEPLINK__})}
if("__TAURI__"in window){var __TAURI_PLUGIN_DEEPLINK__=function(e){"use strict";function n(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}async function t(e,n={},t){return window.__TAURI_INTERNALS__.invoke(e,n,t)}var r;async function _(e,r,_){const i="string"==typeof _?.target?{kind:"AnyLabel",label:_.target}:_?.target??{kind:"Any"};return t("plugin:event|listen",{event:e,target:i,handler:n(r)}).then((n=>async()=>async function(e,n){await t("plugin:event|unlisten",{event:e,eventId:n})}(e,n)))}async function i(){return await t("plugin:deep-link|get_current")}return"function"==typeof SuppressedError&&SuppressedError,function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WEBVIEW_CREATED="tauri://webview-created",e.WEBVIEW_FILE_DROP="tauri://file-drop",e.WEBVIEW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WEBVIEW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled"}(r||(r={})),e.getCurrent=i,e.onOpenUrl=async function(e){const n=await i();return null!=n&&e(n),await _("deep-link://new-url",(n=>e(n.payload)))},e}({});Object.defineProperty(window.__TAURI__,"deepLink",{value:__TAURI_PLUGIN_DEEPLINK__})}
+1
View File
@@ -43,6 +43,7 @@ fn init_deep_link<R: Runtime, C: DeserializeOwned>(
};
let _ = app_handle.emit("deep-link://new-url", vec![url]);
Ok(())
}),
},