iwasnot
This commit is contained in:
@@ -22,10 +22,12 @@ async function opnsenseRequest(method, path, body = null) {
|
||||
method,
|
||||
headers: {
|
||||
'Authorization': `Basic ${auth}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
};
|
||||
if (body) opts.body = JSON.stringify(body);
|
||||
if (body) {
|
||||
opts.headers['Content-Type'] = 'application/json';
|
||||
opts.body = JSON.stringify(body);
|
||||
}
|
||||
const res = await fetch(`${process.env.OPNSENSE_HOST}${path}`, opts);
|
||||
const text = await res.text();
|
||||
try {
|
||||
@@ -80,9 +82,7 @@ export function enqueueNatRemove(ip, port, proto = 'tcp/udp') {
|
||||
info(rule.descr);
|
||||
if (rule.descr === `pelican-${ip}-${port}`) {
|
||||
info(JSON.stringify(rule));
|
||||
let res = await opnsenseRequest('POST', `/api/firewall/d_nat/delRule`, {
|
||||
uuid: rule.uuid,
|
||||
});
|
||||
let res = await opnsenseRequest('POST', `/api/firewall/d_nat/delRule/${rule.uuid}`);
|
||||
info(JSON.stringify(res));
|
||||
success(`deleted rule udp+tcp at ${ip}:${port}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user