fixed deprecated warnings for buffer

This commit is contained in:
BrainFooLong committed 2019-02-10 18:38:59 +01:00
1 parent 4daae8443e
commit dc0699e953
4 files changed
+14 -7

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
# Changelog
- 10.02.2019
- fixed deprecated warnings for newer nodejs versions
+3
View File
@@ -37,6 +37,9 @@ If you like to buy some coffee, i will appriciate it. You can do this on [Patreo
## Widgets
The widgets are powerful, they deserve an extra header here. All dashboard things are written in widgets. From the simplest to the most powerful tool, widgets are the way to go. They are some sort of "High level" programs inside the rcon web admin. You don't have to dig much into the code to write widgets. It's basically HTML and JS.
## Requirements
- NodeJS min. v5.10.0
## Installation Windows
* Download and install node.js (https://nodejs.org)
* Download zip repository and unpack wherever you want
+1 -1
View File
@@ -2,7 +2,7 @@
"author": "BrainFooLong (https://github.com/brainfoolong/rcon-web-admin)",
"name": "rcon-web-admin",
"description": "Self hosted, online RCON administration tool for your server.",
"version": "0.13.2",
"version": "0.13.3",
"license": "MIT",
"main": "src/main.js",
"repository": {
+6 -6
View File
@@ -57,13 +57,13 @@ function Rcon(host, port, server) {
* Receive data buffer
* @type {Buffer}
*/
this.dataBuffer = new Buffer(0);
this.dataBuffer = Buffer.alloc(0);
/**
* The received body buffer
* @type string
*/
this.bodyBuffer = new Buffer(0);
this.bodyBuffer = Buffer.alloc(0);
/**
* Send queue
@@ -237,7 +237,7 @@ Rcon.prototype.send = function (cmd, user, log, callback, type) {
type = Rcon.SERVERDATA_EXECCOMMAND;
}
if (!Buffer.isBuffer(cmd)) {
cmd = new Buffer(cmd);
cmd = Buffer.from(cmd);
}
// for auth request we handle a special callback
if (type == Rcon.SERVERDATA_AUTH) {
@@ -256,7 +256,7 @@ Rcon.prototype.send = function (cmd, user, log, callback, type) {
// write an extra empty request to be able to find multipart message boundings
// minecraft dont have multipart packages so we need no end
if (type != Rcon.SERVERDATA_AUTH && self.server.serverData.game != "minecraft") {
self.socket.write(self._pack(self.packetId, Rcon.SERVERDATA_RESPONSE_VALUE, new Buffer(0)));
self.socket.write(self._pack(self.packetId, Rcon.SERVERDATA_RESPONSE_VALUE, Buffer.alloc(0)));
self.packetId = self.nextPacketId();
}
});
@@ -328,7 +328,7 @@ Rcon.prototype._data = function () {
} catch (e) {
console.error(new Date(), "RconServer [" + serverName + "]: send callback error", e, e.stack);
}
this.bodyBuffer = new Buffer(0);
this.bodyBuffer = Buffer.alloc(0);
}
this.sendBlocked = false;
this.processQueue();
@@ -353,7 +353,7 @@ Rcon.prototype._data = function () {
* @private
*/
Rcon.prototype._pack = function (id, type, body) {
var buf = new Buffer(body.length + 14);
var buf = Buffer.alloc(body.length + 14);
buf.writeInt32LE(body.length + 10, 0);
buf.writeInt32LE(id, 4);
buf.writeInt32LE(type, 8);