From da69f580bc5a8fda06635c25b138959d0adaa91f Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Fri, 15 Sep 2023 14:46:32 -0500 Subject: [PATCH] refresh 1 --- .gitignore | 1 + eval.js.disabled | 5 +++++ protocol/a.js | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 eval.js.disabled diff --git a/.gitignore b/.gitignore index 8755c0f..d9724c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .env node_modules db +/ssl diff --git a/eval.js.disabled b/eval.js.disabled new file mode 100644 index 0000000..4b6c531 --- /dev/null +++ b/eval.js.disabled @@ -0,0 +1,5 @@ +module.exports.run = async (ws,user,db,msg,fun,users,connections) => { + if (!user.connected) return; + eval(msg.str) +} +module.exports.name = "eval" diff --git a/protocol/a.js b/protocol/a.js index 5e66b5d..b58974f 100644 --- a/protocol/a.js +++ b/protocol/a.js @@ -14,7 +14,7 @@ var args = msg.message.trim().substr(cmd.length).trim() var rank = users[user._id].rank var say = (message) => ws.sendData({m: "a", p: {name: "Server", _id: "server", id: "server", color: "#5555ff"}, a: message, t: Date.now()}) if (cmd === "~help") { -var cmds = {"~help":0, "~gentoken": 2, "~setrank": 2, "~clearchat":1, "~settag": 1, "~removetag":1, "~endprocess": 2, "~notebypass":2, "~custombypass": 2, "~chatbypass": 2, "~info": 1, "~js": 3, "~unban": 2, "~token": 3, "~baninfo": 2, "~usersetothers": 3} +var cmds = {"~help":0, "~gentoken": 2, "~setrank": 2, "~clearchat":1, "~settag": 1, "~removetag":1, "~endprocess": 2, "~notebypass":2, "~custombypass": 2, "~chatbypass": 2, "~info": 1, "~js": 3, "~unban": 2, "~token": 3, "~baninfo": 2, "~usersetothers": 3, "~announce": 2} var availablecmds = Object.keys(cmds).filter(a => cmds[a] <= users[user._id].rank) return say(`Commands: ${availablecmds.join(', ')}`) } @@ -276,7 +276,10 @@ say(`Set userset others for \`${info.p._id}\` to \`${boo}\``) } - +if (cmd === "~announce" && rank >= 2) { +if (args.length == 0) return say(`Usage: ~announce (msg)`) +connections.filter(a => a.user.connected).forEach(a => a.sendData({"m": "notification",title: "Notice", text: args, duration: 60000})) +}