Administrator can now disable misbehaving servers

This commit is contained in:
Jeremy Zhang
2018-01-05 08:52:22 +00:00
parent 6c4b850669
commit bf47f9457c
14 changed files with 253 additions and 6 deletions

View File

@ -0,0 +1,57 @@
/* global $, Materialize, location */
function postForm(guild_id) {
var funct = $.ajax({
dataType: "json",
method: "POST",
data: {"guild_id": guild_id}
});
return funct.promise();
}
function deleteForm(guild_id) {
var funct = $.ajax({
dataType: "json",
method: "DELETE",
data: {"guild_id": guild_id}
});
return funct.promise();
}
$(function() {
$("#new_submit").click(function () {
var guild_id = $("#new_guild_id").val();
if (guild_id.length < 1) {
Materialize.toast("The server ID field can't be blank!", 2000);
return;
}
var formPost = postForm(guild_id);
formPost.done(function (data) {
location.reload();
});
formPost.fail(function (data) {
if (data.status == 409) {
Materialize.toast('This server id already exists!', 10000);
} else {
Materialize.toast('Oh no! Something has failed submitting a new entry!', 10000);
}
});
});
});
function delete_guild(guild_id) {
var confirmation = confirm("Are you sure that you want to reenable server?");
if (confirmation) {
var formDelete = deleteForm(guild_id);
formDelete.done(function (data) {
location.reload();
});
formDelete.fail(function (data) {
if (data.status == 409) {
Materialize.toast('This server id does not exists!', 10000);
} else {
Materialize.toast('Oh no! Something has failed deleting this server entry!', 10000);
}
});
}
}

View File

@ -16,6 +16,7 @@
/* global linkify */
/* global unauth_captcha_enabled */
/* global soundManager */
/* global disabled */
(function () {
const theme_options = ["DiscordDark", "BetterTitan"]; // All the avaliable theming names
@ -290,6 +291,11 @@
}
});
if (disabled) {
Materialize.toast('This server is currently disabled. If you are an administrator of this server, please get in touch with a TitanEmbeds team member to lift the ban.', 100000);
return;
}
primeEmbed();
setInterval(send_socket_heartbeat, 5000);
if (getParameterByName("username")) {