Skip to content

Commit

Permalink
allow_arbitrary_scripts config option
Browse files Browse the repository at this point in the history
  • Loading branch information
fohristiwhirl committed Feb 24, 2021
1 parent 1239649 commit 38e4a28
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/95_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1314,12 +1314,14 @@ function NewRenderer() {
let s = buf.toString();
let lines = s.split("\n").map(z => z.trim()).filter(z => z !== "");

for (let line of lines) {
for (let d of disallowed) {
if (line.startsWith(d)) {
this.set_special_message(`${messages.invalid_script}`, "yellow");
console.log(`Refused to run script: ${filename}`);
return;
if (!config.allow_arbitrary_scripts) {
for (let line of lines) {
for (let d of disallowed) {
if (line.startsWith(d)) {
this.set_special_message(`${messages.invalid_script}`, "yellow");
console.log(`Refused to run script: ${filename}`);
return;
}
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3239,6 +3239,17 @@ function menu_build() {
});
}
},
{
label: "Allow arbitrary scripts",
type: "checkbox",
checked: config.allow_arbitrary_scripts,
click: () => {
win.webContents.send("call", {
fn: "toggle",
args: ["allow_arbitrary_scripts"],
});
}
},
{
type: "separator"
},
Expand Down
1 change: 1 addition & 0 deletions src/modules/config_io.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ exports.defaults = {
"animate_delay_multiplier": 4,

"vms_ordering": false,
"allow_arbitrary_scripts": false,

"search_nodes": null,
"search_nodes_special": 4000,
Expand Down

0 comments on commit 38e4a28

Please sign in to comment.