2020-09-17 13:44:32 +08:00
|
|
|
/* eslint no-console: 0 */
|
|
|
|
|
2018-09-30 14:44:36 +08:00
|
|
|
/*
|
|
|
|
Description: Clears all bans and ratelimits
|
|
|
|
*/
|
|
|
|
|
2020-03-07 01:00:30 +08:00
|
|
|
import * as UAC from '../utility/UAC/_info';
|
2020-03-06 00:49:25 +08:00
|
|
|
|
2018-09-30 14:44:36 +08:00
|
|
|
// module main
|
2020-09-17 13:44:32 +08:00
|
|
|
export async function run({ core, server, socket }) {
|
2018-09-30 14:44:36 +08:00
|
|
|
// increase rate limit chance and ignore if not admin or mod
|
2020-03-06 00:49:25 +08:00
|
|
|
if (!UAC.isModerator(socket.level)) {
|
2019-11-07 15:35:23 +08:00
|
|
|
return server.police.frisk(socket.address, 10);
|
2018-09-30 14:44:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// remove arrest records
|
2019-11-07 15:35:23 +08:00
|
|
|
server.police.clear();
|
2018-09-30 14:44:36 +08:00
|
|
|
|
2020-03-13 02:28:20 +08:00
|
|
|
core.stats.set('users-banned', 0);
|
|
|
|
|
2018-09-30 14:44:36 +08:00
|
|
|
console.log(`${socket.nick} [${socket.trip}] unbanned all`);
|
|
|
|
|
|
|
|
// reply with success
|
|
|
|
server.reply({
|
|
|
|
cmd: 'info',
|
2019-11-07 15:35:23 +08:00
|
|
|
text: 'Unbanned all ip addresses',
|
2020-10-10 13:34:59 +08:00
|
|
|
channel: socket.channel, // @todo Multichannel
|
2018-09-30 14:44:36 +08:00
|
|
|
}, socket);
|
|
|
|
|
|
|
|
// notify mods
|
|
|
|
server.broadcast({
|
|
|
|
cmd: 'info',
|
2020-03-07 05:29:15 +08:00
|
|
|
text: `${socket.nick}#${socket.trip} unbanned all ip addresses`,
|
2020-10-10 13:34:59 +08:00
|
|
|
channel: false, // @todo Multichannel, false for global
|
2020-03-06 00:49:25 +08:00
|
|
|
}, { level: UAC.isModerator });
|
2018-09-30 14:44:36 +08:00
|
|
|
|
2019-11-07 15:35:23 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const info = {
|
2018-09-30 14:44:36 +08:00
|
|
|
name: 'unbanall',
|
|
|
|
description: 'Clears all banned ip addresses',
|
|
|
|
usage: `
|
2019-11-07 15:35:23 +08:00
|
|
|
API: { cmd: 'unbanall' }`,
|
2018-09-30 14:44:36 +08:00
|
|
|
};
|