3 ms·
This is, of course, only serverless with regard to storage, not presentation. Is it feasible to also generate data: URIs that could be used offline? EDIT: Look
by shawnz 14y ago
This is, of course, only serverless with regard to storage, not presentation. Is it feasible to also generate data: URIs that could be used offline?
EDIT: Looks like another commenter has already developed a solution :)
- sciencerobot 14y agoHmmm.. Something like cat data.txt | ruby -ne 'require "uri"; print URI.escape($_)' > encoded.txt
- habosa 14y agoAbsolutely. See https://news.ycombinator.com/item?id=5696462 https://news.ycombinator.com/item?id=5696462. Basically just add some HTML and JavaScript to the link with the encoded content and you're good to go. But as I said in another comment, at that point you're just sending the text itself over the wire in a convoluted way without much space savings. At that point I'd just use some public key encryption and post the content directly (PGP?)
- shawnz 14y ago> at that point you're just sending the text itself over the wire in a convoluted way without much space savings Yes, in fact, with the solution linked, it's an increase in space requirements! In my experience, even with a traditional pastebin, the problem isn't being able to get the data over the wire -- it's formatting it. Also, this service opens up the possibility of (ab)using link shorteners for storage.
- roryokane 14y agoI’m sure it would be possible. You’d have to embed the CSS and JavaScript in https://github.com/lucaspiller/shortly https://github.com/lucaspiller/shortly into an HTML page, then represent that page as a data: URI. You could leave out the text-compression code and include only the decompression code, because the page only needs to decompress its embedded message. You would minify the code so there is less of it to store in the URL. You might even be able to shorten the URL by having the page bootstrap itself – DEFLATE all code except the code for INFLATEing, then INFLATE on the rest of the code for displaying the text, then run that code to INFLATE the text itself and display it. Alternatively, you could just give someone a Shortly link and write a note next to it saying “If that link doesn’t work, just run that URL’s hash fragment through Base64-decode followed by INFLATE”, relying on the user to search for suitable software in that case. That would not help a user who is offline, unless their OS comes with utilities for those algorithms, but it would help if you’re just worried about Shortly going down.