From eaa2551530f49f9a2b0e6aa2b40c64ba28a0be00 Mon Sep 17 00:00:00 2001 From: yariplus Date: Sat, 19 Mar 2016 13:07:41 -0400 Subject: [PATCH] gen random key when using internal. --- library.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/library.js b/library.js index c7f2115..26ee4bc 100644 --- a/library.js +++ b/library.js @@ -40,7 +40,17 @@ plugin.init = function(params, callback) { router.get('/api/admin/plugins/camo', controllers.renderAdminPage); SocketAdmin.settings.syncCamo = function () { - settings.sync(sync); + settings.sync(function(){ + if (settings.get('useCamoProxy')) { + require('crypto').randomBytes(48, function(err, buf) { + settings.set('key', buf.toString('base64').replace(/\//g, '=')); + settings.persist(); + sync(); + }); + }else{ + sync(); + } + }); console.log("Settings saved for Camo."); };