shell: make require take a tag

This commit is contained in:
Girish Ramakrishnan
2024-10-14 19:10:31 +02:00
parent 02823c4158
commit a9e1d7641d
27 changed files with 162 additions and 156 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ const assert = require('assert'),
paths = require('./paths.js'),
safe = require('safetydance'),
settings = require('./settings.js'),
shell = require('./shell.js'),
shell = require('./shell.js')('network'),
validator = require('validator');
const SET_BLOCKLIST_CMD = path.join(__dirname, 'scripts/setblocklist.sh');
@@ -102,7 +102,7 @@ async function setBlocklist(blocklist, auditSource) {
// this is done only because it's easier for the shell script and the firewall service to get the value
if (!safe.fs.writeFileSync(paths.FIREWALL_BLOCKLIST_FILE, blocklist + '\n', 'utf8')) throw new BoxError(BoxError.FS_ERROR, safe.error.message);
const [error] = await safe(shell.promises.sudo('setBlocklist', [ SET_BLOCKLIST_CMD ], {}));
const [error] = await safe(shell.promises.sudo([ SET_BLOCKLIST_CMD ], {}));
if (error) throw new BoxError(BoxError.IPTABLES_ERROR, `Error setting blocklist: ${error.message}`);
}