Skip to content

Commit c81dfa9

Browse files
Replace tauri-plugin-shell with tauri-plugin-opener
Fixes #26
1 parent 95eb588 commit c81dfa9

11 files changed

Lines changed: 300 additions & 195 deletions

File tree

app/components/AboutModal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Button from "./Button";
22
import { Stack, Modal } from "react-bootstrap";
3-
import { open } from "@tauri-apps/plugin-shell";
3+
import { openUrl } from "@tauri-apps/plugin-opener";
44

55
export default function AboutModal({
66
show,
@@ -30,13 +30,13 @@ export default function AboutModal({
3030
<Modal.Footer className="flex-row-reverse">
3131
<Stack direction="horizontal" gap={2} className="w-100">
3232
<Button
33-
onClick={() => open("https://github.com/OpenFusionProject/")}
33+
onClick={() => openUrl("https://github.com/OpenFusionProject/")}
3434
variant="primary"
3535
icon="github fa-brands fa-xl"
3636
tooltip="Github Page"
3737
/>
3838
<Button
39-
onClick={() => open("https://discord.gg/DYavckB")}
39+
onClick={() => openUrl("https://discord.gg/DYavckB")}
4040
variant="primary"
4141
icon="discord fa-brands fa-lg"
4242
tooltip="Discord Chat"

app/components/LoginModal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { EndpointInfo, ServerEntry } from "@/app/types";
1111
import { validateUsername, validatePassword, validateEmail, getPrivacyPolicyUrlForServer } from "@/app/util";
1212
import { Overlay, Tooltip } from "react-bootstrap";
1313
import { invoke } from "@tauri-apps/api/core";
14-
import { open } from "@tauri-apps/plugin-shell";
14+
import { openUrl } from "@tauri-apps/plugin-opener";
1515
import { parse } from "marked";
1616
import DOMPurify from "dompurify";
1717
import get_seed from "@/app/seed";
@@ -32,7 +32,7 @@ const NO_EMAIL_DISCLAIMER = "Continue without entering an email address? If ther
3232

3333
const replaceLinksWithShellOpen = (html: string) => {
3434
return html.replace(/<a href="([^"]+)">([^<]+)<\/a>/g, (match, href, text) => {
35-
return `<a href="#" onclick="window.__TAURI__.shell.open('${href}'); return false;">${text}</a>`;
35+
return `<a href="#" onclick="window.__TAURI__.opener.openUrl('${href}'); return false;">${text}</a>`;
3636
});
3737
};
3838

@@ -345,7 +345,7 @@ export default function LoginModal({
345345
className="text-decoration-underline"
346346
onClick={() => {
347347
const url = getPrivacyPolicyUrlForServer(server!);
348-
open(url);
348+
openUrl(url);
349349
}}
350350
>
351351
privacy policy

app/components/Toast.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import _Toast from "react-bootstrap/Toast";
22
import { useState } from "react";
3-
import { open } from "@tauri-apps/plugin-shell";
3+
import { openUrl } from "@tauri-apps/plugin-opener";
44
import { Alert } from "@/app/types";
55
import { getHostnameFromLink, variantToLabel } from "@/app/util";
66
import Button from "./Button";
@@ -25,7 +25,7 @@ export default function Toast({ alert }: { alert: Alert }) {
2525
{alert.link && (
2626
<Button
2727
className="d-block w-100 mt-2"
28-
onClick={() => open(alert.link!)}
28+
onClick={() => openUrl(alert.link!)}
2929
variant="success"
3030
icon="arrow-up-right-from-square"
3131
text={getHostnameFromLink(alert.link)}

app/settings/ManageAccountModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Tabs, Tab } from "react-bootstrap";
33
import Button from "@/components/Button";
44
import { useEffect, useState } from "react";
55
import { invoke } from "@tauri-apps/api/core";
6-
import { open } from "@tauri-apps/plugin-shell";
6+
import { openUrl } from "@tauri-apps/plugin-opener";
77
import { AccountInfo, LoginSession, ServerEntry } from "@/app/types";
88
import { getPrivacyPolicyUrlForServer, validateEmail, validatePassword } from "@/app/util";
99

@@ -162,7 +162,7 @@ export default function ManageAccountModal({
162162
className="text-decoration-underline"
163163
onClick={() => {
164164
const url = getPrivacyPolicyUrlForServer(server!);
165-
open(url);
165+
openUrl(url);
166166
}}
167167
>
168168
privacy policy

0 commit comments

Comments
 (0)