fix: open URLs and directories properly again

migrate to tauri Opener plugin
This commit is contained in:
Maarten van Heusden
2025-09-09 17:07:02 +02:00
parent 3cdc627ea6
commit dad2daee4a
6 changed files with 40 additions and 12 deletions

View File

@@ -13,6 +13,7 @@
"dependencies": {
"@tauri-apps/api": "2.8.0",
"@tauri-apps/plugin-dialog": "2.4.0",
"@tauri-apps/plugin-opener": "~2.5.0",
"@tauri-apps/plugin-shell": "2.3.1",
"jquery": "^3.7.1"
},

10
pnpm-lock.yaml generated
View File

@@ -14,6 +14,9 @@ importers:
'@tauri-apps/plugin-dialog':
specifier: 2.4.0
version: 2.4.0
'@tauri-apps/plugin-opener':
specifier: ~2.5.0
version: 2.5.0
'@tauri-apps/plugin-shell':
specifier: 2.3.1
version: 2.3.1
@@ -447,6 +450,9 @@ packages:
'@tauri-apps/plugin-dialog@2.4.0':
resolution: {integrity: sha512-OvXkrEBfWwtd8tzVCEXIvRfNEX87qs2jv6SqmVPiHcJjBhSF/GUvjqUNIDmKByb5N8nvDqVUM7+g1sXwdC/S9w==}
'@tauri-apps/plugin-opener@2.5.0':
resolution: {integrity: sha512-B0LShOYae4CZjN8leiNDbnfjSrTwoZakqKaWpfoH6nXiJwt6Rgj6RnVIffG3DoJiKsffRhMkjmBV9VeilSb4TA==}
'@tauri-apps/plugin-shell@2.3.1':
resolution: {integrity: sha512-jjs2WGDO/9z2pjNlydY/F5yYhNsscv99K5lCmU5uKjsVvQ3dRlDhhtVYoa4OLDmktLtQvgvbQjCFibMl6tgGfw==}
@@ -1233,6 +1239,10 @@ snapshots:
dependencies:
'@tauri-apps/api': 2.8.0
'@tauri-apps/plugin-opener@2.5.0':
dependencies:
'@tauri-apps/api': 2.8.0
'@tauri-apps/plugin-shell@2.3.1':
dependencies:
'@tauri-apps/api': 2.8.0

View File

@@ -10,6 +10,23 @@
"shell:allow-open",
"dialog:default",
"shell:allow-execute",
"shell:allow-spawn"
"shell:allow-spawn",
"opener:allow-open-path",
{
"identifier": "opener:allow-open-path",
"allow": [
{
"path": "**"
}
]
},
{
"identifier": "opener:allow-open-url",
"allow": [
{
"url": "**"
}
]
}
]
}

View File

@@ -1,7 +1,7 @@
import $ from "jquery";
import {invoke} from "@tauri-apps/api/core";
import {open as openDialog} from "@tauri-apps/plugin-dialog";
import {open as openShell} from "@tauri-apps/plugin-shell";
import {openPath, openUrl} from '@tauri-apps/plugin-opener';
import {listen} from "@tauri-apps/api/event";
function setLoader(state: boolean) {
@@ -103,7 +103,7 @@ $(async () => {
console.log(`Checking path: ${downloadDirectory}`);
if (downloadDirectory != null) {
await openShell(downloadDirectory);
await openPath(downloadDirectory);
} else {
$("#checkpath").prop("ariaDisabled", true);
}
@@ -176,7 +176,7 @@ $(async () => {
});
$("#opium-btn").on("click", () => {
openShell("https://aphex.cc");
openUrl("https://l.aphex.cc/index.html");
});

View File

@@ -1,7 +1,7 @@
import {message} from "@tauri-apps/plugin-dialog";
import {invoke} from "@tauri-apps/api/core";
import {open} from "@tauri-apps/plugin-shell";
import $ from "jquery";
import {openUrl} from "@tauri-apps/plugin-opener";
$(async () => {
@@ -15,20 +15,20 @@ $(async () => {
}
/* eslint-enable indent */
//discord
// discord
$("#smbtn1").on("click", () => {
open("https://discord.com/invite/3qCt4DT5qe");
openUrl("https://discord.com/invite/3qCt4DT5qe");
});
// steamdb
$("#smbtn2").on("click", () => {
open("https://steamdb.info/instantsearch");
openUrl("https://steamdb.info/instantsearch");
});
// donate
$("#smbtn3").on("click", () => {
open("https://paypal.me/onderkin");
openUrl("https://paypal.me/onderkin");
});
// tutorial
$("#smbtn4").on("click", () => {
open("https://youtube.com/playlist?list=PLRAjc5plLScj967hnsYX-I3Vjw9C1v7Ca");
openUrl("https://youtube.com/playlist?list=PLRAjc5plLScj967hnsYX-I3Vjw9C1v7Ca");
});
});

View File

@@ -1,6 +1,6 @@
import {getVersion} from "@tauri-apps/api/app";
import {open} from "@tauri-apps/plugin-shell";
import $ from "jquery";
import {openUrl} from "@tauri-apps/plugin-opener";
$(async () => {
@@ -34,7 +34,7 @@ $(async () => {
console.log(await getVersion());
$("#version-info").on("click", async () => {
await open(`https://github.com/mmvanheusden/SteamDepotDownloaderGUI/releases/v${await getVersion()}`);
await openUrl(`https://github.com/mmvanheusden/SteamDepotDownloaderGUI/releases/v${await getVersion()}`);
});
});