uploadserver
uploadserver copied to clipboard
New Feature: Receive Free Text from Clients
Sometimes I want to just share small chunk of text between devices, or copy text from one device and paste in another device. It is not easy for mobile phones to create a text file and post that file to server. So I added a "textarea" in the upload page. This allows clients to post free text. Optionally, there can be 2 cmd line options (no implemented yet):
- server-message: If it is a file, set the file content to the "textarea" so client can see it. If it is not a file, treat it as a message and set it to "textarea".
- client-message: if specified, log clients free text to the file. Default to stdout.
Interesting idea. Can you give me some more details about the intended use case, so we can evaluate the tradeoffs of adding this? On mobile, I usually find it fairly difficult to paste things into text boxes. What size of text files are you usually uploading, and where do they come from? This sounds like the sort of thing that a mobile text editor should be able to help with.
I'm not a fan of allowing logging uploaded files to stdout - that would lead to a lot or tricky edge cases for large or binary files.
Sure, here are some use cases:
- I see an article on my phone. I want to send its URL to my PC.
- I received an SMS text on my phone. I want to copy the content to my PC.
- I want to share some notes from iPhone to a PC running Linux. iCloud syncing is not available on Linux.
- Other short text contents...
Uploadserver is file based. If you want to share free text, you have to save it to a text file first, even the text file will be only a few bytes. This is heavy. While sharing based on free text is lightweight, just like chatting.
It's not so easy for a mobile phone to create a text file, especially for iOS devices, which have only weak "file manager" oncept, comparing to PC. Even on Android, I never used a phone which has a built-in text editor App. You have to install a 3rd-party text editor. Another file sharing utility "localsend" has the function to share free text https://github.com/localsend/localsend
An HTML textarea is not a textbox. Textarea is resizeable. I set its default size to 100% width of the webpage, and 5 lines height. This is much larger than a small textbox. It's friendly to moble devices. You can run with my modifications to see what it looks like.
Logging to stdout is just a fallback behavior. Anyway, you have to ouput it somewhere when a user does not specify a log file. It is used to log text contents only, not binary contents.
For most of the examples you give, the most user-friendly approach would be a text field that is synced between clients. This would be a bit different from how uploadserver operates, especially regarding security expectations (it sounds like your text sharing proposal is mainly for use by a single person).
Have you looked at making a new server for this purpose? It should not be too hard to do, building off http.server in the same way uploadserver does. I have an iphone too, so I'd probably use something like that myself.
Yes, the use cases mentioned tends to be used personally. Syncing between iOS/Android/Windows often involves a 3rd party App that transfers the traffic through Internet. I want to keep the traffic in LAN only, not through Internet. I do not want to mess my devices with Apps too. If you choose not to add this function. I will keep it myself as a personal mod.
The syncing app options for iPhone are pretty limited. Syncthing works pretty well on Android, but it doesn't support iPhone (and is file-based like uploadserver).
It certainly sounds useful but is too far out of scope for uploadserver, so I'm going to close this PR. If you polish it up into something that automatically syncs text between multiple clients I'd encourage you to publish it though.