From eb16cca551a5880c9567b4d0a0d5fe5ca18b1c21 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Mon, 20 Apr 2026 18:02:39 +0200 Subject: [PATCH] Add ipsBlocked to Freedom Expose an ipsBlocked array on Outbound.FreedomSettings and wire it into the outbound form. The constructor now defaults fragment to {} and noises/ipsBlocked to arrays for robustness; fromJson/toJson handle ipsBlocked and omit it when empty. The outbound HTML adds a tag-style bound to outbound.settings.ipsBlocked (with comma tokenization and placeholder) so users can enter IP/CIDR/geoip entries. --- web/assets/js/model/outbound.js | 14 +++++++++----- web/html/form/outbound.html | 11 +++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index 9d2c080b..c0808c1d 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -1137,13 +1137,15 @@ Outbound.FreedomSettings = class extends CommonClass { domainStrategy = '', redirect = '', fragment = {}, - noises = [] + noises = [], + ipsBlocked = [], ) { super(); this.domainStrategy = domainStrategy; this.redirect = redirect; - this.fragment = fragment; - this.noises = noises; + this.fragment = fragment || {}; + this.noises = Array.isArray(noises) ? noises : []; + this.ipsBlocked = Array.isArray(ipsBlocked) ? ipsBlocked : []; } addNoise() { @@ -1158,8 +1160,9 @@ Outbound.FreedomSettings = class extends CommonClass { return new Outbound.FreedomSettings( json.domainStrategy, json.redirect, - json.fragment ? Outbound.FreedomSettings.Fragment.fromJson(json.fragment) : undefined, - json.noises ? json.noises.map(noise => Outbound.FreedomSettings.Noise.fromJson(noise)) : undefined, + json.fragment ? Outbound.FreedomSettings.Fragment.fromJson(json.fragment) : {}, + json.noises ? json.noises.map(noise => Outbound.FreedomSettings.Noise.fromJson(noise)) : [], + json.ipsBlocked || [], ); } @@ -1169,6 +1172,7 @@ Outbound.FreedomSettings = class extends CommonClass { redirect: ObjectUtil.isEmpty(this.redirect) ? undefined : this.redirect, fragment: Object.keys(this.fragment).length === 0 ? undefined : this.fragment, noises: this.noises.length === 0 ? undefined : Outbound.FreedomSettings.Noise.toJsonArray(this.noises), + ipsBlocked: this.ipsBlocked.length === 0 ? undefined : this.ipsBlocked, }; } }; diff --git a/web/html/form/outbound.html b/web/html/form/outbound.html index fe76b518..f4cb6467 100644 --- a/web/html/form/outbound.html +++ b/web/html/form/outbound.html @@ -51,6 +51,17 @@ + + + +