add gopher support
update requirements and change small typos
This commit is contained in:
parent
d0c0704081
commit
b81f6229e8
|
@ -1,2 +1,5 @@
|
||||||
__pycache__/
|
__pycache__/
|
||||||
.py[cod]
|
.py[cod]
|
||||||
|
db.sqlite
|
||||||
|
up/
|
||||||
|
*.pyc
|
||||||
|
|
|
@ -64,3 +64,9 @@ A:
|
||||||
This is done to make dealing with legal claims and accidental uploads
|
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
|
easier, e.g. when a user requests removal of all text files uploaded from
|
||||||
a certain address within a given time frame (it happens).
|
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.
|
||||||
|
|
|
@ -7,7 +7,7 @@ server {
|
||||||
error_log /var/log/nginx/0x0.envs.net-error.log;
|
error_log /var/log/nginx/0x0.envs.net-error.log;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
return 301 https://$host$request_uri;
|
return 307 https://$host$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /.well-known/acme-challenge/ {
|
location /.well-known/acme-challenge/ {
|
||||||
|
|
13
fhost.py
13
fhost.py
|
@ -40,7 +40,6 @@ app.config["FHOST_EXT_OVERRIDE"] = {
|
||||||
# default blacklist to avoid AV mafia extortion
|
# default blacklist to avoid AV mafia extortion
|
||||||
app.config["FHOST_MIME_BLACKLIST"] = [
|
app.config["FHOST_MIME_BLACKLIST"] = [
|
||||||
"application/x-dosexec",
|
"application/x-dosexec",
|
||||||
"application/x-executable",
|
|
||||||
"application/java-archive",
|
"application/java-archive",
|
||||||
"application/java-vm"
|
"application/java-vm"
|
||||||
]
|
]
|
||||||
|
@ -133,6 +132,12 @@ def is_fhost_url(url):
|
||||||
return url.startswith(fhost_url()) or url.startswith(fhost_url("https"))
|
return url.startswith(fhost_url()) or url.startswith(fhost_url("https"))
|
||||||
|
|
||||||
def shorten(url):
|
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"]:
|
if len(url) > app.config["MAX_URL_LENGTH"]:
|
||||||
abort(414)
|
abort(414)
|
||||||
|
|
||||||
|
@ -234,6 +239,12 @@ def store_file(f, addr):
|
||||||
return sf.geturl()
|
return sf.geturl()
|
||||||
|
|
||||||
def store_url(url, addr):
|
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):
|
if is_fhost_url(url):
|
||||||
return segfault(508)
|
return segfault(508)
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,20 @@
|
||||||
alembic
|
alembic==0.8.8
|
||||||
numpy
|
click==6.6
|
||||||
SQLAlchemy
|
decorator==4.0.10
|
||||||
tqdm
|
Flask==0.11.1
|
||||||
Flask_SQLAlchemy
|
Flask-Migrate==2.0.0
|
||||||
Flask
|
Flask-Script==2.0.5
|
||||||
humanize
|
Flask-SQLAlchemy==2.1
|
||||||
requests
|
humanize==0.5.1
|
||||||
flask_migrate
|
itsdangerous==0.24
|
||||||
flask_script
|
Jinja2==2.8
|
||||||
python_magic
|
Mako==1.0.4
|
||||||
short_url
|
MarkupSafe==0.23
|
||||||
validators
|
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
|
||||||
|
|
Loading…
Reference in New Issue