Skip to content

Commit 32cdc46

Browse files
committed
fix: fix url open in browser issue
1 parent 7bc7e8b commit 32cdc46

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/components/NavigationPage.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ const isMacOs = computed(() => {
7575
})
7676
7777
const openLink = async (url: string) => {
78-
try {
79-
if (appStore.settings.app.open_links_in_browser || isMacOs.value) {
78+
if (appStore.settings.app.open_links_in_browser || isMacOs) {
79+
try {
8080
await TauriAPI.files.urlInBrowser(url)
81-
return
81+
} catch (error) {
82+
console.error('Failed to open link:', error)
8283
}
83-
} catch (error) {
84-
console.error('Failed to open link:', error)
84+
return
8585
}
8686
createNewWindow(url, `webview-${Date.now()}`, 'External Link')
8787
}

src/components/dashboard/DocumentationCard.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,13 @@ const urlMap = {
129129
}
130130
131131
const openLink = async (url: string) => {
132-
try {
133-
if (appStore.settings.app.open_links_in_browser || isMacOs) {
132+
if (appStore.settings.app.open_links_in_browser || isMacOs) {
133+
try {
134134
await TauriAPI.files.urlInBrowser(url)
135+
} catch (error) {
136+
console.error('Failed to open link:', error)
135137
}
136-
} catch (error) {
137-
console.error('Failed to open link:', error)
138+
return
138139
}
139140
createNewWindow(url, `webview-${Date.now()}`, 'External Link')
140141
}

src/components/dashboard/QuickActionsCard.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,13 @@ const toggleFirewallRule = async () => {
200200
}
201201
202202
const openLink = async (url: string) => {
203-
try {
204-
if (appStore.settings.app.open_links_in_browser || isMacOs) {
203+
if (appStore.settings.app.open_links_in_browser || isMacOs) {
204+
try {
205205
await TauriAPI.files.urlInBrowser(url)
206+
} catch (error) {
207+
console.error('Failed to open link:', error)
206208
}
207-
} catch (error) {
208-
console.error('Failed to open link:', error)
209+
return
209210
}
210211
createNewWindow(url, `webview-${Date.now()}`, 'External Link')
211212
}

0 commit comments

Comments
 (0)