Use admin flag for admin messages
This commit is contained in:
parent
84289bfb22
commit
41d86b545d
|
@ -8,14 +8,27 @@ export const admin_message: ServerEventListener<"admin message"> = {
|
||||||
if (socket.rateLimits)
|
if (socket.rateLimits)
|
||||||
if (!socket.rateLimits.normal["admin message"].attempt()) return;
|
if (!socket.rateLimits.normal["admin message"].attempt()) return;
|
||||||
|
|
||||||
if (typeof msg.password !== "string") {
|
const flags = socket.getUserFlags();
|
||||||
socket.gateway.hasSentInvalidAdminMessage = true;
|
|
||||||
return;
|
let hasFlag = false;
|
||||||
|
|
||||||
|
if (flags) {
|
||||||
|
// Sometimes we don't use passwords
|
||||||
|
if (flags.admin) hasFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.password !== env.ADMIN_PASS) {
|
if (!hasFlag) {
|
||||||
socket.gateway.hasSentInvalidAdminMessage = true;
|
// Did they send some kind of password?
|
||||||
return;
|
if (typeof msg.password !== "string") {
|
||||||
|
socket.gateway.hasSentInvalidAdminMessage = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Is the password correct?
|
||||||
|
if (msg.password !== env.ADMIN_PASS) {
|
||||||
|
socket.gateway.hasSentInvalidAdminMessage = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Probably shouldn't be using password auth in 2024
|
// Probably shouldn't be using password auth in 2024
|
||||||
|
|
Loading…
Reference in New Issue