diff options
author | cremesk <ennik@envs.net> | 2019-07-26 23:59:10 +0200 |
---|---|---|
committer | cremesk <ennik@envs.net> | 2019-07-26 23:59:10 +0200 |
commit | b81f6229e80641eb6ada23fa0646190c7130be1d (patch) | |
tree | 2ebd08b2aa8eb644281004f9036cd83f51975c8c /fhost.py | |
parent | add tomasino pastebin service (diff) | |
download | hex-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-x | fhost.py | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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) |