Detect when multiple domains point to the same console

This commit is contained in:
Robert Miles 2021-07-02 02:28:58 +00:00
parent f720b2e549
commit e5471f66d3
1 changed files with 9 additions and 0 deletions

View File

@ -12,6 +12,12 @@ MAIN_PAGE = "gemini://tilde.team/~khuxkm/leo/"
# In case GUS ever goes down, is replaced, or changes URL, this will allow for easy fixing of Zenit.
BACKLINKS = "gemini://geminispace.info/backlinks"
# Domains that refer to the same capsule.
# For instance, tilde.team has several domains.
DUPLICATED_DOMAINS = {
"tilde.team": ['fuckup.club', 'nand.sh', 'ttm.sh', 'tild3.org', 'tilde.life', 'tilde.site', 'tildeteam.net', 'tildeteam.org']
}
# Determine a "capsule".
# Used to prevent one person from flooding the orbit with pages.
# One page is allowed in the list per "capsule".
@ -22,6 +28,9 @@ def determine_capsule(parsed):
capsule+="/"+parsed.path.split("/")[1][1:]
if parsed.path.startswith("/users/"): # gemini.circumlunar.space uses this format as well
capsule+="/"+parsed.path.split("/",3)[2]
for domain in DUPLICATED_DOMAINS:
for alt in DUPLICATED_DOMAINS[domain]:
capsule.replace(alt,domain)
return capsule
# Required links.