41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
Tea.context(function () {
|
|
this.success = NotifyReloadSuccess("保存成功");
|
|
|
|
this.$delay(function () {
|
|
this.$watch("policies.defaultSniPolicy", function (level) {
|
|
if (level == "level1" || level == "level2") {
|
|
this.policies.ecsMode = "off";
|
|
this.policies.pinningMode = "off";
|
|
this.policies.sanMode = "off";
|
|
return;
|
|
}
|
|
|
|
if (level == "level3") {
|
|
if (this.policies.ecsMode == "off") {
|
|
this.policies.ecsMode = "auto";
|
|
}
|
|
if (this.policies.pinningMode == "off") {
|
|
this.policies.pinningMode = "report";
|
|
}
|
|
if (this.policies.sanMode == "off") {
|
|
this.policies.sanMode = "strict";
|
|
}
|
|
}
|
|
});
|
|
|
|
this.$watch("policies.ecsMode", function (mode) {
|
|
if (this.policies.defaultSniPolicy != "level3") {
|
|
return;
|
|
}
|
|
if (mode == "custom") {
|
|
if (!this.policies.ecsIPv4Prefix || this.policies.ecsIPv4Prefix <= 0) {
|
|
this.policies.ecsIPv4Prefix = 24;
|
|
}
|
|
if (!this.policies.ecsIPv6Prefix || this.policies.ecsIPv6Prefix <= 0) {
|
|
this.policies.ecsIPv6Prefix = 56;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|