mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-06-17 03:45:25 +02:00
Administrator can now disable misbehaving servers
This commit is contained in:
57
webapp/titanembeds/static/js/admin_disabled_guilds.js
Normal file
57
webapp/titanembeds/static/js/admin_disabled_guilds.js
Normal 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -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")) {
|
||||
|
Reference in New Issue
Block a user