Skip to content
This repository was archived by the owner on Apr 21, 2020. It is now read-only.

Commit dc0699e

Browse files
author
BrainFooLong
committed
fixed deprecated warnings for buffer
1 parent 4daae84 commit dc0699e

4 files changed

Lines changed: 14 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Changelog
2+
3+
- 10.02.2019
4+
- fixed deprecated warnings for newer nodejs versions

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ If you like to buy some coffee, i will appriciate it. You can do this on [Patreo
3737
## Widgets
3838
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.
3939

40+
## Requirements
41+
- NodeJS min. v5.10.0
42+
4043
## Installation Windows
4144
* Download and install node.js (https://nodejs.org)
4245
* Download zip repository and unpack wherever you want

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"author": "BrainFooLong (https://github.com/brainfoolong/rcon-web-admin)",
33
"name": "rcon-web-admin",
44
"description": "Self hosted, online RCON administration tool for your server.",
5-
"version": "0.13.2",
5+
"version": "0.13.3",
66
"license": "MIT",
77
"main": "src/main.js",
88
"repository": {

src/rcon.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ function Rcon(host, port, server) {
5757
* Receive data buffer
5858
* @type {Buffer}
5959
*/
60-
this.dataBuffer = new Buffer(0);
60+
this.dataBuffer = Buffer.alloc(0);
6161

6262
/**
6363
* The received body buffer
6464
* @type string
6565
*/
66-
this.bodyBuffer = new Buffer(0);
66+
this.bodyBuffer = Buffer.alloc(0);
6767

6868
/**
6969
* Send queue
@@ -237,7 +237,7 @@ Rcon.prototype.send = function (cmd, user, log, callback, type) {
237237
type = Rcon.SERVERDATA_EXECCOMMAND;
238238
}
239239
if (!Buffer.isBuffer(cmd)) {
240-
cmd = new Buffer(cmd);
240+
cmd = Buffer.from(cmd);
241241
}
242242
// for auth request we handle a special callback
243243
if (type == Rcon.SERVERDATA_AUTH) {
@@ -256,7 +256,7 @@ Rcon.prototype.send = function (cmd, user, log, callback, type) {
256256
// write an extra empty request to be able to find multipart message boundings
257257
// minecraft dont have multipart packages so we need no end
258258
if (type != Rcon.SERVERDATA_AUTH && self.server.serverData.game != "minecraft") {
259-
self.socket.write(self._pack(self.packetId, Rcon.SERVERDATA_RESPONSE_VALUE, new Buffer(0)));
259+
self.socket.write(self._pack(self.packetId, Rcon.SERVERDATA_RESPONSE_VALUE, Buffer.alloc(0)));
260260
self.packetId = self.nextPacketId();
261261
}
262262
});
@@ -328,7 +328,7 @@ Rcon.prototype._data = function () {
328328
} catch (e) {
329329
console.error(new Date(), "RconServer [" + serverName + "]: send callback error", e, e.stack);
330330
}
331-
this.bodyBuffer = new Buffer(0);
331+
this.bodyBuffer = Buffer.alloc(0);
332332
}
333333
this.sendBlocked = false;
334334
this.processQueue();
@@ -353,7 +353,7 @@ Rcon.prototype._data = function () {
353353
* @private
354354
*/
355355
Rcon.prototype._pack = function (id, type, body) {
356-
var buf = new Buffer(body.length + 14);
356+
var buf = Buffer.alloc(body.length + 14);
357357
buf.writeInt32LE(body.length + 10, 0);
358358
buf.writeInt32LE(id, 4);
359359
buf.writeInt32LE(type, 8);

0 commit comments

Comments
 (0)