[Feature] Post text instead of uploading file
Opened this issue · 4 comments
Now the uploading feature works perfect, but is it possible to upload text instead of file? Then my phone can easily send messages to my laptop.
Thank you!
I wrote a simple page that saves the textarea to files.
<body>
<form><input type="button" value="Post"><textarea></textarea></form>
<script type="text/javascript">
document.getElementsByTagName('INPUT')[0].addEventListener('click', function() {
const val = document.getElementsByTagName('TEXTAREA')[0].value;
if (!val) {
return;
}
let xhr = new XMLHttpRequest;
let blob = new Blob([val], {type:'text/plain'});
let data = new FormData();
const ts = (new Date()).toISOString().replace(/:/g, '');
data.append('file', blob, ts + '.txt');
xhr.open('POST', '/upload?path=/postdata/', true);
xhr.send(data);
});
</script>
</body>
That would be really useful. I really thought about implementing this but felt that the ui on mobile is already bloated with the upload bloated and would be cumbersome with additional textarea.
I am no frontend-guy so I can't help with this unfortunately, but I think that the mobile UI needs a rework to hide these dialogues by default. This is especially needed as more boxes are added as with #512.
Also, the implementation i thought of would create a new api for a shared clipboard. So that instead of saving the data to the file system it saves the data to a shared buffer in memory that would be accessible for all clients.
This has the benifit of allowing sharing text between clients (not client to server only) but It also means that one can't send multiple messages unless he clears the previous one.
Would that suit your use case?
Yes, that's would be even better. Thank you!