Skip to content

Commit

Permalink
gen random key when using internal.
Browse files Browse the repository at this point in the history
  • Loading branch information
yariplus committed Mar 19, 2016
1 parent 267bc9e commit eaa2551
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion library.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
};

Expand Down

0 comments on commit eaa2551

Please sign in to comment.