1
1
mirror of https://github.com/neosubhamoy/neodlp.git synced 2026-03-22 15:05:48 +05:30

3 Commits

2 changed files with 28 additions and 3 deletions

View File

@@ -30,6 +30,14 @@
"clipboard-manager:allow-write-text", "clipboard-manager:allow-write-text",
"notification:default", "notification:default",
"log:default", "log:default",
{
"identifier": "fs:scope",
"allow": [
{
"path": "**"
}
]
},
{ {
"identifier": "opener:allow-open-path", "identifier": "opener:allow-open-path",
"allow": [ "allow": [
@@ -39,12 +47,20 @@
] ]
}, },
{ {
"identifier": "fs:scope", "identifier": "opener:allow-reveal-item-in-dir",
"allow": [ "allow": [
{ {
"path": "**" "path": "**"
} }
] ]
},
{
"identifier": "opener:allow-open-url",
"allow": [
{
"url": "https:*"
}
]
} }
] ]
} }

View File

@@ -15,6 +15,8 @@ import { invoke } from "@tauri-apps/api/core";
import { SlidingButton } from "@/components/custom/slidingButton"; import { SlidingButton } from "@/components/custom/slidingButton";
import clsx from "clsx"; import clsx from "clsx";
import { NumberInput } from "@/components/custom/numberInput"; import { NumberInput } from "@/components/custom/numberInput";
import { openUrl } from "@tauri-apps/plugin-opener";
import { useLogger } from "@/helpers/use-logger";
const websocketPortSchema = z.object({ const websocketPortSchema = z.object({
port: z.coerce.number<number>({ port: z.coerce.number<number>({
@@ -31,14 +33,21 @@ const websocketPortSchema = z.object({
}); });
function ExtInstallSettings() { function ExtInstallSettings() {
const openLink = async (url: string, app: string | null) => { const LOG = useLogger();
const openLink = async (url: string, app: string | undefined) => {
try { try {
await invoke('open_file_with_app', { filePath: url, appName: app }).then(() => { // await invoke('open_file_with_app', { filePath: url, appName: app }).then(() => {
// toast.info("Opening link", {
// description: `Opening link with ${app ? app : 'default app'}.`,
// })
// });
await openUrl(url, app).then(() => {
toast.info("Opening link", { toast.info("Opening link", {
description: `Opening link with ${app ? app : 'default app'}.`, description: `Opening link with ${app ? app : 'default app'}.`,
}) })
}); });
} catch (e) { } catch (e) {
LOG.error('NEODLP', `Failed to open link: ${e}`);
console.error(e); console.error(e);
toast.error("Failed to open link", { toast.error("Failed to open link", {
description: "An error occurred while trying to open the link.", description: "An error occurred while trying to open the link.",