initial customizations

master
Drake 2 years ago
parent 0db6e4b895
commit 4c98169496

2
.gitignore vendored

@ -1,3 +1,5 @@
__pycache__/
.py[cod]
instance/
media/
database.db

@ -19,7 +19,7 @@
and limitations under the License.
"""
from flask import Flask, abort, make_response, redirect, request, send_from_directory, url_for, Response, render_template
from flask import Flask, abort, make_response, redirect, request, send_from_directory, url_for, render_template
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from jinja2.exceptions import *
@ -35,12 +35,13 @@ from pathlib import Path
app = Flask(__name__, instance_relative_config=True)
app.config.update(
SQLALCHEMY_TRACK_MODIFICATIONS = False,
SQLALCHEMY_DATABASE_URI = "sqlite:///database.db",
PREFERRED_URL_SCHEME = "https", # nginx users: make sure to have 'uwsgi_param UWSGI_SCHEME $scheme;' in your config
MAX_CONTENT_LENGTH = 256 * 1024 * 1024,
MAX_CONTENT_LENGTH = 512 * 1024 * 1024, #MiB on top
MAX_URL_LENGTH = 4096,
USE_X_SENDFILE = False,
FHOST_USE_X_ACCEL_REDIRECT = True, # expect nginx by default
FHOST_STORAGE_PATH = "up",
FHOST_USE_X_ACCEL_REDIRECT = False, # expect nginx by default
FHOST_STORAGE_PATH = "media",
FHOST_MAX_EXT_LENGTH = 9,
FHOST_EXT_OVERRIDE = {
"audio/flac" : ".flac",
@ -55,11 +56,7 @@ app.config.update(
"text/plain" : ".txt",
"text/x-diff" : ".diff",
},
FHOST_MIME_BLACKLIST = [
"application/x-dosexec",
"application/java-archive",
"application/java-vm"
],
FHOST_MIME_BLACKLIST = [],
FHOST_UPLOAD_BLACKLIST = None,
NSFW_DETECT = False,
NSFW_THRESHOLD = 0.608,
@ -346,6 +343,10 @@ def fhost():
else:
return render_template("index.html")
@app.route("/web", methods=["GET"])
def web():
return render_template("web.html")
@app.route("/robots.txt")
def robots():
return """User-agent: *

@ -1,45 +1,42 @@
<pre>
THE NULL POINTER
================
{% set fhost_url = url_for("fhost", _external=True).rstrip("/") %}
HTTP POST files here:
0w0
--------------------- {% set fhost_url = url_for("fhost", _external=True).rstrip("/") %}
a selfhosted instance of 0x0
try out our new <a href="{{ fhost_url }}/web">web interface</a>!
POST API
---------------------
file upload:
curl -F'file=@yourfile.png' {{ fhost_url }}
You can also POST remote URLs:
file upload from remote url:
curl -F'url=http://example.com/image.jpg' {{ fhost_url }}
Or you can shorten URLs:
shorten url:
curl -F'shorten=http://example.com/some/long/url' {{ fhost_url }}
File URLs are valid for at least 30 days and up to a year (see below).
Shortened URLs do not expire.
{% set max_size = config["MAX_CONTENT_LENGTH"]|filesizeformat(True) %}
Maximum file size: {{ max_size }}
Not allowed: {{ config["FHOST_MIME_BLACKLIST"]|join(", ") }}
max file size: {{ max_size }}
all file types are allowed, but you better not be naughty.
FILE RETENTION PERIOD
TERMS
---------------------
do not use this for:
- piracy
- extremist material of any form
- pornography and gore
- malware or C&C client software
- cryptocurrencies and related information
- *large* backups, ie a hard disk image
- doxxing
- things that are otherwise illegal under US law
retention = min_age + (-max_age + min_age) * pow((file_size / max_size - 1), 3)
any uploads with any of these may be removed with no notice.
days
365 | \\
| \\
| \\
| \\
| \\
| \\
| ..
| \\
197.5 | ----------..-------------------------------------------
| ..
| \\
| ..
| ...
| ..
| ...
| ....
| ......
30 | ....................
0{{ ((config["MAX_CONTENT_LENGTH"]/2)|filesizeformat(True)).split(" ")[0].rjust(27) }}{{ max_size.split(" ")[0].rjust(27) }}
{{ max_size.split(" ")[1].rjust(54) }}
FILE AND URL RETENTION PERIOD
---------------------
retention = forever. thats right, they are forever. (until someone complains to me)
THANKS
---------------------
thanks to <a href="https://0x0.st">mia, for the original 0x0 site.</a>
</pre>

@ -0,0 +1,6 @@
<pre>
<form action="/" method="post" enctype="multipart/form-data">
<input type="file" id="file" name="file"><br>
<input type="submit" value="Upload" formtarget="_self">
</form>
</pre>
Loading…
Cancel
Save