demo is just a constant, not a setting
This commit is contained in:
@@ -23,6 +23,7 @@ exports = module.exports = {
|
||||
|
||||
const assert = require('assert'),
|
||||
BoxError = require('./boxerror.js'),
|
||||
constants = require('./constants.js'),
|
||||
cron = require('./cron.js'),
|
||||
fs = require('fs'),
|
||||
ipaddr = require('ipaddr.js'),
|
||||
@@ -89,7 +90,7 @@ async function setBlocklist(blocklist, auditSource) {
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.isDemo()) throw new BoxError(BoxError.CONFLICT, 'Not allowed in demo mode');
|
||||
if (constants.DEMO) throw new BoxError(BoxError.CONFLICT, 'Not allowed in demo mode');
|
||||
|
||||
// store in blob since the value field is TEXT and has 16kb size limit
|
||||
await settings.setBlob(settings.FIREWALL_BLOCKLIST_KEY, Buffer.from(blocklist));
|
||||
@@ -121,7 +122,7 @@ async function getIPv4Config() {
|
||||
async function setIPv4Config(ipv4Config) {
|
||||
assert.strictEqual(typeof ipv4Config, 'object');
|
||||
|
||||
if (settings.isDemo()) throw new BoxError(BoxError.BAD_FIELD, 'Not allowed in demo mode');
|
||||
if (constants.DEMO) throw new BoxError(BoxError.BAD_FIELD, 'Not allowed in demo mode');
|
||||
|
||||
const error = await testIPv4Config(ipv4Config);
|
||||
if (error) throw error;
|
||||
@@ -137,7 +138,7 @@ async function getIPv6Config() {
|
||||
async function setIPv6Config(ipv6Config) {
|
||||
assert.strictEqual(typeof ipv6Config, 'object');
|
||||
|
||||
if (settings.isDemo()) throw new BoxError(BoxError.BAD_FIELD, 'Not allowed in demo mode');
|
||||
if (constants.DEMO) throw new BoxError(BoxError.BAD_FIELD, 'Not allowed in demo mode');
|
||||
|
||||
const error = await testIPv6Config(ipv6Config);
|
||||
if (error) throw error;
|
||||
|
||||
Reference in New Issue
Block a user