![Gunwant Jain](/assets/img/avatar_default.png)
a simple, minimalistic frontend for pasting texts the objectively easy way for those not comfortable with CLI. Signed-off-by: Gunwant Jain <mail@wantguns.dev>
127 lines
2.6 KiB
Plaintext
127 lines
2.6 KiB
Plaintext
{% extends "base" %}
|
|
|
|
{% block styles %}
|
|
|
|
html, body { margin: 0; }
|
|
|
|
body {
|
|
height: 100vh;
|
|
/* padding: 2rem; */
|
|
line-height: 1.1;
|
|
font-family: monospace;
|
|
|
|
display: flex;
|
|
}
|
|
|
|
form { flex: 1; }
|
|
|
|
textarea {
|
|
height: 100%;
|
|
width: 100%;
|
|
|
|
background: none;
|
|
border: none;
|
|
|
|
resize: none;
|
|
overflow: auto;
|
|
|
|
color: inherit;
|
|
font-family: inherit;
|
|
font-size: 1rem;
|
|
line-height: inherit;
|
|
}
|
|
|
|
button[type="submit"] {
|
|
position: absolute;
|
|
bottom: 1rem;
|
|
right: 1rem;
|
|
|
|
height: 4rem;
|
|
width: 4rem;
|
|
border: none;
|
|
border-radius: 50%;
|
|
background: #F29718;
|
|
|
|
font-size: 0rem;
|
|
|
|
cursor: pointer;
|
|
}
|
|
|
|
textarea:focus, input:focus{
|
|
outline: none;
|
|
}
|
|
|
|
*:focus {
|
|
outline: none;
|
|
}
|
|
|
|
|
|
button[type="submit"].hidden { display: none; }
|
|
{% endblock styles %}
|
|
|
|
{% block body %}
|
|
<form action="/submit" method="post">
|
|
<textarea name="val" placeholder="
|
|
|
|
========
|
|
|
|
WEB USAGE
|
|
---------
|
|
|
|
Soon as you start typing a big yellow button should appear on the bottom right.
|
|
You could either press that to paste.
|
|
|
|
or
|
|
|
|
Just press Ctrl + Enter once done.
|
|
|
|
|
|
CLI USAGE
|
|
---------
|
|
|
|
POST /
|
|
|
|
accepts raw data in the body of the request and responds with a URL
|
|
of a page containing the body's content
|
|
|
|
GET /<id>
|
|
|
|
retrieves the content for the paste with id `<id>`
|
|
|
|
GET /p/<id>
|
|
|
|
retrieves the HTML page with syntax-highlighted content for the paste
|
|
with id `<id>`
|
|
|
|
CLI EXAMPLES
|
|
------------
|
|
|
|
Paste a file named 'file.txt' using cURL:
|
|
|
|
curl --data-binary @file.txt https://bin.wantguns.dev
|
|
|
|
|
|
========
|
|
|
|
open-sourced at: github.com/wantguns/bin" autofocus autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
|
|
|
|
<button type="submit" title="Paste">⎘</button>
|
|
</form>
|
|
|
|
<script>
|
|
const form = document.querySelector('form');
|
|
const input = document.querySelector('textarea');
|
|
const button = document.querySelector('button[type="submit"]');
|
|
|
|
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();
|
|
}
|
|
});
|
|
</script>
|
|
{% endblock body %}
|