will merge later

This commit is contained in:
ManeraKai 2022-12-29 19:15:55 +03:00
parent c099e1a75f
commit b904177520
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
4 changed files with 17 additions and 6 deletions

View File

@ -29,7 +29,7 @@ function fetchFrontendInstanceList(service, frontend, redirects, options, config
for (const network in config.networks) {
tmp.push(...redirects[network], ...options[frontend][network].custom)
}
} else if (config.services[service].frontends[frontend].singleInstance) tmp = config.services[service].frontends[frontend].singleInstance
}
return tmp
}
@ -69,7 +69,6 @@ function redirect(url, type, initiator, forceRedirection) {
let randomInstance
let frontend
for (const service in config.services) {
if (!forceRedirection && !options[service].enabled) continue
if (config.services[service].embeddable && type != options[service].redirectType && options[service].redirectType != "both") continue
@ -95,7 +94,7 @@ function redirect(url, type, initiator, forceRedirection) {
}
if (instanceList.length === 0) return
randomInstance = utils.getRandomInstance(instanceList)
} else if (config.services[service].frontends[frontend].singleInstance) randomInstance = config.services[service].frontends[frontend].singleInstance
}
break
}
if (!frontend || !randomInstance) return

View File

@ -447,8 +447,7 @@
},
"osm": {
"name": "OpenStreetMap",
"instanceList": false,
"singleInstance": "https://www.openstreetmap.org"
"instanceList": true
}
},
"targets": [

View File

@ -117,6 +117,7 @@ def is_authenticate(url):
return False
return False
def fetchCache(frontend, name):
try:
with open('./src/instances/data.json') as file:
@ -436,13 +437,19 @@ def facil():
fetchFromFile('facil', 'FacilMap')
def osm():
fetchFromFile('osm', 'OpenStreetMap')
def libreTranslate():
fetchRegexList('libreTranslate', 'LibreTranslate', 'https://raw.githubusercontent.com/LibreTranslate/LibreTranslate/main/README.md',
r"\[(?:[^\s\/]+\.)+[a-zA-Z0-9]+\]\((https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+)\/?\)\|")
def breezeWiki():
fetchJsonList('breezeWiki', 'BreezeWiki', 'https://docs.breezewiki.com/files/instances.json', 'instance', False)
fetchJsonList('breezeWiki', 'BreezeWiki',
'https://docs.breezewiki.com/files/instances.json', 'instance', False)
def privateBin():
fetchJsonList('privateBin', 'PrivateBin',
@ -499,6 +506,7 @@ neuters()
beatbump()
hyperpipe()
facil()
osm()
simpleertube()
breezeWiki()
privateBin()

5
src/instances/osm.json Normal file
View File

@ -0,0 +1,5 @@
{
"clearnet": [
"https://www.openstreetmap.org"
]
}