Live data from Hacker News

Itty Bitty: Sites contained within their own links

itty.bitty.site

91–100 of 111 posts

Re: Itty Bitty: Sites contained within their own links

#91

Earlier quoted context omitted.

It's like an image containing its own SHA2 hash. How is it possible?

Clever use of Javascript. a=document.querySelector('a');LZMA.compress(a.outerHTML,9,function(r){a.innerText=a.href='https://itty.bitty.site/#/?'+btoa(String.fromCharCode.apply(null,new Uint8Array(r)))})

This makes the whole "Sites contained within their own links" untrue. You need a server to host the javascript.

Re: Itty Bitty: Sites contained within their own links

#92
post #89

Earlier quoted context omitted.

Browsers have offline capabilities that are currently massively underutilized. You can store the LZMA scripts in IndexDB perhaps?

Unfortunately that comes with a bootstrapping problem: what if the first time you hit the link is when you aren't connected? If everything is embedded in the data URI and the link is in fact the data itself then it doesn't matter.

I think that's an acceptable requirement. After all, you wouldn't expect an app to work without downloading it. If instead of using lzma, gzip were used, I bet you'd be able to include some code that would unzip itself using the browser's unzip capability. I am not sure how much code that would take though.

Re: Itty Bitty: Sites contained within their own links

#93
post #89

Earlier quoted context omitted.

Unfortunately that comes with a bootstrapping problem: what if the first time you hit the link is when you aren't connected? If everything is embedded in the data URI and the link is in fact the data itself then it doesn't matter.

I think that's an acceptable requirement. After all, you wouldn't expect an app to work without downloading it. If instead of using lzma, gzip were used, I bet you'd be able to include some code that would unzip itself using the browser's unzip capability. I am not sure how much code that would take though.

Right, for an app that makes sense but the use case I mentioned was really just pure data. A ticket is rarely more than a qr code or some other identifier, whose veracity is then checked t the point of reading. In an arena full of people it’s not uncommon for cell towers to get overloaded, or you may be roaming if overseas and don’t want to waste data, or you’re on a moving train with no on board WiFi or if it has one it might not work right. In those cases (and it seems to happen to me a lot) I would’ve preferred that the ticket I received in my email was viewable offline, even if I’d never seen it before. With a data URI, that’s possible. It’s not an entirely contrived use case I don’t think.

Re: Itty Bitty: Sites contained within their own links

#94

A quine: https://itty.bitty.site/#/?XQAAAAIPAQAAAAAAAAAeGEPDwwAoaS2Sj...

nice! how did you do it?

As others have pointed out, it's not quite a quine and just some silly JavaScript that reads out its source from the DOM and feeds it back into a copy of Itty Bitty's URL generation algorithm.

Re: Itty Bitty: Sites contained within their own links

#95
post #22

I do something similar in a bookmarklet to give myself a nice looking notepad. It's essentially a padded content editable div, with a prepopulated H1. This lets me print it out or save it as a document when needed. Which is never.

Oh yeah!

data:text/html,

That's one of my favorite "stupid HTML tricks". I wonder who first figured it out? I can't find the original blog post (if it even was) and now it's a known thing:

https://news.ycombinator.com/item?id=6005295

https://www.simonewebdesign.it/how-to-make-browser-editor-wi...

etc...

Re: Itty Bitty: Sites contained within their own links

#97
post #69
post #15

Earlier quoted context omitted.

What would such a cross-site scripting vuln do? There isn't anything to steal. Moreover you wouldn't use this for anything where you aren't in control of where people get the links from, because as soon as someone else starts sharing it they can of course edit it too.

The trustworthiness of the domain name would effectively be stolen.

I disagree. It's more similar to how you can "inject" your scripts into fiddle.jshell.net (via JSFiddle), googleusercontent.com (via Google Translate), etc.

Have a look at https://fiddle.jshell.net/pvcL4mjh/1/show/light/

Would you call that XSS / did I just steal JSFiddle's trustworthiness?

Re: Itty Bitty: Sites contained within their own links

#98

Earlier quoted context omitted.

OK so you keep following the links (by copying and pasting into your address bar) and after about four links it says "oh hi ". Explain yourself! How did you do this?! Impressive!

Simple! 0. Write oh hi :D, get link0 1. Paste link0, get link1 2. Paste link1, get link2 ... Encoding goes E(T), E(E(T)), etc. let K be the per-char encoding overhead, so E(T) = KT: complexity is O(K^N * T) where N is number of levels and T is length of text at level 0!

D'oh! You're right! That IS simple!
Post reply on HN