2021-01-05 17:46:28 -06:00
|
|
|
{% extends "base" %}
|
|
|
|
|
2021-01-05 19:38:36 -06:00
|
|
|
{% block styles %}
|
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
html, body {
|
|
|
|
overflow-y:hidden;
|
|
|
|
}
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
body {
|
|
|
|
height: 100vh;
|
|
|
|
font-family: monospace;
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
display: flex;
|
|
|
|
}
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
form { flex: 1; }
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
textarea {
|
2021-07-08 08:19:39 -05:00
|
|
|
height: 100%;
|
2021-06-18 20:12:22 -05:00
|
|
|
width: 100%;
|
2021-01-08 20:35:53 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
background: none;
|
|
|
|
border: none;
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
resize: none;
|
|
|
|
overflow: auto;
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
color: inherit;
|
2021-06-18 21:32:41 -05:00
|
|
|
font-family: monospace;
|
2021-06-18 20:12:22 -05:00
|
|
|
line-height: inherit;
|
|
|
|
}
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
button[type="submit"] {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 1rem;
|
|
|
|
right: 1rem;
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
height: 4rem;
|
|
|
|
width: 4rem;
|
|
|
|
border: none;
|
|
|
|
border-radius: 50%;
|
|
|
|
background: #F29718;
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
font-size: 0rem;
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
cursor: pointer;
|
|
|
|
}
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
*:focus {
|
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
button[type="submit"].hidden { display: none; }
|
2021-01-05 19:38:36 -06:00
|
|
|
{% endblock styles %}
|
|
|
|
|
2021-01-05 17:46:28 -06:00
|
|
|
{% block body %}
|
2021-06-18 20:12:22 -05:00
|
|
|
<form action="/submit" method="post">
|
2021-06-18 21:32:41 -05:00
|
|
|
<textarea name="val" style="resize: none" ondrop="dropHandler(event);" ondragover="dragOverHandler(event);" placeholder="
|
2021-06-18 20:12:22 -05:00
|
|
|
|
2021-07-08 08:19:39 -05:00
|
|
|
bin(3) BIN bin(3)
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 21:32:41 -05:00
|
|
|
NAME
|
2021-07-08 08:19:39 -05:00
|
|
|
|
2021-06-18 21:32:41 -05:00
|
|
|
bin - A highly opinionated and minamalistic Pastebin
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 21:32:41 -05:00
|
|
|
WEB USAGE
|
2021-07-08 08:19:39 -05:00
|
|
|
|
|
|
|
Drag a file and drop it here,
|
|
|
|
or After typing, press the big yellow button to paste, or
|
2021-06-18 21:32:41 -05:00
|
|
|
Just press Ctrl + Enter once done.
|
2021-01-05 19:38:36 -06:00
|
|
|
|
|
|
|
CLI USAGE
|
2021-07-08 08:19:39 -05:00
|
|
|
|
|
|
|
curl \
|
|
|
|
-Ls -o /dev/null \
|
|
|
|
-w %{url_effective} \
|
|
|
|
--data-binary @file.txt \
|
|
|
|
https://bin.wantguns.dev
|
2021-01-05 17:46:28 -06:00
|
|
|
|
2021-06-18 21:32:41 -05:00
|
|
|
Better use cases of CLI mentioned at Github
|
2021-01-05 17:46:28 -06:00
|
|
|
|
2021-06-18 21:32:41 -05:00
|
|
|
SEE ALSO
|
|
|
|
github.com/wantguns/bin
|
2021-01-05 17:46:28 -06:00
|
|
|
|
2021-06-18 21:32:41 -05:00
|
|
|
AUTHOR
|
|
|
|
Gunwant Jain
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-07-08 08:19:39 -05:00
|
|
|
2021-06-20 bin(3)
|
2021-06-18 21:32:41 -05:00
|
|
|
" autofocus autocomplete="off" autocorrect="off" autocapitalize="off"
|
2021-06-18 20:12:22 -05:00
|
|
|
spellcheck="false"></textarea>
|
|
|
|
|
|
|
|
<button type="submit" title="Paste">⎘</button>
|
|
|
|
</form>
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
<script>
|
|
|
|
const form = document.querySelector('form');
|
|
|
|
const input = document.querySelector('textarea');
|
|
|
|
const button = document.querySelector('button[type="submit"]');
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 21:32:41 -05:00
|
|
|
const onInput = () => button.classList.toggle('hidden', !input.value);
|
|
|
|
input.addEventListener('input', onInput);
|
|
|
|
onInput();
|
|
|
|
|
|
|
|
document.body.addEventListener('keydown', (e) => {
|
|
|
|
if (e.key === 'Enter' && e.ctrlKey) {
|
|
|
|
form.submit();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
async function postData(url = '', data) {
|
|
|
|
const response = await fetch(url, {
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
|
|
},
|
|
|
|
body: data
|
|
|
|
});
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
|
|
|
|
function dropHandler(ev) {
|
|
|
|
console.log('File(s) dropped');
|
2021-01-05 19:38:36 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
ev.preventDefault();
|
2021-01-05 17:46:28 -06:00
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
if (ev.dataTransfer.items) {
|
|
|
|
for (var i = 0; i < ev.dataTransfer.items.length; i++) {
|
|
|
|
if (ev.dataTransfer.items[i].kind === 'file') {
|
|
|
|
var file = ev.dataTransfer.items[i].getAsFile();
|
|
|
|
console.log('... file[' + i + '].name = ' + file.name);
|
|
|
|
|
|
|
|
var url = window.location.href;
|
|
|
|
|
|
|
|
postData(url, file)
|
|
|
|
.then(data => {
|
|
|
|
window.location.href = data.url;
|
|
|
|
})
|
|
|
|
.catch(function (err) {
|
|
|
|
console.info(err + " url: " + url);
|
|
|
|
});
|
|
|
|
}
|
2021-01-05 19:38:36 -06:00
|
|
|
}
|
2021-06-18 20:12:22 -05:00
|
|
|
} else {
|
|
|
|
for (var i = 0; i < ev.dataTransfer.files.length; i++) {
|
|
|
|
console.log('... file[' + i + '].name = ' + ev.dataTransfer.files[i].name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-06-18 21:32:41 -05:00
|
|
|
|
|
|
|
function dragOverHandler(ev) {
|
|
|
|
console.log('File(s) in drop zone');
|
|
|
|
|
|
|
|
ev.preventDefault();
|
|
|
|
}
|
|
|
|
|
2021-06-18 20:12:22 -05:00
|
|
|
</script>
|
|
|
|
{% endblock body %}
|