aboutsummaryrefslogtreecommitdiff
path: root/fhost.py
diff options
context:
space:
mode:
authorcremesk <ennik@envs.net>2019-07-26 23:59:10 +0200
committercremesk <ennik@envs.net>2019-07-26 23:59:10 +0200
commitb81f6229e80641eb6ada23fa0646190c7130be1d (patch)
tree2ebd08b2aa8eb644281004f9036cd83f51975c8c /fhost.py
parentadd tomasino pastebin service (diff)
downloadhex-zero-b81f6229e80641eb6ada23fa0646190c7130be1d.tar.gz
hex-zero-b81f6229e80641eb6ada23fa0646190c7130be1d.tar.bz2
hex-zero-b81f6229e80641eb6ada23fa0646190c7130be1d.zip
add gopher support
update requirements and change small typos
Diffstat (limited to 'fhost.py')
-rwxr-xr-xfhost.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/fhost.py b/fhost.py
index 34de318..548b626 100755
--- a/fhost.py
+++ b/fhost.py
@@ -40,7 +40,6 @@ app.config["FHOST_EXT_OVERRIDE"] = {
# default blacklist to avoid AV mafia extortion
app.config["FHOST_MIME_BLACKLIST"] = [
"application/x-dosexec",
- "application/x-executable",
"application/java-archive",
"application/java-vm"
]
@@ -133,6 +132,12 @@ def is_fhost_url(url):
return url.startswith(fhost_url()) or url.startswith(fhost_url("https"))
def shorten(url):
+ # handler to convert gopher links to HTTP(S) proxy
+ gopher = "gopher://"
+ length = len(gopher)
+ if url[:length] == gopher:
+ url = "https://gopher.tilde.team/{}".format(url[length:])
+
if len(url) > app.config["MAX_URL_LENGTH"]:
abort(414)
@@ -234,6 +239,12 @@ def store_file(f, addr):
return sf.geturl()
def store_url(url, addr):
+ # handler to convert gopher links to HTTP(S) proxy
+ gopher = "gopher://"
+ length = len(gopher)
+ if url[:length] == gopher:
+ url = "https://gopher.tilde.team/{}".format(url[length:])
+
if is_fhost_url(url):
return segfault(508)
bgstack15