diff --git a/fhost.py b/fhost.py index 5b7bf1e..2f53db0 100755 --- a/fhost.py +++ b/fhost.py @@ -344,7 +344,7 @@ def fhost(): abort(400) else: - return render_template("index.html") + return render_template("boop.html") @app.route("/robots.txt") def robots(): diff --git a/requirements.txt b/requirements.txt index 8dbfe72..6aacda8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,3 +8,4 @@ Flask_SQLAlchemy validators flask_migrate python_magic +uwsgi diff --git a/services/boop.icu.nginx b/services/boop.icu.nginx new file mode 100644 index 0000000..c6054c4 --- /dev/null +++ b/services/boop.icu.nginx @@ -0,0 +1,37 @@ +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name boop.icu www.boop.icu; + + ssl_certificate /etc/letsencrypt/live/boop.icu/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/boop.icu/privkey.pem; + + include common/acme.conf; + include common/statuscodes.conf; + include common/ssl.conf; + + # Upload size limit + client_max_body_size 256M; + + location / { + include uwsgi_params; + uwsgi_pass unix:/opt/boop/boop.icu.sock; + uwsgi_param UWSGI_SCHEME https; + } + + location /css { + root /opt/boop/css; + } + + location /up { + root /opt/boop; + internal; + } +} + +server { + listen 80; + listen [::]:80; + server_name boop.icu www.boop.icu; + return 301 https://boop.icu$request_uri; +} diff --git a/services/boop.icu.service b/services/boop.icu.service new file mode 100644 index 0000000..7483e2a --- /dev/null +++ b/services/boop.icu.service @@ -0,0 +1,12 @@ +[Unit] +Description=boop.icu instance +After=network.target + +[Service] +User=boop +Group=http +WorkingDirectory=/opt/boop +ExecStart=/opt/boop/.local/bin/uwsgi --ini /opt/boop/boop.icu.ini --enable-threads + +[Install] +WantedBy=multi-user.target diff --git a/templates/boop.html b/templates/boop.html new file mode 100644 index 0000000..c1357ee --- /dev/null +++ b/templates/boop.html @@ -0,0 +1,142 @@ +{% set title = config["SITE_NAME"] %} +{% set fhost_url = url_for("fhost", _external=True).rstrip("/") %} +{% set max_size = config["MAX_CONTENT_LENGTH"]|filesizeformat(True) %} +{% set not_allowed = config["FHOST_MIME_BLACKLIST"]|join(", ") %} +{% set half = ((config["MAX_CONTENT_LENGTH"]/2)|filesizeformat(True)).split(" ")[0].rjust(27) %} +{% set max = max_size.split(" ")[0].rjust(27) %} +{% set unit = max_size.split(" ")[1].rjust(54) %} + +
+ + + +curl -F'file=@yourfile.png' {{ fhost_url }}+ You can also POST remote URLs: +
curl -F'url=http://example.com/image.jpg' {{ fhost_url }}+ Or you can shorten URLs: +
curl -F'shorten=http://example.com/some/long/url' {{ fhost_url }}+ Alternatively, you can use PUT: +
curl -X PUT -T 'yourfile.png' {{ fhost_url }}+ +
File URLs are valid for at least 30 days and up to a year (see below).
+ Shortened URLs do not expire.
Maximum file size: {{ max_size }}
+Not allowed: {{ not_allowed }}
+ ++retention = min_age + (-max_age + min_age) * pow((file_size / max_size - 1), 3) + +days + 365 | \\ + | \\ + | \\ + | \\ + | \\ + | \\ + | .. + | \ +197.5 | ----------..------------------------------------------- + | .. + | \ + | .. + | ... + | .. + | ... + | .... + | ...... + 30 | .................... + 0{{ half }}{{ max }} + {{ unit }} ++
Please report illegal content to fedi@criminallycute.fi with the subject "boop.icu content". Include a link to content to be removed.
+