From b81f6229e80641eb6ada23fa0646190c7130be1d Mon Sep 17 00:00:00 2001 From: cremesk Date: Fri, 26 Jul 2019 23:59:10 +0200 Subject: [PATCH] add gopher support update requirements and change small typos --- .gitignore | 3 +++ README.rst | 6 ++++++ config/nginx.conf | 2 +- fhost.py | 13 ++++++++++++- requirements.txt | 33 ++++++++++++++++++++------------- 5 files changed, 42 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 64799da..ec6f452 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ __pycache__/ .py[cod] +db.sqlite +up/ +*.pyc diff --git a/README.rst b/README.rst index 3062505..b428191 100644 --- a/README.rst +++ b/README.rst @@ -64,3 +64,9 @@ A: This is done to make dealing with legal claims and accidental uploads easier, e.g. when a user requests removal of all text files uploaded from a certain address within a given time frame (it happens). + +Q: + Do you accept donations? +A: + Only if you insist. I’ve spent very little time and effort on this service + and I don’t feel like I should be taking money for it. diff --git a/config/nginx.conf b/config/nginx.conf index c10583d..001f903 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -7,7 +7,7 @@ server { error_log /var/log/nginx/0x0.envs.net-error.log; location / { - return 301 https://$host$request_uri; + return 307 https://$host$request_uri; } location /.well-known/acme-challenge/ { 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) diff --git a/requirements.txt b/requirements.txt index 7168db6..3004091 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,20 @@ -alembic -numpy -SQLAlchemy -tqdm -Flask_SQLAlchemy -Flask -humanize -requests -flask_migrate -flask_script -python_magic -short_url -validators +alembic==0.8.8 +click==6.6 +decorator==4.0.10 +Flask==0.11.1 +Flask-Migrate==2.0.0 +Flask-Script==2.0.5 +Flask-SQLAlchemy==2.1 +humanize==0.5.1 +itsdangerous==0.24 +Jinja2==2.8 +Mako==1.0.4 +MarkupSafe==0.23 +python-editor==1.0.1 +python-magic==0.4.12 +requests==2.11.1 +short-url==1.2.2 +six==1.10.0 +SQLAlchemy==1.1.3 +validators==0.11.0 +Werkzeug==0.11.11