diff --git a/nodejs/models/host.js b/nodejs/models/host.js index fc57527..bf1cef7 100755 --- a/nodejs/models/host.js +++ b/nodejs/models/host.js @@ -30,7 +30,20 @@ class Host extends Table{ 'targetssl': {isRequired: false, default: false, type: 'boolean'}, 'is_cache': {default: false, isRequired: false, type: 'boolean',}, - + + // Per-host reverse-proxy controls. Enforced in OpenResty by + // ops/nginx_conf/hostfeatures.lua, which reads these straight off the + // Redis hash. Object fields are JSON-encoded by model-redis. + 'ratelimit_enabled': {default: false, isRequired: false, type: 'boolean',}, + 'ratelimit_rate': {default: 10, isRequired: false, type: 'number', min: 1, max: 1000000}, + 'ratelimit_burst': {default: 20, isRequired: false, type: 'number', min: 0, max: 1000000}, + 'respcache_enabled': {default: false, isRequired: false, type: 'boolean',}, + 'hsts_enabled': {default: false, isRequired: false, type: 'boolean',}, + 'req_headers': {default: function(){return {}}, isRequired: false, type: 'object',}, + 'resp_headers': {default: function(){return {}}, isRequired: false, type: 'object',}, + 'ip_allow': {default: function(){return []}, isRequired: false, type: 'object',}, + 'ip_deny': {default: function(){return []}, isRequired: false, type: 'object',}, + 'is_wildcard': {default: false, isRequired: false, type: 'boolean',}, 'wildcard_status': {isRequired: false, type: 'string', min: 3, max: 500}, 'wildcard_matchAny': {default: false, isRequired: false, type: 'boolean',}, diff --git a/nodejs/package.json b/nodejs/package.json index 88669bd..b43a35c 100644 --- a/nodejs/package.json +++ b/nodejs/package.json @@ -11,10 +11,10 @@ "scripts": { "start": "node ./bin/www", "dev": "npx nodemon --ignore public/ ./bin/www", - "test": "node --test test/unit/callback_queue.test.js test/unit/host_lookup.test.js test/unit/wildcard_matchany.test.js test/unit/roles.test.js test/unit/oidc.test.js test/unit/safe_redirect.test.js test/unit/unix_socket.test.js test/integration/dns_provider.test.js", - "test:unit": "node --test test/unit/callback_queue.test.js test/unit/host_lookup.test.js test/unit/wildcard_matchany.test.js test/unit/roles.test.js test/unit/oidc.test.js test/unit/safe_redirect.test.js test/unit/unix_socket.test.js", + "test": "node --test test/unit/callback_queue.test.js test/unit/host_lookup.test.js test/unit/wildcard_matchany.test.js test/unit/roles.test.js test/unit/oidc.test.js test/unit/safe_redirect.test.js test/unit/host_features.test.js test/unit/unix_socket.test.js test/integration/dns_provider.test.js", + "test:unit": "node --test test/unit/callback_queue.test.js test/unit/host_lookup.test.js test/unit/wildcard_matchany.test.js test/unit/roles.test.js test/unit/oidc.test.js test/unit/safe_redirect.test.js test/unit/host_features.test.js test/unit/unix_socket.test.js", "test:integration": "node --test test/integration/dns_provider.test.js", - "test:watch": "node --test --watch test/unit/callback_queue.test.js test/unit/host_lookup.test.js test/unit/wildcard_matchany.test.js test/unit/roles.test.js test/unit/oidc.test.js test/unit/safe_redirect.test.js test/unit/unix_socket.test.js test/integration/dns_provider.test.js" + "test:watch": "node --test --watch test/unit/callback_queue.test.js test/unit/host_lookup.test.js test/unit/wildcard_matchany.test.js test/unit/roles.test.js test/unit/oidc.test.js test/unit/safe_redirect.test.js test/unit/host_features.test.js test/unit/unix_socket.test.js test/integration/dns_provider.test.js" }, "engines": { "node": ">=18.0.0" diff --git a/nodejs/public/lib/js/app-base.js b/nodejs/public/lib/js/app-base.js index 3a7b153..5227e9e 100644 --- a/nodejs/public/lib/js/app-base.js +++ b/nodejs/public/lib/js/app-base.js @@ -372,8 +372,11 @@ app.util = (function(app){ for (let {name, value} of $(this).serializeArray()) { console.log(name, value) if (obj[name] === undefined) { - if (!value + if (!value && !$(this).parent().find(`[name="${name}"]`).attr('value') + // Keep empty + + +
+ + +
+ +
+ + +
+ +
+ + +
+