This commit is contained in:
ManeraKai 2023-02-04 23:16:36 +03:00
parent 3c11223d6a
commit 64a655fba3
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
2 changed files with 38 additions and 9 deletions

View File

@ -54,7 +54,10 @@ function redirect(url, type, initiator, forceRedirection) {
frontend = options[service].frontend ?? Object.keys(config.services[service].frontends)[0] 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 ( if (
initiator initiator
@ -86,6 +89,9 @@ function redirect(url, type, initiator, forceRedirection) {
} }
return [zoom, lon, lat] return [zoom, lon, lat]
} }
if (!frontend) return
switch (frontend) { 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. // 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": case "beatbump":
@ -381,8 +387,6 @@ function redirect(url, type, initiator, forceRedirection) {
else return `${randomInstance}${url.pathname}${url.search}&teddit_proxy=${url.hostname}` else return `${randomInstance}${url.pathname}${url.search}&teddit_proxy=${url.hostname}`
} }
return `${randomInstance}${url.pathname}${url.search}` return `${randomInstance}${url.pathname}${url.search}`
default:
return `${randomInstance}${url.pathname}${url.search}`
case "neuters": { case "neuters": {
const p = url.pathname const p = url.pathname
if (p.startsWith('/article/') || p.startsWith('/pf/') || p.startsWith('/arc/') || p.startsWith('/resizer/')) { 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}` if (url.pathname.endsWith('-lyrics')) return `${randomInstance}${url.pathname}`
} }
case "ruralDictionary": { 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}` 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}`
} }
} }
@ -512,7 +521,7 @@ function initDefaults() {
options['popupServices'] = ["youtube", "twitter", "tiktok", "imgur", "reddit", "quora", "translate", "maps"] options['popupServices'] = ["youtube", "twitter", "tiktok", "imgur", "reddit", "quora", "translate", "maps"]
options['invidious'] = ['https://inv.vern.cc'] options['invidious'] = ['https://inv.vern.cc']
options['piped'] = ['https://piped.video'] options['piped'] = ['https://pipedapi-libre.kavin.rocks']
options['pipedMaterial'] = ['https://piped-material.xn--17b.net'] options['pipedMaterial'] = ['https://piped-material.xn--17b.net']
options['cloudtube'] = ['https://tube.cadence.moe'] options['cloudtube'] = ['https://tube.cadence.moe']
options['proxiTok'] = ['https://proxitok.pabloferreiro.es'] options['proxiTok'] = ['https://proxitok.pabloferreiro.es']
@ -536,6 +545,7 @@ function initDefaults() {
options['neuters'] = ['https://neuters.de'] options['neuters'] = ['https://neuters.de']
options['dumb'] = ['https://dm.vern.cc'] options['dumb'] = ['https://dm.vern.cc']
options['ruralDictionary'] = ['https://rd.vern.cc'] options['ruralDictionary'] = ['https://rd.vern.cc']
options['anonymousOverflow'] = ['https://code.whatever.social']
browser.storage.local.set({ options }, browser.storage.local.set({ options },
() => resolve() () => resolve()

View File

@ -470,7 +470,7 @@
} }
}, },
"targets": [ "targets": [
"^https?:\\/{2}(www\\.)?reuters.com\\/" "^https?:\\/{2}(www\\.)?reuters\\.com\\/"
], ],
"name": "Paste Text", "name": "Paste Text",
"options": { "options": {
@ -489,7 +489,7 @@
} }
}, },
"targets": [ "targets": [
"^https?:\\/{2}(www\\.)?genius.com\\/" "^https?:\\/{2}(www\\.)?genius\\.com\\/"
], ],
"name": "Genius", "name": "Genius",
"options": { "options": {
@ -508,7 +508,7 @@
} }
}, },
"targets": [ "targets": [
"^https?:\\/{2}(www\\.)?urbandictionary.com\\/" "^https?:\\/{2}(www\\.)?urbandictionary\\.com\\/"
], ],
"name": "Urban Dictionary", "name": "Urban Dictionary",
"options": { "options": {
@ -517,6 +517,25 @@
"imageType": "svg", "imageType": "svg",
"embeddable": false, "embeddable": false,
"url": "https://urbandictionary.com" "url": "https://urbandictionary.com"
},
"stackOverflow": {
"frontends": {
"anonymousOverflow": {
"name": "AnonymousOverflow",
"instanceList": true,
"url": "https://github.com/httpjamesm/AnonymousOverflow"
}
},
"targets": [
"^https?:\\/{2}stackoverflow\\.com\\/"
],
"name": "Stack Overflow",
"options": {
"enabled": false
},
"imageType": "svg",
"embeddable": false,
"url": "https://stackoverflow.com/"
} }
} }
} }