
Shortly: a Serverless Pastebin Service - All Data is Stored in the URL - edtechdev
http://stackednotion.com/shortly/#TVO7jtwwDOz9FQSuSLPwLoIgRboAFyQHpMqjSClLtCWsJBoitc7+fShp75BOGJPDmSH901OReIfAYICx3LBEZIbdsOAScseCxRm+6Ke7+JA38GbfMTNQBvEINgbMAhwcnsBk10FnxDRWFiroIIzS3z++z9P09ATf6IAgcFC58jQ9P4otpb3oeG2o3CZ1JlyjEQQTNypBfDo1OMNiGD9+AMyWnDYI6ZNrwcZrjX7H1+FsVmwes3psCuBF2rTOwihg+huOkB0dcyRrJFCevWEPtA6PtZRmcjcbqoPnsK7YgaXQoRmxhnJTrW94DCkIv7YLiYltNkTMm/gTeDpQEwVTqGpk7y+XC1hvirHS2BgxcfOkLhpBQc0mYXYPO5DM35BqmuGz9IJEqY3VZ0uAXwWr7Uxjaz2glYodjF3gfzp0Otor19RvwT0i7aDWG90VwtbCivFtwZrEH6qq5T50hnwdWzNdCTfdWn+HSArXEpVZ5elyAnPVa1mqjOrA+d0wYnWtM/xClka1BJm1v1/VbEl3JP5B3enaAanSBlOVQcszNFWWanSg5nILdhxgUk9qQkNq10DF6UNdOlU5qJtQxbq5eZzqVzX9km8Ub+imyYvs/Ol83rS6LiopnWNVzXuIEcuZx//0Dw==9
======
jstalin
I tried pasting War and Peace... it created a 435 page URL but both bitly and
goo.gl were unable to shorten it :(

I'm able to paste the URL in firefox, but Chrome doesn't allow it.

~~~
jtchang
Stop trying to break the whole damn internet!

~~~
edoloughlin
What happens if you paste some shortly links?

------
residualmind
After I saw this, I had to make something like it that's completely contained
in the uri itself.. :D

data:text/html;,<textarea id="txt" cols=80 rows=24>hello
there</textarea><br><input value="get link" type=button
onclick="(function(){document.location.href=(document.location.href.replace(/24\>.*<\/textarea>/,'24>'+document.getElementById('txt').value+'&lt;/textarea&gt;'));
}())">

~~~
habosa
This could be combined with whatever algorithm is being used on Shortly. This
still needs the Shortly website for decoding ... your method would allow the
embedding of the encoding/decoding function in the link itself which is more
interesting imo. The added length of some obfuscated JavaScript will be very
small compared to large-content links.

~~~
residualmind
Now in Base64, which makes the link longer, but is in most modern browsers...
I should really get back to work, this is just too much fun.

data:text/html;base64,PHRleHRhcmVhIGlkPSJ0eHQiIGNvbHM9ODAgcm9
3cz0yND47byk8L3RleHRhcmVhPjxicj48aW5wdXQgdmFsdWU9ImdldCBsaW5r
IiB0eXBlPWJ1dHRvbiBvbmNsaWNrPSIoZnVuY3Rpb24oKXtkb2N1bWVudC5sb
2NhdGlvbi5ocmVmPSdkYXRhOnRleHQvaHRtbDtiYXNlNjQsJysod2luZG93Lm
J0b2Eod2luZG93LmF0b2IoZG9jdW1lbnQubG9jYXRpb24uaHJlZi5zdWJzdHI
oMjIpKS5yZXBsYWNlKC8yNFw+Lio8XC90ZXh0YXJlYT4vLCcyND4nK2RvY3Vt
ZW50LmdldEVsZW1lbnRCeUlkKCd0eHQnKS52YWx1ZSsnJmx0Oy90ZXh0YXJlY
SZndDsnKSkpfSgpKSI+

~~~
habosa
This is awesome, that's exactly what I was talking about. This is truly
"serverless" whereas Shortly is not. Also if the creator of Shortly is reading
my comments, I apologize for the negativity I was mostly just thinking out
loud. Kudos to you for making something interesting and putting it out there.

~~~
residualmind
I fixed and cleaned it up a little. Put it into tinyurl, just to be able to
post it here properly (reload once after clicking)
<http://tinyurl.com/cu3zcjy>

------
habosa
In theory won't it now take just as long to transmit the link as it would to
transmit the content itself? I get that this is cool from a "can't take it
down" standpoint but I feel like if you're going to have to copy and paste a
link containing the entire content you might as well just copy and paste the
content.

Then again, you could just offload the work to bit.ly and get around that
issue.

~~~
roryokane
Shortly compresses the text using the DEFLATE algorithm
(<http://en.wikipedia.org/wiki/DEFLATE>) followed by Base64 encoding
(<https://en.wikipedia.org/wiki/Base64>) before storing it in the URL. Base64
increases the size of data by 33%, but DEFLATE usually decreases the size by
more than that. Thus, the link will usually be shorter than the content.

~~~
habosa
I'm sure it will be somewhat shorter than the content but it will definitely
be in the same order of magnitude and likely within a factor of 2. A link that
is half as long as its content is pretty unwieldy and will take non-trivial
time to transmit at longer lengths. Sort of defeats the point of a link in the
first place.

~~~
calinet6
Yes. You might as well just send a gzip'd file directly. It will be higher
compression than Deflate (or if not, use BZip or 7zip), won't have the Base64
overhead, and (gasp) won't depend on a web service to decode. It also has the
distinct advantage of not being really friggin annoying.

In other words, this is entirely useless, except as an amusement. Because it's
funny how useless it is.

~~~
lelandbatey
Well, except that it's a web site. That's why I would be attracted to this:
it's something that I can send to anybody and it will always, always work. No
hassle.

~~~
calinet6
True, as a service in that respect it's useful.

But it still seems a bit unreliable. Accidentally clip a character off the URL
and you're basically screwed.

~~~
tfb
You could say the same about any computer generated (hashed) URL.

------
siliconc0w
Friend of mine made <http://alfg.co/jot/> which supports encryption.

I made the same observation re: just sending the message:
<https://github.com/alfg/jot/issues/1>

------
jstalin
I would really love to see Shortly plus the Stanford Javascript Crypto Library
to be able to create encrypted and password-protected serverless pastebins.

<http://crypto.stanford.edu/sjcl/>

~~~
fosap
Javascript crypto does not work. The server can the manipulate the JS to send
back the text, so it could be server side in first place. And serverside
crypto is worse than useless.

~~~
jvictor118
Why? This seemed like a good idea to me. I want to be able to decrypt messages
sent client-side. My plan was to have a nodejs proxy that gets the data,
encrypts it, and then I decrypt client side using this lib. Problem?

~~~
fosap
If you do not load the any executable code from the network not. It should be
Javascript Crypto in the browser does not work.

The problem is of course not specifiy to javascript. It should be "fat client
crypto does not work".

------
shawnz
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 :)

~~~
habosa
Absolutely. See <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
> 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.

------
recursive
Instead of sharing shortly URLs, why not just share text?

~~~
ecubed
IRC chat would be my guess. Since data isn't stored on a server/can't be taken
down, this seems like this could be useful in the shadier IRC rooms sharing
questionable content.

~~~
jstanley
If you're pasting the link, you may as well just paste the text.

The link is really just an encoded form of the text anyway.

EDIT: Not to shit on this project, it's just that pastebin's are typically
used to reduce the amount of text that gets pasted in an IRC channel.

~~~
bluedino
They're probably working on an (small) image 'host' using this same idea.

------
lucaspiller
Hey, I'm the creator. I wondered why there were two issues raised within 24
hours, checked here, and well, that explains it... I've just fixed the async
error (#4), so any of you having issues with "$ not defined" should have them
solved now.

This was originally covered here a year ago:

<https://news.ycombinator.com/item?id=3834643>

Any questions, reply to me or raise an issue on GitHub! Thanks!

------
onster
I don't understand it. Are you trying to compete with Google?
[http://www.google.com/webhp#q=%42%54%57%2c%20%74%68%65%20%6e...](http://www.google.com/webhp#q=%42%54%57%2c%20%74%68%65%20%6e%61%6d%65%20%53%68%6f%72%74%6c%79%20%69%73%20%71%75%69%74%65%20%69%72%6f%6e%69%63%2e)

------
tyilo
Doesn't work for me: Uncaught ReferenceError: $ is not defined

------
dools
I love it!

For me the big benefit here is that when I'm communicating code snippets that
are often "format sensitive" through channels such as IRC, email or project
management tools (like basecamp) I will almost always use a paste service in
order to ensure that no crap creeps in throughout the process. I most
frequently either use sprunge.us or pastie.org and grab the "raw" URL before
pasting it in.

This does, however, create an external dependency, and it has happened before
that pastie.org was down and a bunch of tasks I had meticulously created
couldn't be read by the person who was supposed to be doing them (it didn't
last long but it was annoying).

Sprunge.us is actually open source so you can grab and host your own, but that
takes a little time and effort and I've never ended up bothering ... THIS, on
the other hand, provides a handy way for me to create these little "pastes"
and share them with my team, secure in the knowledge that if things bum out I
can, at a pinch, get an alternative service live to read the formatted data
in.

Of course, this doesn't apply if the URL has been shortened ;)

Speaking of which, you could stick a URL shortener in pretty easily based on
the one I did for CueYouTube[1]. I used this library
<http://www.myjqueryplugins.com/jquery-plugin/jly1> which has an API that
works entirely on the client side.

Kudos!

[1]<http://www.cueyoutube.com>

------
greenyoda
Is there a maximum length for the URL?

~~~
Permit
Yes and it's browser dependent. Generally once you're in the range of ~2,000
characters the URL is too long.

[http://stackoverflow.com/questions/417142/what-is-the-
maximu...](http://stackoverflow.com/questions/417142/what-is-the-maximum-
length-of-a-url-in-different-browsers)

------
InclinedPlane
Step 2: create a URL shortening service that uses the same scheme.

Edit: Actually, now that I think of it, I might do that as a project.

------
xSwag
I'm getting

    
    
        Uncaught ReferenceError: $ is not defined
    

Chromium Version 25.0.1364.160 Debian 7.0 (186726)

~~~
matchu
I did at first, but then it worked on refresh. Go figure.

~~~
isalmon
Perhaps JQuery gets included at the bottom of the page, but then when you
refresh - it's cached and the code is working

~~~
RKearney
All the scripts have the async property so they're not executing in sequence.

------
jokoon
okay now I think we really need to kill the web, and start to develop other
techs.

------
correnos
What advantage does this site give over just pasting the data directly? The
shortened URL aspect is gone, so the only "advantage" I can see is
obfuscation. And if you want that you can base64 your text directly.

------
mlreed328
Simply does not work for me.

------
ontouchstart
I have been doing this for a while on my iPhone via twitter:
<http://twitter.com/ontouchstart>

~~~
taternuts
This one is fun: <http://t.co/Fa52L70CLN>

------
matb33
So someone made one, cool! <https://news.ycombinator.com/item?id=5051047>

------
motyard
Good, but there is a limit. I once made this on same principle
<http://motyar.info/quotes>

------
jaredstenquist
It didn't work with 5 paragraphs of lorem ipsum. There was no error from the
site to tell me it was too long. It needs some basic validation

~~~
prawn
Tried it twice and it didn't work for me either, also without any noticeable
error (Chrome/OSX).

------
captn3m0
Similar service, with link shortening and markdown support:
<http://hashify.me/>

~~~
errnoh
Yeah, pretty much same service (from couple years ago). Shortly does seem to
have a bit larger character limit though.

------
downandout
Interesting, but given the URL length issues, this isn't really useful for
most applications that you would use pastebin for.

------
startswithaj
I have to fire the url twice in chrome in console I get

uncaught ReferenceError: $ is not defined

Is it firing some code before it can load Jquery?

~~~
startswithaj
It needs a $ on the first line of shortly.js (function() { >>>$(function() {

~~~
lucaspiller
I'm the creator. Fixed now :)

------
jvictor118
I got this: Please let me know if this isn't what you're looking for.

------
mtthw
BEHOLD!!!

data:text/html, your notesy stuff

------
orangethirty
Hmm, this could work very well for search. Forking... (:

------
nodata
How is this serverless?

Edit: shawnz already mentioned this.

------
Nux
Haha! This will piss off some people on Freenode who always send you to a
pastebin if you have more than 2 lines of stuff to paste! :)

------
ereckers
No va w/ Chrome + Win7

------
fidz
somehow, it doesn't work in my Chrome (Chrome 25)

------
the1
doesn't work with unicode.

------
rorrr2
IE URL character limit = 2,083

<http://support.microsoft.com/kb/208427>

