aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores
diff options
context:
space:
mode:
authorLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-08-14 14:52:24 +0000
committerLibravatar GitHub <noreply@github.com>2021-08-14 20:22:24 +0530
commit8a37b92bc83db229a788008c5a6a68cf51216ed2 (patch)
tree1929798a3aa4089203668bd2b93dba497363eb5a /src/stores
parentNew Crowdin updates (#1786) (diff)
downloadferdium-app-8a37b92bc83db229a788008c5a6a68cf51216ed2.tar.gz
ferdium-app-8a37b92bc83db229a788008c5a6a68cf51216ed2.tar.zst
ferdium-app-8a37b92bc83db229a788008c5a6a68cf51216ed2.zip
Refactoring: Url helpers (#1789)
These changes are mainly to ensure that 'shell.open*' invocations are only in a single file. * Moved 'openPath' into the 'url-helpers' file. * Extract 'openExternalUrl' into a common location in 'url-helpers' This is done so that we can then apply vetting rules to ensure that there is no security concern as described in https://benjamin-altpeter.de/shell-openexternal-dangers/
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/AppStore.js12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index 72ddc2927..9c8cce679 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -1,4 +1,4 @@
1import { ipcRenderer, shell } from 'electron'; 1import { ipcRenderer } from 'electron';
2import { 2import {
3 app, 3 app,
4 screen, 4 screen,
@@ -33,7 +33,7 @@ import {
33 getServiceIdsFromPartitions, 33 getServiceIdsFromPartitions,
34 removeServicePartitionDirectory, 34 removeServicePartitionDirectory,
35} from '../helpers/service-helpers'; 35} from '../helpers/service-helpers';
36import { isValidExternalURL } from '../helpers/url-helpers'; 36import { openExternalUrl } from '../helpers/url-helpers';
37import { sleep } from '../helpers/async-helpers'; 37import { sleep } from '../helpers/async-helpers';
38 38
39const debug = require('debug')('Ferdi:AppStore'); 39const debug = require('debug')('Ferdi:AppStore');
@@ -388,13 +388,9 @@ export default class AppStore extends Store {
388 } 388 }
389 } 389 }
390 390
391 // Ideally(?) this should be merged with the 'shell-helpers' functionality
391 @action _openExternalUrl({ url }) { 392 @action _openExternalUrl({ url }) {
392 const parsedUrl = new URL(url); 393 openExternalUrl(new URL(url));
393 debug('open external url', parsedUrl);
394
395 if (isValidExternalURL(url)) {
396 shell.openExternal(url);
397 }
398 } 394 }
399 395
400 @action _checkForUpdates() { 396 @action _checkForUpdates() {