diff options
Diffstat (limited to 'src/assets')
-rw-r--r-- | src/assets/javascripts/services.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index d250e7f6..40b607b6 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -54,7 +54,10 @@ function redirect(url, type, initiator, forceRedirection) { frontend = options[service].frontend ?? Object.keys(config.services[service].frontends)[0] - if (!regexArray(service, url, config, frontend)) continue + if (!regexArray(service, url, config, frontend)) { + frontend = null + continue + } if ( initiator @@ -86,6 +89,9 @@ function redirect(url, type, initiator, forceRedirection) { } return [zoom, lon, lat] } + + if (!frontend) return + switch (frontend) { // This is where all instance-specific code must be ran to convert the service url to one that can be understood by the frontend. case "beatbump": @@ -381,8 +387,6 @@ function redirect(url, type, initiator, forceRedirection) { else return `${randomInstance}${url.pathname}${url.search}&teddit_proxy=${url.hostname}` } return `${randomInstance}${url.pathname}${url.search}` - default: - return `${randomInstance}${url.pathname}${url.search}` case "neuters": { const p = url.pathname if (p.startsWith('/article/') || p.startsWith('/pf/') || p.startsWith('/arc/') || p.startsWith('/resizer/')) { @@ -394,10 +398,15 @@ function redirect(url, type, initiator, forceRedirection) { if (url.pathname.endsWith('-lyrics')) return `${randomInstance}${url.pathname}` } case "ruralDictionary": { - if (!url.pathname.endsWith('/define.php') && !url.pathname.endsWith('/random.php') && !url.pathname.endsWith('/')) return + if (!url.pathname.endsWith('/define.php') && !url.pathname.endsWith('/random.php') && url.pathname != '/') return return `${randomInstance}${url.pathname}${url.search}` } - + case "anonymousOverflow": { + if (!url.pathname.startsWith('/questions') && url.pathname != '/') return + return `${randomInstance}${url.pathname}${url.search}` + } + default: + return `${randomInstance}${url.pathname}${url.search}` } } @@ -536,6 +545,7 @@ function initDefaults() { options['neuters'] = ['https://neuters.de'] options['dumb'] = ['https://dm.vern.cc'] options['ruralDictionary'] = ['https://rd.vern.cc'] + options['anonymousOverflow'] = ['https://code.whatever.social'] browser.storage.local.set({ options }, () => resolve() |