mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-04-23 07:56:08 +00:00
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 <a-select> bound to outbound.settings.ipsBlocked (with comma tokenization and placeholder) so users can enter IP/CIDR/geoip entries.
This commit is contained in:
parent
aef0503f8f
commit
eb16cca551
2 changed files with 20 additions and 5 deletions
|
|
@ -1137,13 +1137,15 @@ Outbound.FreedomSettings = class extends CommonClass {
|
||||||
domainStrategy = '',
|
domainStrategy = '',
|
||||||
redirect = '',
|
redirect = '',
|
||||||
fragment = {},
|
fragment = {},
|
||||||
noises = []
|
noises = [],
|
||||||
|
ipsBlocked = [],
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.domainStrategy = domainStrategy;
|
this.domainStrategy = domainStrategy;
|
||||||
this.redirect = redirect;
|
this.redirect = redirect;
|
||||||
this.fragment = fragment;
|
this.fragment = fragment || {};
|
||||||
this.noises = noises;
|
this.noises = Array.isArray(noises) ? noises : [];
|
||||||
|
this.ipsBlocked = Array.isArray(ipsBlocked) ? ipsBlocked : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
addNoise() {
|
addNoise() {
|
||||||
|
|
@ -1158,8 +1160,9 @@ Outbound.FreedomSettings = class extends CommonClass {
|
||||||
return new Outbound.FreedomSettings(
|
return new Outbound.FreedomSettings(
|
||||||
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) : {},
|
||||||
json.noises ? json.noises.map(noise => Outbound.FreedomSettings.Noise.fromJson(noise)) : undefined,
|
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,
|
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: this.noises.length === 0 ? undefined : Outbound.FreedomSettings.Noise.toJsonArray(this.noises),
|
noises: this.noises.length === 0 ? undefined : Outbound.FreedomSettings.Noise.toJsonArray(this.noises),
|
||||||
|
ipsBlocked: this.ipsBlocked.length === 0 ? undefined : this.ipsBlocked,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,17 @@
|
||||||
<a-form-item label="Redirect">
|
<a-form-item label="Redirect">
|
||||||
<a-input v-model="outbound.settings.redirect"></a-input>
|
<a-input v-model="outbound.settings.redirect"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="IPs Blocked">
|
||||||
|
<a-select
|
||||||
|
mode="tags"
|
||||||
|
v-model="outbound.settings.ipsBlocked"
|
||||||
|
:style="{ width: '100%' }"
|
||||||
|
:dropdown-class-name="themeSwitcher.currentTheme"
|
||||||
|
:token-separators="[',']"
|
||||||
|
placeholder="IP/CIDR/geoip:*/ext:*"
|
||||||
|
>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
<a-form-item label="Fragment">
|
<a-form-item label="Fragment">
|
||||||
<a-switch
|
<a-switch
|
||||||
:checked="Object.keys(outbound.settings.fragment).length >0"
|
:checked="Object.keys(outbound.settings.fragment).length >0"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue