diff --git a/lib/server/config.js b/lib/server/config.js index c45bc302..f5a4aa6d 100644 --- a/lib/server/config.js +++ b/lib/server/config.js @@ -21,6 +21,7 @@ pipe = require('pipe-io'), ponse = require('ponse'), + json = require('jonny'), apiURL = CloudFunc.apiURL, @@ -50,7 +51,7 @@ } function save(callback) { - var data = Util.json.stringify(config); + var data = json.stringify(config); check(arguments, ['callback']); @@ -110,7 +111,7 @@ } function get(req, res) { - var data = Util.json.stringify(config); + var data = json.stringify(config); ponse.send(data, { name : 'config.json', @@ -130,7 +131,7 @@ pipe.getBody(req, function(error, body) { var data = '', - json = Util.json.parse(body) || {}; + json = json.parse(body) || {}; if (error) callback(error); diff --git a/lib/server/rest.js b/lib/server/rest.js index f0e5e4b0..03282685 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -29,32 +29,12 @@ ponse = require('ponse'), rendy = require('rendy'), copymitter = require('copymitter'), - tryCatch = require('try-catch'), + json = require('jonny'), check = require('checkup'), Modules = require(DIR_JSON + 'modules'), - isWin32 = process.platform === 'win32', - - json = { - parse: function(str) { - return this._try(str, JSON.parse); - }, - - stringify: function(json) { - return this._try(json, JSON.stringify); - }, - - _try: function(data, fn) { - var ret; - - tryCatch(function() { - ret = fn.call(JSON, data); - }); - - return ret; - } - }; + isWin32 = process.platform === 'win32'; /** * rest interface diff --git a/package.json b/package.json index e0c1a25e..3882c0b3 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "http-auth": "~2.2.3", "jag": "~1.0.0", "join-io": "~1.3.0", + "jonny": "~1.0.0", "markdown-it": "~3.0.7", "mellow": "~1.0.0", "minify": "~1.4.0", @@ -52,7 +53,6 @@ "rendy": "~1.0.2", "restafary": "~1.1.0", "socket.io": "~1.3.3", - "try-catch": "~1.0.0", "tryrequire": "~1.1.5" }, "devDependencies": {