add gopher support

update requirements
and change small typos
This commit is contained in:
cremesk 2019-07-26 23:59:10 +02:00
parent d0c0704081
commit b81f6229e8
No known key found for this signature in database
GPG Key ID: C147C3B7FBDF08D0
5 changed files with 42 additions and 15 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
__pycache__/
.py[cod]
db.sqlite
up/
*.pyc

View File

@ -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. Ive spent very little time and effort on this service
and I dont feel like I should be taking money for it.

View File

@ -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/ {

View File

@ -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)

View File

@ -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