boop.icu/templates/boop.html

192 lines
5.8 KiB
HTML

{% set title = config["SITE_NAME"] %}
{% set fhost_url = url_for("fhost", _external=True).rstrip("/") %}
{% set max_size = config["MAX_CONTENT_LENGTH"]|filesizeformat(True) %}
{% set half_size = (config["MAX_CONTENT_LENGTH"]/2)|filesizeformat(True) %}
{% set not_allowed = config["FHOST_MIME_BLACKLIST"]|join(", ") %}
{% set min = config.get("FHOST_MIN_EXPIRATION", 2592000000)//86400000 %}
{% set half = ((config.get("FHOST_MIN_EXPIRATION", 2592000000)/2 + config.get("FHOST_MAX_EXPIRATION", 31536000000)/2)/86400000) %}
{% set max = config.get("FHOST_MAX_EXPIRATION", 31536000000)//86400000 %}
{% set unit = max_size.split(" ")[1].rjust(54) %}
{% set max_size = (max_size|string).split(" ")[0].rjust(27) %}
{% set half_size = (half_size|string).split(" ")[0].rjust(27) %}
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ title }}</title>
<style type="text/css">
@media (min-width: 768px) {
body { width: 80%; }
pre { font-size: 12px; }
}
@media (min-width: 992px) {
body { width: 70%; }
}
@media (min-width: 1200px) {
body { width: 65%; }
}
::selection {
background: #99F2B9;
color: #0E0E0E;
}
body {
background: #0E0E0E;
color: #3EE77B;
font-family: monospace;
font-size: 16px;
line-height: 1.43;
margin: 0 auto;
}
form {
margin-block: 0em;
margin-block-end: 1em;
}
form input, hr, pre {
border: 1px solid #414141;
}
form input {
background: #0E0E0E;
color: #3EE77B;
font-family: monospace;
font-size: 16px;
height: 36px;
padding: 6px 12px;
width: 100%;
}
h1 {
font-size: 48px;
}
h3 {
font-size: 32px;
}
h1, h3 {
font-weight: 500;
line-height: 1.2;
margin-top: 22px;
margin-bottom: 11px;
}
h1, h3, pre, a, a:visited {
color: #99F2B9;
}
p, pre {
margin: 0 0 11px;
}
pre {
background: #282828;
padding: 10.5px;
font-size: 15px;
}
.container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
</style>
</head>
<body>
<div class="container">
<h1>{{ title }}</h1>
<hr>
<p>
HTTP POST files here:
<pre>curl -F'file=@yourfile.png' {{ fhost_url }}</pre>
You can also POST remote URLs:
<pre>curl -F'url=http://example.com/image.jpg' {{ fhost_url }}</pre>
If you don't want the resulting URL to be easy to guess:
<pre>curl -F'file=@yourfile.png' -Fsecret= {{ fhost_url }}</pre>
<pre>curl -F'url=http://example.com/image.jpg' -Fsecret= {{ fhost_url }}</pre>
Or you can shorten URLs:
<pre>curl -F'shorten=http://example.com/some/long/url' {{ fhost_url }}</pre>
</p>
<p>
Alternatively, you can use PUT:
<pre>curl -X PUT -T 'yourfile.png' {{ fhost_url }}</pre>
</p>
<p>File URLs are valid for at least 30 days and up to a year (see below).<br>
Shortened URLs do not expire.
</p>
<p>
Files can be set to expire sooner by adding an "expires" parameter (in hours)
<pre>curl -F'file=@yourfile.png' -Fexpires=24 {{ fhost_url }}</pre>
OR by setting "expires" to a timestamp in epoch milliseconds
<pre>curl -F'file=@yourfile.png' -Fexpires=1681996320000 {{ fhost_url }}</pre>
<p>
Expired files won't be removed immediately, but will be removed as part of
the next purge.
</p>
<p>
Whenever a file that does not already exist or has expired is uploaded,
the HTTP response header includes an X-Token field. You can use this
to perform management operations on the file.
To delete the file immediately:
<pre>curl -Ftoken=token_here -Fdelete= {{ fhost_url }}/abc.txt</pre>
To change the expiration date (see above):
<pre>curl -Ftoken=token_here -Fexpires=3 {{ fhost_url }}/abc.txt</pre>
</p>
<p>
Maximum file size: {{ max_size }}<br>
Not allowed: {{ config["FHOST_MIME_BLACKLIST"]|join(", ") }}
</p>
<h3>TERMS OF SERVICE</h3>
<p>boop.icu is <em>NOT</em> a platform for:
<ul>
<li>piracy</li>
<li>pornography and gore</li>
<li>extremist material of any kind</li>
<li>malware / botnet C&C</li>
<li>anything related to crypto currencies</li>
<li>backups</li>
<li>CI build artifacts</li>
<li>doxxing, database dumps containing personal information</li>
<li>anything illegal under Finnish law</li>
</ul>
</p>
<h3>FILE RETENTION PERIOD</h3>
<pre>
retention = min_age + (-max_age + min_age) * pow((file_size / max_size - 1), 3)
days
{{ '{: 6}'.format(max) }} | \\
| \\
| \\
| \\
| \\
| \\
| ..
| \
{{ '{: 6.1f}'.format(half) }} | ----------..-------------------------------------------
| ..
| \
| ..
| ...
| ..
| ...
| ....
| ......
{{ '{: 6}'.format(min) }} | ....................
0{{ half_size }}{{ max_size }}
{{ unit }}
</pre>
<h3>UPLOAD DIRECTLY</h3>
<hr>
<form action="{{ fhost_url }}" method="POST" enctype="multipart/form-data">
<label for="file">File:</label>
<input class="form-control" type="file" name="file"><br><br>
<input class="form-control" type="submit" value="Submit">
</form>
<p>Please report illegal content to <a href="mailto:fedi@criminallycute.fi?subject="boop.icu content">fedi@criminallycute.fi</a> with the subject "boop.icu content". Include a link to content to be removed.</p>
<p><a href="https://code.criminallycute.fi/siina/boop.icu">Source code</a></p>
</div>
</body>
</html>