5 ms·
Requires Ruby? Why...
by reustle 15y ago
Requires Ruby? Why...
- defunkt 15y agoChrome extensions can't access the local filesystem so we have to start a tiny webserver in the background. If someone knows a way around this limitation, or a simpler webserver to require / embed, I would be thrilled. But so far this is the best I've found.
- seanp2k 15y agoahahahahah what? Dude, do you work for Microsoft? "Well see, we just have to run MS-SQL server (DESKTOP OMG EXPRESS ENGINE) here, and then we run IIS on top of it to serve this file listing..."
- vijaydev 15y agoHe co-founded GitHub and is the CEO presently. That will be good enough for you?
- pyre 15y agoIt's a limitation of Chrome. This isn't the first time that someone tried to use a local webserver to do something that Chrome doesn't allow. IIRC, there was someone that used a webserver to implement a hacky version of It'sAllText! for Chrome.
- aboodman 15y agoDid you investigate requesting the files directly from the filesystem, like "file:///home/monkey/.js/google.com.js". You'd need to tell users to enable file access for the extension though chrome://extensions/, since that isn't enabled by default and users have to opt into it. I also don't know if there is a way to get the current user's homedir without hardcoding it. Also: you're being super careful to not allow arbitrary reading of the filesystem, right? A good sanity check would be to ensure that realpath() of any file served is under ~/.js before handing it off.
- mgurlitz 15y agoIt looks like Ruby is only needed for the file server. You could easily substitute a Python file server (cd .js; python -m SimpleHTTPServer 3131). You could use a remote Apache server for synchronizing your scripts. I agree that Ruby is a little overkill, but it is simple enough to run easily on a Mac, and it is extensible for hackers.
- defunkt 15y agoIf you use your own server make sure you set the Access-Control-Allow-Origin header: https://github.com/defunkt/dotjs/blob/master/bin/djsd#L26 https://github.com/defunkt/dotjs/blob/master/bin/djsd#L26 (Also, Ruby comes with OS X (just like Python) so it seemed a sane choice.)
- reustle 15y agoBut Python comes with OSX and Ubuntu
- cdcarter 15y agoBut Ruby is the language the developer uses when doing something basic like this?
- reustle 15y agoPython usually, as far as I can tell. Either language is fine, I just think these things should be done in something that comes pre-installed on more systems.
- getsat 15y agoFeel free to fork the project and make it Python-based. defunkt works at Github and does most of his work in Ruby from what I can see.
- cdcarter 15y agoI mean, I knew Chris years ago and his language of choice was Ruby, and I don't think it's changed. Sure basic install-ability is great, but I bet you this tool was made to satiate an itch he had, and he used the tools he's used to. Little apps like these aren't engineered. Just hacks, for hacks sake.