Implemented the anti flood tab on serveredit

This commit is contained in:
WolverinDEV 2018-08-13 11:28:33 +02:00
parent 0309862c7f
commit 6f5a37fb00
3 changed files with 39 additions and 3 deletions

View file

@ -32,6 +32,7 @@ namespace Modals {
server_applyGeneralListener(properties, modal.htmlTag.find(".properties_general"), modal.htmlTag.find(".button_ok")); server_applyGeneralListener(properties, modal.htmlTag.find(".properties_general"), modal.htmlTag.find(".button_ok"));
server_applyHostListener(properties, server.properties, modal.htmlTag.find(".properties_host"), modal.htmlTag.find(".button_ok")); server_applyHostListener(properties, server.properties, modal.htmlTag.find(".properties_host"), modal.htmlTag.find(".button_ok"));
server_applyMessages(properties, server, modal.htmlTag.find(".properties_messages")); server_applyMessages(properties, server, modal.htmlTag.find(".properties_messages"));
server_applyFlood(properties, server, modal.htmlTag.find(".properties_flood"));
modal.htmlTag.find(".button_ok").click(() => { modal.htmlTag.find(".button_ok").click(() => {
modal.close(); modal.close();
@ -153,8 +154,6 @@ namespace Modals {
tag.find(".virtualserver_default_channel_topic").val(server.properties.virtualserver_default_channel_topic); tag.find(".virtualserver_default_channel_topic").val(server.properties.virtualserver_default_channel_topic);
}); });
console.log(tag);
console.log(tag.find(".virtualserver_default_client_description"));
tag.find(".virtualserver_default_client_description").change(function (this: HTMLInputElement) { tag.find(".virtualserver_default_client_description").change(function (this: HTMLInputElement) {
properties.virtualserver_default_client_description = this.value; properties.virtualserver_default_client_description = this.value;
}).prop("disabled", !globalClient.permissions.neededPermission(PermissionType.B_VIRTUALSERVER_MODIFY_DEFAULT_MESSAGES).granted(1)); }).prop("disabled", !globalClient.permissions.neededPermission(PermissionType.B_VIRTUALSERVER_MODIFY_DEFAULT_MESSAGES).granted(1));
@ -167,4 +166,24 @@ namespace Modals {
properties.virtualserver_default_channel_topic = this.value; properties.virtualserver_default_channel_topic = this.value;
}).prop("disabled", !globalClient.permissions.neededPermission(PermissionType.B_VIRTUALSERVER_MODIFY_DEFAULT_MESSAGES).granted(1)); }).prop("disabled", !globalClient.permissions.neededPermission(PermissionType.B_VIRTUALSERVER_MODIFY_DEFAULT_MESSAGES).granted(1));
} }
function server_applyFlood(properties: ServerProperties, server: ServerEntry, tag: JQuery) {
server.updateProperties().then(() => {
tag.find(".virtualserver_antiflood_points_tick_reduce").val(server.properties.virtualserver_antiflood_points_tick_reduce);
tag.find(".virtualserver_antiflood_points_needed_command_block").val(server.properties.virtualserver_antiflood_points_needed_command_block);
tag.find(".virtualserver_antiflood_points_needed_ip_block").val(server.properties.virtualserver_antiflood_points_needed_ip_block);
});
tag.find(".virtualserver_antiflood_points_tick_reduce").change(function (this: HTMLInputElement) {
properties.virtualserver_antiflood_points_tick_reduce = this.valueAsNumber;
}).prop("disabled", !globalClient.permissions.neededPermission(PermissionType.B_VIRTUALSERVER_MODIFY_ANTIFLOOD).granted(1));
tag.find(".virtualserver_antiflood_points_needed_command_block").change(function (this: HTMLInputElement) {
properties.virtualserver_antiflood_points_needed_command_block = this.valueAsNumber;
}).prop("disabled", !globalClient.permissions.neededPermission(PermissionType.B_VIRTUALSERVER_MODIFY_ANTIFLOOD).granted(1));
tag.find(".virtualserver_antiflood_points_needed_ip_block").change(function (this: HTMLInputElement) {
properties.virtualserver_antiflood_points_needed_ip_block = this.valueAsNumber;
}).prop("disabled", !globalClient.permissions.neededPermission(PermissionType.B_VIRTUALSERVER_MODIFY_ANTIFLOOD).granted(1));
}
} }

View file

@ -39,6 +39,10 @@ class ServerProperties {
virtualserver_default_client_description: string = ""; virtualserver_default_client_description: string = "";
virtualserver_default_channel_description: string = ""; virtualserver_default_channel_description: string = "";
virtualserver_default_channel_topic: string = ""; virtualserver_default_channel_topic: string = "";
virtualserver_antiflood_points_tick_reduce: number = 0;
virtualserver_antiflood_points_needed_command_block: number = 0;
virtualserver_antiflood_points_needed_ip_block: number = 0;
} }
interface ServerAddress { interface ServerAddress {

View file

@ -211,7 +211,20 @@
</x-entry> </x-entry>
<x-entry> <x-entry>
<x-tag>Anti-Flood</x-tag> <x-tag>Anti-Flood</x-tag>
<x-content>TODO!</x-content> <x-content>
<div class="container properties_flood">
<div class="properties">
<div class="key">Reduced points per tick:</div>
<input type="number" min="1" max="65536" value="{{:virtualserver_antiflood_points_tick_reduce}}" class="value virtualserver_antiflood_points_tick_reduce">
<div class="key">Points needed to block commands:</div>
<input type="number" min="1" max="65536" value="{{:virtualserver_antiflood_points_needed_command_block}}" class="value virtualserver_antiflood_points_needed_command_block">
<div class="key">Points needed to block IP:</div>
<input type="number" min="1" max="65536" value="{{:virtualserver_antiflood_points_needed_ip_block}}" class="value virtualserver_antiflood_points_needed_ip_block">
</div>
</div>
</x-content>
</x-entry> </x-entry>
<x-entry> <x-entry>
<x-tag>Security</x-tag> <x-tag>Security</x-tag>