diff options
Diffstat (limited to 'web/assets')
| -rw-r--r-- | web/assets/js/model/outbound.js | 32 | ||||
| -rw-r--r-- | web/assets/js/model/xray.js | 10 |
2 files changed, 32 insertions, 10 deletions
diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index bc4ad735..5772d34f 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -854,7 +854,7 @@ Outbound.FreedomSettings = class extends CommonClass { timeout = 10, redirect = '', fragment = {}, - noises = {} + noises = [] ) { super(); this.domainStrategy = domainStrategy; @@ -864,13 +864,21 @@ Outbound.FreedomSettings = class extends CommonClass { this.noises = noises; } + addNoise() { + this.noises.push(new Outbound.FreedomSettings.Noise()); + } + + delNoise(index) { + this.noises.splice(index, 1); + } + static fromJson(json = {}) { return new Outbound.FreedomSettings( json.domainStrategy, json.timeout, json.redirect, json.fragment ? Outbound.FreedomSettings.Fragment.fromJson(json.fragment) : undefined, - json.noises ? Outbound.FreedomSettings.Noises.fromJson(json.noises) : undefined, + json.noises ? json.noises.map(noise => Outbound.FreedomSettings.Noise.fromJson(noise)) : [new Outbound.FreedomSettings.Noise()], ); } @@ -880,10 +888,11 @@ Outbound.FreedomSettings = class extends CommonClass { timeout: this.timeout, redirect: this.redirect, fragment: Object.keys(this.fragment).length === 0 ? undefined : this.fragment, - noises: Object.keys(this.noises).length === 0 ? undefined : this.noises, + noises: Outbound.FreedomSettings.Noise.toJsonArray(this.noises), }; } }; + Outbound.FreedomSettings.Fragment = class extends CommonClass { constructor(packets = '1-3', length = '', interval = '') { super(); @@ -900,7 +909,8 @@ Outbound.FreedomSettings.Fragment = class extends CommonClass { ); } }; -Outbound.FreedomSettings.Noises = class extends CommonClass { + +Outbound.FreedomSettings.Noise = class extends CommonClass { constructor( type = 'rand', packet = '10-20', @@ -913,12 +923,24 @@ Outbound.FreedomSettings.Noises = class extends CommonClass { } static fromJson(json = {}) { - return new Outbound.FreedomSettings.Noises( + return new Outbound.FreedomSettings.Noise( json.type, json.packet, json.delay, ); } + + toJson() { + return { + type: this.type, + packet: this.packet, + delay: this.delay, + }; + } + + static toJsonArray(noises) { + return noises.map(noise => noise.toJson()); + } }; Outbound.BlackholeSettings = class extends CommonClass { diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 93c3ac1e..74211952 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -530,10 +530,10 @@ class SplitHTTPStreamSettings extends XrayCommonClass { noSSEHeader = false, xPaddingBytes = "100-1000", xmux = { - maxConnections: 0, - maxConcurrency: 0, - cMaxReuseTimes: 0, - cMaxLifetimeMs: 0 + maxConcurrency: 0, + maxConnections: 0, + cMaxReuseTimes: 0, + cMaxLifetimeMs: 0 } ) { super(); @@ -581,8 +581,8 @@ class SplitHTTPStreamSettings extends XrayCommonClass { noSSEHeader: this.noSSEHeader, xPaddingBytes: this.xPaddingBytes, xmux: { - maxConnections: this.xmux.maxConnections, maxConcurrency: this.xmux.maxConcurrency, + maxConnections: this.xmux.maxConnections, cMaxReuseTimes: this.xmux.cMaxReuseTimes, cMaxLifetimeMs: this.xmux.cMaxLifetimeMs } |
