From c265c7991691828019c0a06c44f62a5d2d072c0f Mon Sep 17 00:00:00 2001 From: André Oliveira <37463445+SpecialAro@users.noreply.github.com> Date: Tue, 12 Jul 2022 23:35:09 +0100 Subject: Change isImage to link and stayInsideDiscord (#120) * Change isImage to URL and stayInsideDiscord * Fix comments --- recipes/discord/package.json | 2 +- recipes/discord/webview.js | 9 +++++++-- recipes/zoom/package.json | 2 +- recipes/zoom/webview.js | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'recipes') diff --git a/recipes/discord/package.json b/recipes/discord/package.json index aed7ab6..fe2b078 100644 --- a/recipes/discord/package.json +++ b/recipes/discord/package.json @@ -1,7 +1,7 @@ { "id": "discord", "name": "Discord", - "version": "1.7.6", + "version": "1.7.7", "license": "MIT", "config": { "serviceURL": "https://discordapp.com/login", diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js index 3ad4a60..bfd0683 100644 --- a/recipes/discord/webview.js +++ b/recipes/discord/webview.js @@ -33,9 +33,14 @@ module.exports = (Ferdium, settings) => { if (link || button) { const url = link ? link.getAttribute('href') : button.getAttribute('title'); - const stayInsideDiscord = url.includes('https://discordapp.com/channels/'); + const skipDomains = [/^https:\/\/discordapp\.com\/channels\//i, /^https:\/\/discord\.com\/channels\//i]; - if (!Ferdium.isImage(url) && !stayInsideDiscord) { + skipDomains.every(skipDomain => { + stayInsideDiscord = skipDomain.test(url); + return !stayInsideDiscord; + }); + + if (!Ferdium.isImage(link) && !stayInsideDiscord) { event.preventDefault(); event.stopPropagation(); diff --git a/recipes/zoom/package.json b/recipes/zoom/package.json index 5357394..2982a9d 100644 --- a/recipes/zoom/package.json +++ b/recipes/zoom/package.json @@ -1,7 +1,7 @@ { "id": "zoom", "name": "Zoom", - "version": "1.3.3", + "version": "1.3.4", "license": "MIT", "config": { "serviceURL": "https://zoom.us/join", diff --git a/recipes/zoom/webview.js b/recipes/zoom/webview.js index 1255675..45cc5b7 100644 --- a/recipes/zoom/webview.js +++ b/recipes/zoom/webview.js @@ -33,8 +33,8 @@ module.exports = (Ferdium, settings) => { if (link || button) { const url = link ? link.getAttribute('href') : button.getAttribute('title'); - - if (!Ferdium.isImage(url)) { + + if (!Ferdium.isImage(link)) { event.preventDefault(); event.stopPropagation(); -- cgit v1.2.3-54-g00ecf