87 lines
2.6 KiB
HTML
87 lines
2.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>sfb</title>
|
|
<style>
|
|
html {
|
|
color-scheme: dark;
|
|
}
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
color: #d7d4cf;
|
|
background-color: rgb(30, 33, 34);
|
|
}
|
|
|
|
textarea {
|
|
width: 100%;
|
|
height: 200px;
|
|
margin-bottom: 1rem;
|
|
}
|
|
button {
|
|
padding: 0.5rem 1rem;
|
|
font-size: 1rem;
|
|
}
|
|
.output {
|
|
font-family: monospace;
|
|
}
|
|
code {
|
|
display: block;
|
|
background: #f4f4f4;
|
|
padding: 0.5rem;
|
|
border: 1px solid #ddd;
|
|
margin: 1rem 0;
|
|
white-space: pre-wrap;
|
|
}
|
|
body > * {
|
|
border-color: rgb(58, 62, 65);
|
|
background-color: rgb(30, 33, 34);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre>Suckless File Bin</pre>
|
|
<pre>================</pre>
|
|
<pre></pre>
|
|
<pre>Temporary file hoster.</pre>
|
|
<pre>You can either enter text below and click submit to create a link or use CURL/other http client to send POST request for creating links</pre>
|
|
<pre>CURL example:</pre>
|
|
<code>curl -F'file=@yourfile.png' https://bin.night0721.xyz</code>
|
|
<pre>Server will responde with a URL to your file, e.g. https://bin.night0721.xyz/abcd</pre>
|
|
<textarea id="pasteContent" placeholder="Type or paste your content here..."></textarea>
|
|
<button onclick="submitPaste()">Submit</button>
|
|
<pre id="output" class="output" style="display: none;"></pre>
|
|
|
|
<script>
|
|
async function submitPaste() {
|
|
const content = document.getElementById('pasteContent').value.trim();
|
|
if (!content) {
|
|
alert('Please enter some content.');
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const response = await fetch('https://bin.night0721.xyz', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'text/plain' },
|
|
body: content
|
|
});
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`Server responded with status: ${response.status}`);
|
|
}
|
|
|
|
const result = await response.text();
|
|
const output = document.getElementById('output');
|
|
output.style.display = 'block';
|
|
output.innerHTML = `File URL: <a href="${result}" target="_blank">${result}</a>`;
|
|
} catch (error) {
|
|
alert('Error: ' + error.message);
|
|
}
|
|
}
|
|
</script>
|
|
|
|
|
|
</body></html>
|