From 5e8a74f95bbf17510d455d54423f8acc023fd511 Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Wed, 16 Jul 2014 18:45:50 +0200 Subject: [PATCH 1/2] Suppress deprecation notice on latest v of body-parser --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index ac2de46..a7622e6 100644 --- a/index.js +++ b/index.js @@ -104,7 +104,7 @@ var bootstrap = function(http_srv) { /* App Configuration */ app.use('/', express.static(__dirname + '/controls')); - app.use(require('body-parser')()); + app.use(require('body-parser').json()); app.use(require('method-override')()) app.get('/proxy', function(req, res, next) { From f615488b374075dbf5bc6b56bebcb815f8ff0d55 Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Wed, 16 Jul 2014 20:10:37 +0200 Subject: [PATCH 2/2] Settings + basic example --- controls/strip/index.html | 5 +++++ index.js | 14 +++++++++++++- lib/defaults.json | 4 ++++ lib/tabs.js | 12 ++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 lib/defaults.json diff --git a/controls/strip/index.html b/controls/strip/index.html index 8d5f681..2bf1722 100644 --- a/controls/strip/index.html +++ b/controls/strip/index.html @@ -60,6 +60,11 @@ diff --git a/index.js b/index.js index a7622e6..946b315 100644 --- a/index.js +++ b/index.js @@ -39,7 +39,8 @@ var bootstrap = function(http_srv) { */ devtools: require('./lib/devtools.js').devtools({ http_port: http_port - }) + }), + defaults: require('./lib/defaults.json') }; breach.init(function() { @@ -53,6 +54,11 @@ var bootstrap = function(http_srv) { breach.expose('init', function(src, args, cb_) { async.parallel([ + function(cb_) { + breach.module('core').call('settings_init', { + defaults: common._.defaults + }, cb_); + }, common._.box.init, common._.tabs.init, common._.strip.init, @@ -110,6 +116,12 @@ var bootstrap = function(http_srv) { app.get('/proxy', function(req, res, next) { request(req.param('url')).pipe(res); }); + + app.get('/settings', function(req, res, next) { + breach.module('core').call('settings_get', null, function(err, settings) { + res.json(settings); + }); + }); var http_srv = http.createServer(app).listen(0, '127.0.0.1'); diff --git a/lib/defaults.json b/lib/defaults.json new file mode 100644 index 0000000..e639f03 --- /dev/null +++ b/lib/defaults.json @@ -0,0 +1,4 @@ +{ + "height": 45, + "antialiasing": true +} \ No newline at end of file diff --git a/lib/tabs.js b/lib/tabs.js index 704c48b..e2503bb 100644 --- a/lib/tabs.js +++ b/lib/tabs.js @@ -537,6 +537,17 @@ var tabs = function(spec, my) { }); break; } + case 'Module Settings': { + breach.module('core').call('tabs_new', { + url: 'breach://modules/#/mod_strip/settings', + visible: true, + focus: true + }, function(err, res) { + console.log('[settings]', res); + }); + + break; + } } } }; @@ -557,6 +568,7 @@ var tabs = function(spec, my) { var items = [ 'Reload', + 'Module Settings', null, 'Inspect Element', 'Close DevTools'