aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers')
-rw-r--r--src/helpers/url-helpers.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/helpers/url-helpers.ts b/src/helpers/url-helpers.ts
index abe123577..ddbf4b4f7 100644
--- a/src/helpers/url-helpers.ts
+++ b/src/helpers/url-helpers.ts
@@ -6,8 +6,7 @@ import { shell } from 'electron';
6 6
7import { ALLOWED_PROTOCOLS } from '../config'; 7import { ALLOWED_PROTOCOLS } from '../config';
8 8
9// TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed 9const debug = require('../preload-safe-debug')('Ferdium:Helpers:url');
10// const debug = require('debug')('Ferdium:Helpers:url');
11 10
12export function isValidExternalURL(url: string | URL) { 11export function isValidExternalURL(url: string | URL) {
13 let parsedUrl: URL; 12 let parsedUrl: URL;
@@ -19,7 +18,7 @@ export function isValidExternalURL(url: string | URL) {
19 18
20 const isAllowed = ALLOWED_PROTOCOLS.includes(parsedUrl.protocol); 19 const isAllowed = ALLOWED_PROTOCOLS.includes(parsedUrl.protocol);
21 20
22 console.log('protocol check is', isAllowed, 'for:', url); 21 debug('protocol check is', isAllowed, 'for:', url);
23 22
24 return isAllowed; 23 return isAllowed;
25} 24}
@@ -38,7 +37,7 @@ export function openExternalUrl(
38 url: string | URL, 37 url: string | URL,
39 skipValidityCheck: boolean = false, 38 skipValidityCheck: boolean = false,
40) { 39) {
41 console.log('Open url:', url, 'with skipValidityCheck:', skipValidityCheck); 40 debug('Open url:', url, 'with skipValidityCheck:', skipValidityCheck);
42 if (skipValidityCheck || isValidExternalURL(url)) { 41 if (skipValidityCheck || isValidExternalURL(url)) {
43 shell.openExternal(url.toString()); 42 shell.openExternal(url.toString());
44 } 43 }