From fa43248e3043932a31bc93ff86a2d4a3f1314491 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Thu, 29 Aug 2024 11:27:43 +0200 Subject: New - Noise freedom --- web/assets/js/model/outbound.js | 28 +++++++++++++++++++++++++++- web/assets/js/model/setting.js | 1 + 2 files changed, 28 insertions(+), 1 deletion(-) (limited to 'web/assets') diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index f1909552..59da542a 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -861,23 +861,34 @@ Outbound.Settings = class extends CommonClass { } }; Outbound.FreedomSettings = class extends CommonClass { - constructor(domainStrategy = '', fragment = {}) { + constructor( + domainStrategy = '', + timeout = '', + fragment = {}, + noise = {} + ) { super(); this.domainStrategy = domainStrategy; + this.timeout = timeout; this.fragment = fragment; + this.noise = noise; } static fromJson(json = {}) { return new Outbound.FreedomSettings( json.domainStrategy, + json.timeout, json.fragment ? Outbound.FreedomSettings.Fragment.fromJson(json.fragment) : undefined, + json.noise ? Outbound.FreedomSettings.Noise.fromJson(json.noise) : undefined, ); } toJson() { return { domainStrategy: ObjectUtil.isEmpty(this.domainStrategy) ? undefined : this.domainStrategy, + timeout: this.timeout, fragment: Object.keys(this.fragment).length === 0 ? undefined : this.fragment, + noise: Object.keys(this.noise).length === 0 ? undefined : this.noise, }; } }; @@ -897,6 +908,21 @@ Outbound.FreedomSettings.Fragment = class extends CommonClass { ); } }; +Outbound.FreedomSettings.Noise = class extends CommonClass { + constructor(packets = '', delay = '') { + super(); + this.packets = packets; + this.delay = delay; + } + + static fromJson(json = {}) { + return new Outbound.FreedomSettings.Noise( + json.packets, + json.delay, + ); + } +}; + Outbound.BlackholeSettings = class extends CommonClass { constructor(type) { super(); diff --git a/web/assets/js/model/setting.js b/web/assets/js/model/setting.js index 607fd069..2dea875b 100644 --- a/web/assets/js/model/setting.js +++ b/web/assets/js/model/setting.js @@ -38,6 +38,7 @@ class AllSetting { this.subURI = ""; this.subJsonURI = ""; this.subJsonFragment = ""; + this.subJsonNoise = ""; this.subJsonMux = ""; this.subJsonRules = ""; -- cgit v1.2.3