diff --git a/package-lock.json b/package-lock.json index 14b3960..f8f2856 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "fs": "^0.0.1-security", "ini": "^2.0.0", "path": "^0.12.7", + "uuid": "^8.3.2", "ws": "^8.5.0", "xml-parser": "^1.2.1", "xmlbuilder": "^15.1.1" @@ -552,6 +553,14 @@ "node": ">= 0.4.0" } }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -1003,6 +1012,11 @@ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/package.json b/package.json index aef75f1..cd0ada9 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "fs": "^0.0.1-security", "ini": "^2.0.0", "path": "^0.12.7", + "uuid": "^8.3.2", "ws": "^8.5.0", "xml-parser": "^1.2.1", "xmlbuilder": "^15.1.1" diff --git a/structure/functions.js b/structure/functions.js index 7f1d673..cb3a1f7 100644 --- a/structure/functions.js +++ b/structure/functions.js @@ -1,6 +1,6 @@ -const crypto = require("crypto"); const memory = require("./../memory.json"); const XMLBuilder = require("xmlbuilder"); +const uuid = require("uuid"); function GetVersionInfo(req, memory) { if (req.headers["user-agent"]) @@ -227,12 +227,7 @@ function getContentPages(req) { } function MakeID() { - let CurrentDate = (new Date()).valueOf().toString(); - let RandomFloat = Math.random().toString(); - let ID = crypto.createHash('md5').update(CurrentDate + RandomFloat).digest('hex'); - let FinishedID = ID.slice(0, 8) + "-" + ID.slice(8, 12) + "-" + ID.slice(12, 16) + "-" + ID.slice(16, 20) + "-" + ID.slice(20, 32); - - return FinishedID; + return uuid.v4(); } function sendXmppMessageToAll(body) {