zeke / queriac

An experiment...
4 stars 5 forks source link

Bring Queriac back!! #3

Open rwdaigle opened 9 years ago

rwdaigle commented 9 years ago

Queriac holds such promise, and I miss it dearly. @zeke, bring it back (or at least let us know what your current state of mind is).

zeke commented 9 years ago

Sigh. Long story, but I'll try to keep it short.

The first two versions of Queriac were Rails-backed webservices with all the javascript commands stored in a postgres database. A simple bookmarklet would capture input from the browser's URL bar, assemble a query to the webservice, generate a script tag in the current window's DOM, and inject the response into the script tag to be evaled. This was always pretty easy to set up in hippie browsers like Firefox and Opera. It was always possible to enable Queriac in stupid browsers like IE and Safari, but it required hacks and/or custom software. For a long time it was easy to set up Queriac in Chrome, but that's no longer the case. The "start page" for Chrome is not a regular web page any more, and you can't access its DOM.

The current almost-but-not-quite-working version of Queriac is quite different. It's a GitHub-backed browser extension that executes javascript not from the URL bar but from within web pages. When you first use the extension, you point it at a GitHub repo. The extension then fetches the javascript files in that repo using the GitHub contents API, then stores the commands in a key-value object in the extension's local storage, which is not scoped per domain like regular localStorage. The extension throttles its requests to the GitHub API to avoid getting blocked.

The extension generates HTML and CSS for an Alfred-esque input widget, then injects it into every page you view, defaulting to a hidden state. Some keyboard action (currently double-tapping the shift key) reveals this input in the middle of the current webpage. The commands are all cached in local storage, so execution is much faster. No more round trip to the webservice, and no more privacy concerns about accidentally sharing your query history with the prying eyes of Zeke or whomever hacks Zeke's service.

The extension is written using the Crossrider API, an abstraction that makes it possible to write the extension once and build it for Chrome, Firefox, and IE. The development setup is using Browserify, a tool without which an extension this complicated would be hell to write.

So, the main benefits of the new design are:

But: This new approach may not work on sites like github.com and npmjs.com with a content security policy (CSP) that disallows eval. Most sites don't have these, but for security reasons they usually should. A proliferation of sites with CSPs might be a death knell for queriac-esque tools.

When I last worked on this in September 2014 at NodeConf EU, I got the new version Working on My Machine™, but I think it has my github repo URL hard-coded into the extension code. The next step was to make that into an configuration option in the extension, but I didn't get to it. Being a father means I don't have much spare time to hack on side projects like this any more, but I just might make the time, knowing that at least one other person cares to see this project live on :)

rwdaigle commented 9 years ago

Great summary, @zeke, thank you!

So the new design sounds great. Being GH backed is great, and the privacy is as well (not that I ever doubted your altruistic nature).

It sounds like the two major issues are:

This new approach may not work on sites like github.com and npmjs.com with a content security policy (CSP) that disallows eval.

and

Being a father means I don't have much spare time to hack on side projects like this any more

The first is a technical issue that may or may not have a solution (whether it's apparent right now or not). I say we keep moving forward despite this issue. It's better to have something working on 99% of the sites than nothing that works on 100%.

The second issue, well, I totally get it. What's the minimum that needs to happen to get Queriac in a working state for other users? If we can get to that point, it will probably be easier to recruit helpers and, thus, eliminate you or any one person as the bottle neck.

Say hi to Cosmos for me :)

d1b1 commented 9 years ago

@zeke I have been watching and waiting for this project since the 2014 Node Conf. Glad to hear its still in play. To second @rwdaigle happy to contribute.

One of my interests in the projects is the advent of services like zenBoard.io and any.do that use extensions to inject features into established services and UIs.