LawinServer XMPP 🔥

This commit is contained in:
Lawin0129
2022-02-28 19:39:25 +00:00
parent b36f83f0a6
commit 6c7002e788
13 changed files with 1087 additions and 328 deletions

View File

@@ -1,5 +1,6 @@
const crypto = require("crypto");
const memory = require("./../memory.json");
const XMLBuilder = require("xmlbuilder");
function GetVersionInfo(req, memory) {
if (req.headers["user-agent"])
@@ -234,10 +235,30 @@ function MakeID() {
return FinishedID;
}
function sendXmppMessageToAll(body) {
if (global.Clients) {
if (typeof body == "object") body = JSON.stringify(body);
global.Clients.forEach(ClientData => {
ClientData.client.send(XMLBuilder.create("message")
.attribute("from", "xmpp-admin@prod.ol.epicgames.com")
.attribute("xmlns", "jabber:client")
.attribute("to", ClientData.jid)
.element("body", `${body}`).up().toString());
});
}
}
function DecodeBase64(str) {
return Buffer.from(str, 'base64').toString()
}
module.exports = {
GetVersionInfo,
getItemShop,
getTheater,
getContentPages,
MakeID
MakeID,
sendXmppMessageToAll,
DecodeBase64
}