mirror of
https://github.com/reality/dbot.git
synced 2024-11-24 04:49:25 +01:00
use sandbox module for running untrusted code because it has a timeout
This commit is contained in:
parent
d72d5f5bdc
commit
9b1fd7aa4e
@ -37,7 +37,7 @@ var adminCommands = function(dbot) {
|
||||
|
||||
'unload': function(data, params) {
|
||||
if(dbot.moduleNames.include(params[1])) {
|
||||
dbot.moduleNames[params[1]] = undefined;
|
||||
delete dbot.moduleNames[params[1]];
|
||||
dbot.reloadModules();
|
||||
dbot.say(data.channel, 'Turned off module: ' + params[1]);
|
||||
} else {
|
||||
|
@ -1,12 +1,16 @@
|
||||
var vm = require('vm');
|
||||
var sandbox = require('sandbox');
|
||||
|
||||
var js = function(dbot) {
|
||||
var dbot = dbot;
|
||||
var s = new Sandbox();
|
||||
|
||||
var commands = {
|
||||
'~js': function(data, params) {
|
||||
var q = data.message.valMatch(/^~js (.*)/, 2);
|
||||
dbot.say(data.channel, vm.runInNewContext(q[1]));
|
||||
s.run(q[1], function(output) {
|
||||
dbot.say(data.channel, output.result);
|
||||
});
|
||||
},
|
||||
|
||||
'~ajs': function(data, params) {
|
||||
|
Loading…
Reference in New Issue
Block a user