Use BAD_STATE consistently for demo mode
This commit is contained in:
@@ -93,7 +93,7 @@ async function setBlocklist(blocklist, auditSource) {
|
||||
}
|
||||
|
||||
if (count >= 262144) throw new BoxError(BoxError.CONFLICT, 'Blocklist is too large. Max 262144 entries are allowed'); // see the cloudron-firewall.sh
|
||||
if (constants.DEMO) throw new BoxError(BoxError.CONFLICT, 'Not allowed in demo mode');
|
||||
if (constants.DEMO) throw new BoxError(BoxError.BAD_STATE, '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));
|
||||
@@ -125,7 +125,7 @@ async function getIPv4Config() {
|
||||
async function setIPv4Config(ipv4Config) {
|
||||
assert.strictEqual(typeof ipv4Config, 'object');
|
||||
|
||||
if (constants.DEMO) throw new BoxError(BoxError.BAD_FIELD, 'Not allowed in demo mode');
|
||||
if (constants.DEMO) throw new BoxError(BoxError.BAD_STATE, 'Not allowed in demo mode');
|
||||
|
||||
const error = await testIPv4Config(ipv4Config);
|
||||
if (error) throw error;
|
||||
@@ -141,7 +141,7 @@ async function getIPv6Config() {
|
||||
async function setIPv6Config(ipv6Config) {
|
||||
assert.strictEqual(typeof ipv6Config, 'object');
|
||||
|
||||
if (constants.DEMO) throw new BoxError(BoxError.BAD_FIELD, 'Not allowed in demo mode');
|
||||
if (constants.DEMO) throw new BoxError(BoxError.BAD_STATE, 'Not allowed in demo mode');
|
||||
|
||||
const error = await testIPv6Config(ipv6Config);
|
||||
if (error) throw error;
|
||||
|
||||
Reference in New Issue
Block a user