Friday, December 27, 2013

Setting proxy in Brackets(code editor for the Web).

Brackets
Brackets
Brackets is an open source code editor for the web. It's entirely developed using JavaScript, HTML and CSS by web developers like you. It's one of my favourite code editors besides WebStorm,PyCharm,Bluefish,etc..

As Brackets didn't provide the GUI interface for setting PROXY and PORT, you need to hack around a little bit  in the SOURCE CODE of the Brackets. I've already hacked it so this article provides you the details on setting the PROXY for Brackets. You can download the source code from GitHub.

you can use the command :

                 git clone https://github.com/adobe/brackets

or simply download the zip file from there.

Brackets does't work on Debian-7(wheezy) due to glibc version incompatibility, so to use Brackets in Wheezy, please download this test build Brackets-sprint-34. This release solves the bug  #4816 for glibc version incompatibility.

Let's set the proxy in Brackets.
Brackets is installed in /opt/brackets in Linux
So goto  /opt/brackets/www/extensibility/node/ExtensionManagerDomain.js

or by using the command in terminal :

               gedit /opt/brackets/www/extensibility/node/ExtensionManagerDomain.js


If you are using Brackets-sprint-34, then goto line number 382 and look for the function _cmdDownloadFile(downloadId, url, callback)   and 

change the line :
var req = request.get({
        url: url,
        encoding: null
    },

to

var req = request.get({
        proxy: 'http://proxy.adrress:port',
        url: url,
        encoding: null
    },

Here's a Screenshot :



if your proxy requires authentication then it should be like this :

var req = request.get({
        proxy: 'http://username:password@proxy.adrress:port',
        url: url,
        encoding: null
    },


for example :
var req = request.get({
        proxy: 'http://127.0.0.1:8080',
        url: url,
        encoding: null
    },

That's it, save the file and restart the Brackets. Now, you'll be able to install plugins.
If you have got any problem just throw a comment, i'll try to help you.