fix outbound noises

Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
This commit is contained in:
mhsanaei 2024-10-21 10:40:29 +02:00
parent 6c27e4177d
commit d16ad11136
No known key found for this signature in database
GPG key ID: 4DACC0663B5986F5

View file

@ -875,16 +875,16 @@ Outbound.FreedomSettings = class extends CommonClass {
json.domainStrategy, json.domainStrategy,
json.redirect, json.redirect,
json.fragment ? Outbound.FreedomSettings.Fragment.fromJson(json.fragment) : undefined, json.fragment ? Outbound.FreedomSettings.Fragment.fromJson(json.fragment) : undefined,
json.noises ? json.noises.map(noise => Outbound.FreedomSettings.Noise.fromJson(noise)) : [new Outbound.FreedomSettings.Noise()], json.noises ? json.noises.map(noise => Outbound.FreedomSettings.Noise.fromJson(noise)) : undefined,
); );
} }
toJson() { toJson() {
return { return {
domainStrategy: ObjectUtil.isEmpty(this.domainStrategy) ? undefined : this.domainStrategy, domainStrategy: ObjectUtil.isEmpty(this.domainStrategy) ? undefined : this.domainStrategy,
redirect: this.redirect, redirect: ObjectUtil.isEmpty(this.redirect) ? undefined: this.redirect,
fragment: Object.keys(this.fragment).length === 0 ? undefined : this.fragment, fragment: Object.keys(this.fragment).length === 0 ? undefined : this.fragment,
noises: Outbound.FreedomSettings.Noise.toJsonArray(this.noises), noises: this.noises.length === 0 ? undefined : Outbound.FreedomSettings.Noise.toJsonArray(this.noises),
}; };
} }
}; };
@ -937,10 +937,6 @@ Outbound.FreedomSettings.Noise = class extends CommonClass {
delay: this.delay, delay: this.delay,
}; };
} }
static toJsonArray(noises) {
return noises.map(noise => noise.toJson());
}
}; };
Outbound.BlackholeSettings = class extends CommonClass { Outbound.BlackholeSettings = class extends CommonClass {