From d4f8fff7af8c9cf842718b05d6104dac86392d39 Mon Sep 17 00:00:00 2001 From: Norbiros Date: Sun, 1 Sep 2024 23:56:53 +0200 Subject: [PATCH 1/2] fix(theseus): Posthog scripts, focus app when opening deeplink, update linux-schema (#2351) * fix(theseus): Focus app when opening deeplink (#2347) * fix(theseus): Allow for posthog scripts * chores(theseus): Update `linux-schema.json` --- apps/app/gen/schemas/linux-schema.json | 71 ++++++++++++++++++++++++-- apps/app/tauri.conf.json | 2 +- packages/app-lib/src/event/emit.rs | 8 ++- 3 files changed, 74 insertions(+), 7 deletions(-) diff --git a/apps/app/gen/schemas/linux-schema.json b/apps/app/gen/schemas/linux-schema.json index 2347d28ca..fb130beaf 100644 --- a/apps/app/gen/schemas/linux-schema.json +++ b/apps/app/gen/schemas/linux-schema.json @@ -299,6 +299,69 @@ }, "Identifier": { "oneOf": [ + { + "description": "ads:default -> Default plugin permissions.", + "type": "string", + "enum": [ + "ads:default" + ] + }, + { + "description": "ads:allow-hide-ads-window -> Enables the hide_ads_window command without any pre-configured scope.", + "type": "string", + "enum": [ + "ads:allow-hide-ads-window" + ] + }, + { + "description": "ads:allow-init-ads-window -> Enables the init_ads_window command without any pre-configured scope.", + "type": "string", + "enum": [ + "ads:allow-init-ads-window" + ] + }, + { + "description": "ads:allow-scroll-ads-window -> Enables the scroll_ads_window command without any pre-configured scope.", + "type": "string", + "enum": [ + "ads:allow-scroll-ads-window" + ] + }, + { + "description": "ads:allow-show-ads-window -> Enables the show_ads_window command without any pre-configured scope.", + "type": "string", + "enum": [ + "ads:allow-show-ads-window" + ] + }, + { + "description": "ads:deny-hide-ads-window -> Denies the hide_ads_window command without any pre-configured scope.", + "type": "string", + "enum": [ + "ads:deny-hide-ads-window" + ] + }, + { + "description": "ads:deny-init-ads-window -> Denies the init_ads_window command without any pre-configured scope.", + "type": "string", + "enum": [ + "ads:deny-init-ads-window" + ] + }, + { + "description": "ads:deny-scroll-ads-window -> Denies the scroll_ads_window command without any pre-configured scope.", + "type": "string", + "enum": [ + "ads:deny-scroll-ads-window" + ] + }, + { + "description": "ads:deny-show-ads-window -> Denies the show_ads_window command without any pre-configured scope.", + "type": "string", + "enum": [ + "ads:deny-show-ads-window" + ] + }, { "description": "auth:default -> Default plugin permissions.", "type": "string", @@ -2785,10 +2848,10 @@ ] }, { - "description": "jre:allow-set-java-versions -> Enables the set_java_versions command without any pre-configured scope.", + "description": "jre:allow-set-java-version -> Enables the set_java_version command without any pre-configured scope.", "type": "string", "enum": [ - "jre:allow-set-java-versions" + "jre:allow-set-java-version" ] }, { @@ -2834,10 +2897,10 @@ ] }, { - "description": "jre:deny-set-java-versions -> Denies the set_java_versions command without any pre-configured scope.", + "description": "jre:deny-set-java-version -> Denies the set_java_version command without any pre-configured scope.", "type": "string", "enum": [ - "jre:deny-set-java-versions" + "jre:deny-set-java-version" ] }, { diff --git a/apps/app/tauri.conf.json b/apps/app/tauri.conf.json index d28d2c411..42dde1d07 100644 --- a/apps/app/tauri.conf.json +++ b/apps/app/tauri.conf.json @@ -95,7 +95,7 @@ ], "img-src": "https: 'unsafe-inline' 'self' asset: http://asset.localhost blob: data:", "style-src": "'unsafe-inline' 'self'", - "script-src": "https://cmp.inmobi.com https://*.cloudflare.com 'self'", + "script-src": "https://cmp.inmobi.com https://*.cloudflare.com https://*.posthog.com 'self'", "frame-src": "https://*.cloudflare.com https://www.youtube.com https://www.youtube-nocookie.com https://discord.com 'self'" } } diff --git a/packages/app-lib/src/event/emit.rs b/packages/app-lib/src/event/emit.rs index 33c290e9d..86017cf10 100644 --- a/packages/app-lib/src/event/emit.rs +++ b/packages/app-lib/src/event/emit.rs @@ -9,7 +9,7 @@ use crate::event::{ }; use futures::prelude::*; #[cfg(feature = "tauri")] -use tauri::Emitter; +use tauri::{Emitter, Manager}; use uuid::Uuid; #[cfg(feature = "cli")] @@ -228,7 +228,7 @@ pub async fn emit_warning(message: &str) -> crate::Result<()> { // emit_command(CommandPayload::Something { something }) // ie: installing a pack, opening an .mrpack, etc -// Generally used for url deep links and file opens that we we want to handle in the frontend +// Generally used for url deep links and file opens that we want to handle in the frontend #[allow(dead_code)] #[allow(unused_variables)] pub async fn emit_command(command: CommandPayload) -> crate::Result<()> { @@ -240,6 +240,10 @@ pub async fn emit_command(command: CommandPayload) -> crate::Result<()> { .app .emit("command", command) .map_err(EventError::from)?; + + if let Some(window) = event_state.app.get_window("main") { + let _ = window.set_focus(); + } } Ok(()) } From 81b0922c93a4341bcd82db92208b7095a25301b2 Mon Sep 17 00:00:00 2001 From: Norbiros Date: Sun, 1 Sep 2024 23:57:13 +0200 Subject: [PATCH 2/2] chore(theseus): Updated Tauri links to v2 (#2345) --- apps/app-frontend/vite.config.ts | 4 ++-- apps/app/README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/app-frontend/vite.config.ts b/apps/app-frontend/vite.config.ts index fe9120d3c..3f88715a9 100644 --- a/apps/app-frontend/vite.config.ts +++ b/apps/app-frontend/vite.config.ts @@ -42,8 +42,8 @@ export default defineConfig({ port: 1420, strictPort: true, }, - // to make use of `TAURI_DEBUG` and other env variables - // https://tauri.studio/v1/api/config#buildconfig.beforedevcommand + // to make use of `TAURI_ENV_DEBUG` and other env variables + // https://v2.tauri.app/reference/environment-variables/#tauri-cli-hook-commands envPrefix: ['VITE_', 'TAURI_'], build: { // Tauri supports es2021 diff --git a/apps/app/README.md b/apps/app/README.md index ad45b2635..298a7dced 100644 --- a/apps/app/README.md +++ b/apps/app/README.md @@ -15,7 +15,7 @@ Before you begin, ensure you have the following installed on your machine: - [Node.js](https://nodejs.org/en/) - [pnpm](https://pnpm.io/) - [Rust](https://www.rust-lang.org/tools/install) -- [Tauri](https://tauri.app/v1/guides/getting-started/prerequisites/#installing) +- [Tauri](https://v2.tauri.app/start/prerequisites/) ### Setup