From 96a04b66f73b84f7f183f11f1584e62633073c74 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Tue, 1 Mar 2022 18:50:40 +0300 Subject: [PATCH] Fixed a regex bug for all services #76 --- src/assets/javascripts/helpers/maps.js | 2 +- src/assets/javascripts/helpers/search.js | 4 ++-- src/assets/javascripts/helpers/twitter.js | 12 ++++++------ src/assets/javascripts/helpers/youtube/youtube.js | 12 ++++++------ src/assets/javascripts/helpers/youtubeMusic.js | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/assets/javascripts/helpers/maps.js b/src/assets/javascripts/helpers/maps.js index 3fd7700..e5c71cd 100644 --- a/src/assets/javascripts/helpers/maps.js +++ b/src/assets/javascripts/helpers/maps.js @@ -1,7 +1,7 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' -const targets = /https?:\/\/(((www|maps)\.)?(google\.).*(\/maps)|maps\.(google\.).*)/; +const targets = /^https?:\/\/(((www|maps)\.)?(google\.).*(\/maps)|maps\.(google\.).*)/; let redirects = { "normal": [ "https://openstreetmap.org" diff --git a/src/assets/javascripts/helpers/search.js b/src/assets/javascripts/helpers/search.js index efbc10d..dd425f2 100644 --- a/src/assets/javascripts/helpers/search.js +++ b/src/assets/javascripts/helpers/search.js @@ -3,8 +3,8 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' const targets = [ - /https?:\/\/(www\.|maps\.|search\.|)google\.com(\...|)(\/search\?..*|\/$)/, - // /https?:\/\/yandex\.com(\...|)(\/search\/..*|\/$)/, + /^https?:\/\/(www\.|maps\.|search\.|)google\.com(\...|)(\/search\?..*|\/$)/, + // /^https?:\/\/yandex\.com(\...|)(\/search\/..*|\/$)/, ]; let redirects = { "searx": { diff --git a/src/assets/javascripts/helpers/twitter.js b/src/assets/javascripts/helpers/twitter.js index 73d5ee2..8b41853 100644 --- a/src/assets/javascripts/helpers/twitter.js +++ b/src/assets/javascripts/helpers/twitter.js @@ -3,12 +3,12 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' const targets = [ - /https?:\/\/twitter\.com/, - /https?:\/\/www\.twitter\.com/, - /https?:\/\/mobile\.twitter\.com/, - /https?:\/\/pbs\.twimg\.com/, - /https?:\/\/video\.twimg\.com/, - /https?:\/\/platform\.twitter\.com\/embed/ + /^https?:\/\/twitter\.com/, + /^https?:\/\/www\.twitter\.com/, + /^https?:\/\/mobile\.twitter\.com/, + /^https?:\/\/pbs\.twimg\.com/, + /^https?:\/\/video\.twimg\.com/, + /^https?:\/\/platform\.twitter\.com\/embed/ ]; let redirects = { diff --git a/src/assets/javascripts/helpers/youtube/youtube.js b/src/assets/javascripts/helpers/youtube/youtube.js index eb5613b..243561d 100644 --- a/src/assets/javascripts/helpers/youtube/youtube.js +++ b/src/assets/javascripts/helpers/youtube/youtube.js @@ -5,16 +5,16 @@ import commonHelper from '../common.js' window.browser = window.browser || window.chrome; const targets = [ - /https?:\/\/(www\.|music\.|m\.|)youtube\.com(\/.*|$)/, + /^https?:\/\/(www\.|music\.|m\.|)youtube\.com(\/.*|$)/, - /https?:\/\/img\.youtube\.com\/vi\/.*\/..*/, // https://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api - /https?:\/\/(i|s)\.ytimg\.com\/vi\/.*\/..*/, + /^https?:\/\/img\.youtube\.com\/vi\/.*\/..*/, // https://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api + /^https?:\/\/(i|s)\.ytimg\.com\/vi\/.*\/..*/, - /https?:\/\/(www\.|music\.|)youtube\.com\/watch\?v\=..*/, + /^https?:\/\/(www\.|music\.|)youtube\.com\/watch\?v\=..*/, - /https?:\/\/youtu\.be\/..*/, + /^https?:\/\/youtu\.be\/..*/, - /https?:\/\/(www\.|)(youtube|youtube-nocookie)\.com\/embed\/..*/, + /^https?:\/\/(www\.|)(youtube|youtube-nocookie)\.com\/embed\/..*/, ]; let redirects = { "invidious": { diff --git a/src/assets/javascripts/helpers/youtubeMusic.js b/src/assets/javascripts/helpers/youtubeMusic.js index 50138f4..b3f232c 100644 --- a/src/assets/javascripts/helpers/youtubeMusic.js +++ b/src/assets/javascripts/helpers/youtubeMusic.js @@ -5,7 +5,7 @@ import commonHelper from './common.js' window.browser = window.browser || window.chrome; const targets = [ - /https?:\/\/music\.youtube\.com(\/.*|$)/, + /^https?:\/\/music\.youtube\.com(\/.*|$)/, ]; let redirects = { "beatbump": {