Update publically available copies of Zenit and reindexer

This commit is contained in:
Robert Miles 2021-10-06 23:28:28 +00:00
parent eed2fa4ece
commit 4ce9455c02
3 changed files with 11 additions and 1 deletions

View File

@ -6,3 +6,5 @@ geddit.glv.one
geddit.pitr.ca
# ignore medusae
medusae.space
# ignore some german guy's gemlog
g.dumke.me

View File

@ -100,6 +100,7 @@ def grab_content(url,redirect_num=0):
else:
ctx = globals()["ctx"]
with socket.socket(socket.AF_INET,socket.SOCK_STREAM) as s:
s.settimeout(5)
ss = ctx.wrap_socket(s,server_hostname=parsed.hostname)
try:
ss.connect((parsed.hostname,parsed.port or 1965))
@ -107,6 +108,9 @@ def grab_content(url,redirect_num=0):
except ConnectionRefusedError:
print("Connection refused!",file=sys.stderr)
return b'', 'application/octet-stream'
except socket.timeout:
print("Timeout!",file=sys.stderr)
return b'', 'application/octet-stream'
except ssl.CertificateError as e:
print(e.args[0],file=sys.stderr)
return b'', 'application/octet-stream'
@ -141,7 +145,7 @@ def grab_content(url,redirect_num=0):
# Return the header with a mimetype of text/plain. If this were a real library I might throw an error here, but this is just to make Zenit work.
return header.decode("utf-8"), "text/plain"
CAPSULES_IN_ORBIT = set()
CAPSULES_IN_ORBIT = set(["g.dumke.me"]) # temporary change to remove a certain link
import copy
links = copy.deepcopy(URLS)[1:] # skip main link

View File

@ -100,6 +100,7 @@ def grab_content(url,redirect_num=0):
else:
ctx = globals()["ctx"]
with socket.socket(socket.AF_INET,socket.SOCK_STREAM) as s:
s.settimeout(5)
ss = ctx.wrap_socket(s,server_hostname=parsed.hostname)
try:
ss.connect((parsed.hostname,parsed.port or 1965))
@ -107,6 +108,9 @@ def grab_content(url,redirect_num=0):
except ConnectionRefusedError:
print("Connection refused!")
return b'', 'application/octet-stream'
except socket.timeout:
print("Connection refused!")
return b'', 'application/octet-stream'
except ssl.CertificateError as e:
print(f"Certificate error for domain {parsed.hostname}: {e.args[0]}")
return b'', 'application/octet-stream'