bin/server/templates/index.stpl

58 lines
2.4 KiB
Text
Raw Permalink Normal View History

2023-11-06 21:53:45 +01:00
<html>
<head>
2024-01-25 22:36:52 +01:00
<title>pfzetto bin</title>
<link rel="icon" type="image/svg" href="https://pfzetto.de/pfzetto.svg"/>
2023-11-06 21:53:45 +01:00
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2024-01-25 22:36:52 +01:00
<% include!("./style.stpl"); %>
2023-11-06 21:53:45 +01:00
</head>
<body>
2024-01-25 22:36:52 +01:00
<canvas id="matrix"></canvas>
<main id="main">
<h1>pfzetto bin</h1>
2023-11-06 21:53:45 +01:00
<p>
An empty bin was created for you. The first HTTP POST or PUT request can upload data.
All following requests can only read the uploaded data.
</p>
2024-01-25 22:36:52 +01:00
<p>To change the default expiration date, you can use the <code>?ttl=<seconds_to_live></code> parameter.</p>
<p>Set the <code>Content-Type</code> header of the file you upload to make viewing easier.
<p>After uploading data, you can access it by accessing <a href="<%= bin_url %>"><%= bin_url %></a> with an optional file extension that suits the data that you uploaded.</p>
2023-11-06 21:53:45 +01:00
2024-01-25 22:36:52 +01:00
<h1>web upload</h1>
<label class="file">
2024-01-29 21:28:47 +01:00
<input type="file" id="file" aria-label="File browser">
<span class="file-custom"></span>
2024-01-25 22:36:52 +01:00
</label>
<button type="button" onclick="upload()">Upload</button>
2023-11-06 21:53:45 +01:00
2024-01-25 22:36:52 +01:00
<h1>upload an image</h1>
2023-11-06 21:53:45 +01:00
<pre>
2024-01-25 22:36:52 +01:00
$ curl -H "Content-Type: image/png" -T my-image.png <%= bin_url %>`
2023-11-06 21:53:45 +01:00
</pre>
2024-01-25 22:36:52 +01:00
<h1>create and upload tar</h1>
2023-11-06 21:53:45 +01:00
<pre>
2024-01-25 22:36:52 +01:00
$ tar -cz . | curl -T - -H "Content-Type: application/gzip" <%= bin_url %>
2023-11-06 21:53:45 +01:00
</pre>
</main>
2024-01-25 22:36:52 +01:00
<a class="watermark" href="https://pfzetto.de"><img src="https://pfzetto.de/pfzetto.svg" alt="pfzetto Logo"></a>
<% include!("./background.stpl"); %>
<script>
function upload() {
const input = document.getElementById("file");
const body = document.getElementById("main");
body.innerHtml = "uploading file. please keep this page open.";
fetch(window.location.pathname, {
method: 'POST',
headers: {
"Content-Type": input.files[0].type
},
body: input.files[0]
})
.then((response) => response.text())
.then((response) => {body.innerText = response;});
}
</script>
2023-11-06 21:53:45 +01:00
</body>
</html>