aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers/url-helpers.js
diff options
context:
space:
mode:
authorLibravatar kytwb <412895+kytwb@users.noreply.github.com>2021-06-12 19:51:28 +0200
committerLibravatar GitHub <noreply@github.com>2021-06-12 19:51:28 +0200
commitb0ecce5eab2a6d0eed3ade7c43e252ca9bac7edb (patch)
treeaed0253b61ca035f3388a7d6a369ffe75f195a58 /src/helpers/url-helpers.js
parentBypassed code signing since that is also incorrect in GH settings. (diff)
downloadferdium-app-b0ecce5eab2a6d0eed3ade7c43e252ca9bac7edb.tar.gz
ferdium-app-b0ecce5eab2a6d0eed3ade7c43e252ca9bac7edb.tar.zst
ferdium-app-b0ecce5eab2a6d0eed3ade7c43e252ca9bac7edb.zip
Fix active Todos service behaviour (#1481)
* Return false instead of null in isTodosServiceAdded * Resolve from TODOS_RECIPES_ID instead of hardcoded TODOS_RECIPE_ID * Fix TodosWebview width toggling when isTodosServiceActive * Add more todo service recipe IDs * Refactor todos state management * Moved todos service URL and recipe ID computation logic to todos/store * Simplified TodosWebview by delegating to the store for the URL and removing the (unused) payment logic * Made the todos service computation logic in the Service model depend on the logic in todos/store * Made ServicesStore depend on the todos service logic from the Service model * Todos appearance fixes * Hide double horizontal rules if todo settings are hidden due to an added todo service * Hide todos panel border when the panel is hidden or expanded * Make expanded todos panel obey sidebar width and vertical style settings * Make todos/store use isValidExternalURL * Harden isValidExternalURL against malformed URLs * Reduce todo URL string duplication in config.js Co-authored-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'src/helpers/url-helpers.js')
-rw-r--r--src/helpers/url-helpers.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/helpers/url-helpers.js b/src/helpers/url-helpers.js
index 2f429a25c..972f9b79a 100644
--- a/src/helpers/url-helpers.js
+++ b/src/helpers/url-helpers.js
@@ -5,7 +5,12 @@ import { ALLOWED_PROTOCOLS } from '../config';
5const debug = require('debug')('Ferdi:Helpers:url'); 5const debug = require('debug')('Ferdi:Helpers:url');
6 6
7export function isValidExternalURL(url) { 7export function isValidExternalURL(url) {
8 const parsedUrl = new URL(url); 8 let parsedUrl;
9 try {
10 parsedUrl = new URL(url);
11 } catch (_) {
12 return false;
13 }
9 14
10 const isAllowed = ALLOWED_PROTOCOLS.includes(parsedUrl.protocol); 15 const isAllowed = ALLOWED_PROTOCOLS.includes(parsedUrl.protocol);
11 16