From 228050b7435418868ab61453a07f7f0f7de3c14a Mon Sep 17 00:00:00 2001 From: DrKittens Date: Thu, 12 Jan 2023 19:21:45 +1100 Subject: [PATCH 01/23] Resolves https://github.com/advisories/GHSA-r7qp-cfhv-p84w --- squad-server/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/package.json b/squad-server/package.json index 8e63448..1768a4b 100644 --- a/squad-server/package.json +++ b/squad-server/package.json @@ -15,7 +15,7 @@ "pg": "^8.5.1", "pg-hstore": "^2.3.3", "sequelize": "^6.3.5", - "socket.io": "^3.1.2", + "socket.io": "^4.5.4", "sqlite3": "^5.0.0", "tedious": "^9.2.1", "tinygradient": "^1.1.2" From f8a9c8f7529b3b42c1b7363b7cc7f6b8482f0a94 Mon Sep 17 00:00:00 2001 From: DrKittens Date: Thu, 12 Jan 2023 22:32:33 +1100 Subject: [PATCH 02/23] resolves https://github.com/advisories/GHSA-crh6-fp67-6883 --- squad-server/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/package.json b/squad-server/package.json index 8e63448..a968673 100644 --- a/squad-server/package.json +++ b/squad-server/package.json @@ -17,7 +17,7 @@ "sequelize": "^6.3.5", "socket.io": "^3.1.2", "sqlite3": "^5.0.0", - "tedious": "^9.2.1", + "tedious": "^15.1.2", "tinygradient": "^1.1.2" }, "exports": { From 59dc6832a58a7205258cce3485b263826c0d11c2 Mon Sep 17 00:00:00 2001 From: Davide Fantino <80767709+fantinodavide@users.noreply.github.com> Date: Sun, 15 Jan 2023 21:26:57 +0100 Subject: [PATCH 03/23] chore: discord fetch channel handle not found --- squad-server/plugins/discord-base-plugin.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/squad-server/plugins/discord-base-plugin.js b/squad-server/plugins/discord-base-plugin.js index 46e5ad1..6fbf0bb 100644 --- a/squad-server/plugins/discord-base-plugin.js +++ b/squad-server/plugins/discord-base-plugin.js @@ -15,7 +15,12 @@ export default class DiscordBasePlugin extends BasePlugin { } async prepareToMount() { - this.channel = await this.options.discordClient.channels.fetch(this.options.channelID); + try { + this.channel = await this.options.discordClient.channels.fetch(this.options.channelID); + } catch (error) { + this.channel = null; + this.verbose(1, `Could not fetch channel: ${this.options.channelID}`); + } } async sendDiscordMessage(message) { From b016226d70b4a61d056175b5bd3cc514f11339a9 Mon Sep 17 00:00:00 2001 From: Davide Fantino <80767709+fantinodavide@users.noreply.github.com> Date: Sun, 15 Jan 2023 21:32:27 +0100 Subject: [PATCH 04/23] chore: handle discord channel not initialized --- squad-server/plugins/discord-base-plugin.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/squad-server/plugins/discord-base-plugin.js b/squad-server/plugins/discord-base-plugin.js index 6fbf0bb..ada90de 100644 --- a/squad-server/plugins/discord-base-plugin.js +++ b/squad-server/plugins/discord-base-plugin.js @@ -24,6 +24,11 @@ export default class DiscordBasePlugin extends BasePlugin { } async sendDiscordMessage(message) { + if (!this.channel) { + this.verbose(1, `Could not send Discord Message. Channel not initialized.`) + return; + } + if (typeof message === 'object' && 'embed' in message) message.embed.footer = message.embed.footer || { text: COPYRIGHT_MESSAGE }; From e2a9c4b79f98770aa1f2cb2cd8e7d6d460ea77e8 Mon Sep 17 00:00:00 2001 From: Davide Fantino <80767709+fantinodavide@users.noreply.github.com> Date: Mon, 16 Jan 2023 10:05:11 +0100 Subject: [PATCH 05/23] chore: more detailed logging for fetch discord channel errors --- squad-server/plugins/discord-base-plugin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/squad-server/plugins/discord-base-plugin.js b/squad-server/plugins/discord-base-plugin.js index ada90de..65c5883 100644 --- a/squad-server/plugins/discord-base-plugin.js +++ b/squad-server/plugins/discord-base-plugin.js @@ -19,7 +19,8 @@ export default class DiscordBasePlugin extends BasePlugin { this.channel = await this.options.discordClient.channels.fetch(this.options.channelID); } catch (error) { this.channel = null; - this.verbose(1, `Could not fetch channel: ${this.options.channelID}`); + this.verbose(1, `Could not fetch Discord channel with channelID "${this.options.channelID}". Error: ${error.message}`); + this.verbose(2, `${error.stack}`); } } From 836300b393dc32d7ddafa1b7cd1c8c8f94fbc844 Mon Sep 17 00:00:00 2001 From: werewolfboy13 Date: Wed, 18 Jan 2023 18:28:33 -0600 Subject: [PATCH 06/23] Updating wiki pipeline address. --- squad-server/layers/layers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/layers/layers.js b/squad-server/layers/layers.js index 7020741..b2cc4da 100644 --- a/squad-server/layers/layers.js +++ b/squad-server/layers/layers.js @@ -22,7 +22,7 @@ class Layers { Logger.verbose('Layers', 1, 'Pulling layers...'); const response = await axios.get( - 'https://raw.githubusercontent.com/Squad-Wiki-Editorial/squad-wiki-pipeline-map-data/master/completed_output/_Current%20Version/finished.json' + 'https://raw.githubusercontent.com/Squad-Wiki/squad-wiki-pipeline-map-data/master/completed_output/_Current%20Version/finished.json' ); for (const layer of response.data.Maps) { From fd7483a3237bf8326eaf42cf28ef3aeb0d82feb6 Mon Sep 17 00:00:00 2001 From: ect0s <73128770+ect0s@users.noreply.github.com> Date: Fri, 20 Jan 2023 20:59:07 -0500 Subject: [PATCH 07/23] Add Timestamps to logger Change logger string constructor; By default, no logging enabled. if timestamps exists in logger config, timestamps enabled --- core/logger.js | 12 +++++++++++- squad-server/factory.js | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/logger.js b/core/logger.js index b20ddbe..564cf20 100644 --- a/core/logger.js +++ b/core/logger.js @@ -4,6 +4,7 @@ class Logger { constructor() { this.verboseness = {}; this.colors = {}; + this.includeTimestamps = false; } verbose(module, verboseness, message, ...extras) { @@ -11,7 +12,12 @@ class Logger { if (typeof colorFunc !== 'function') colorFunc = chalk.white; if ((this.verboseness[module] || 1) >= verboseness) - console.log(`[${colorFunc(module)}][${verboseness}] ${message}`, ...extras); + console.log( + `${this.includeTimestamps ? '[' + new Date().toISOString() + ']' : ''}[${colorFunc( + module + )}][${verboseness}] ${message}`, + ...extras + ); } setVerboseness(module, verboseness) { @@ -21,6 +27,10 @@ class Logger { setColor(module, color) { this.colors[module] = color; } + + setTimeStamps(option) { + this.includeTimestamps = option; + } } export default new Logger(); diff --git a/squad-server/factory.js b/squad-server/factory.js index df91aa1..a8865a5 100644 --- a/squad-server/factory.js +++ b/squad-server/factory.js @@ -17,6 +17,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); export default class SquadServerFactory { static async buildFromConfig(config) { + Logger.setTimeStamps(config.logger.timestamps ? config.logger.timestamps : false); + const plugins = await Plugins.getPlugins(); for (const plugin of Object.keys(plugins)) { From 4e561c43628da69621f1781b018d585229a4b818 Mon Sep 17 00:00:00 2001 From: Davide Fantino <80767709+fantinodavide@users.noreply.github.com> Date: Sat, 21 Jan 2023 22:02:11 +0100 Subject: [PATCH 08/23] fix: antitank vehicles being recognized as tanks --- squad-server/layers/layer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/layers/layer.js b/squad-server/layers/layer.js index e19fd30..78bb0b0 100644 --- a/squad-server/layers/layer.js +++ b/squad-server/layers/layer.js @@ -31,7 +31,7 @@ export default class Layer { respawnDelay: vehicle.respawnTime })), numberOfTanks: (data[t].vehicles || []).filter((v) => { - return v.icon.match(/tank/); + return v.icon.match(/_tank/); }).length, numberOfHelicopters: (data[t].vehicles || []).filter((v) => { return v.icon.match(/helo/); From 3042c494d200cc72f462b256c77aa2d209a14ccf Mon Sep 17 00:00:00 2001 From: Matz Reckeweg Date: Sun, 29 Jan 2023 12:22:51 +0100 Subject: [PATCH 09/23] Apply codestyle --- squad-server/plugins/discord-base-plugin.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/squad-server/plugins/discord-base-plugin.js b/squad-server/plugins/discord-base-plugin.js index 65c5883..26557ed 100644 --- a/squad-server/plugins/discord-base-plugin.js +++ b/squad-server/plugins/discord-base-plugin.js @@ -19,14 +19,17 @@ export default class DiscordBasePlugin extends BasePlugin { this.channel = await this.options.discordClient.channels.fetch(this.options.channelID); } catch (error) { this.channel = null; - this.verbose(1, `Could not fetch Discord channel with channelID "${this.options.channelID}". Error: ${error.message}`); + this.verbose( + 1, + `Could not fetch Discord channel with channelID "${this.options.channelID}". Error: ${error.message}` + ); this.verbose(2, `${error.stack}`); } } async sendDiscordMessage(message) { if (!this.channel) { - this.verbose(1, `Could not send Discord Message. Channel not initialized.`) + this.verbose(1, `Could not send Discord Message. Channel not initialized.`); return; } From fba1637f91cb173ca91c587501efe404948d2386 Mon Sep 17 00:00:00 2001 From: Marek Date: Sun, 12 Feb 2023 13:04:24 -0600 Subject: [PATCH 10/23] Bump Version Number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f614ed0..ac2c386 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SquadJS", - "version": "3.6.1", + "version": "3.7.0", "repository": "https://github.com/Team-Silver-Sphere/SquadJS.git", "author": "Thomas Smyth ", "license": "BSL-1.0", From 7b23e710e69ae7c4f06041287afb380c021e38ce Mon Sep 17 00:00:00 2001 From: ect0s <73128770+ect0s@users.noreply.github.com> Date: Fri, 17 Feb 2023 05:52:45 -0500 Subject: [PATCH 11/23] Change from Unet:close to Uchannel:close In certain cases we do not much Unetclosed or it is missing from the log, however channel seams to always be called --- squad-server/log-parser/player-disconnected.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/log-parser/player-disconnected.js b/squad-server/log-parser/player-disconnected.js index 6df5e64..c25882a 100644 --- a/squad-server/log-parser/player-disconnected.js +++ b/squad-server/log-parser/player-disconnected.js @@ -1,6 +1,6 @@ export default { regex: - /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: UNetConnection::Close: \[UNetConnection\] RemoteAddr: ([0-9]{17}):[0-9]+, Name: SteamNetConnection_[0-9]+, Driver: GameNetDriver SteamNetDriver_[0-9]+, IsServer: YES, PC: (BP_PlayerController_C_[0-9]+), Owner: BP_PlayerController_C_[0-9]+, UniqueId: Steam:UNKNOWN \[.*\], Channels: [0-9]+, Time: [0-9.:-]+/, + /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: UChannel::Close: Sending CloseBunch\. ChIndex == [0-9]+\. Name: \[UChannel\] ChIndex: [0-9]+, Closing: [0-9]+ \[UNetConnection\] RemoteAddr: ([0-9]{17}):[0-9]+, Name: SteamNetConnection_[0-9]+, Driver: GameNetDriver SteamNetDriver_[0-9]+, IsServer: YES, PC: (BP_PlayerController_C_[0-9]+), Owner: BP_PlayerController_C_[0-9]+/, onMatch: (args, logParser) => { const data = { raw: args[0], From f71088e1302be19d37b0ed6546b6f0fa6a1662fe Mon Sep 17 00:00:00 2001 From: Data Brezack Date: Sat, 13 May 2023 12:55:17 -0400 Subject: [PATCH 12/23] Add Pawn To OnPossess --- squad-server/log-parser/player-possess.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/squad-server/log-parser/player-possess.js b/squad-server/log-parser/player-possess.js index 68dda70..12ceb84 100644 --- a/squad-server/log-parser/player-possess.js +++ b/squad-server/log-parser/player-possess.js @@ -7,7 +7,8 @@ export default { time: args[1], chainID: args[2], playerSuffix: args[3], - possessClassname: args[4] + possessClassname: args[4], + pawn: args[5] }; logParser.eventStore.session[args[3]] = args[2]; From 519dab9453c9ce93c30e5a61978c83b57996fcdc Mon Sep 17 00:00:00 2001 From: ect0s <73128770+ect0s@users.noreply.github.com> Date: Fri, 6 Jan 2023 12:25:42 -0500 Subject: [PATCH 13/23] Move Logging for "writing packet" into branch on server auth --- core/rcon.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/rcon.js b/core/rcon.js index 4cfa2e4..61b2030 100644 --- a/core/rcon.js +++ b/core/rcon.js @@ -267,8 +267,6 @@ export default class Rcon extends EventEmitter { return; } - Logger.verbose('RCON', 2, `Writing packet with type "${type}" and body "${body}".`); - const encodedPacket = this.encodePacket( type, type !== SERVERDATA_AUTH ? MID_PACKET_ID : END_PACKET_ID, @@ -290,6 +288,8 @@ export default class Rcon extends EventEmitter { // the auth packet also sends a normal response, so we add an extra empty action to ignore it if (type === SERVERDATA_AUTH) { + Logger.verbose('RCON', 2, `Writing Auth Packet`); + Logger.verbose('RCON', 4, `Writing packet with type "${type}" and body "${body}".`); this.responseCallbackQueue.push(() => {}); this.responseCallbackQueue.push((decodedPacket) => { this.client.removeListener('error', onError); @@ -302,6 +302,7 @@ export default class Rcon extends EventEmitter { } }); } else { + Logger.verbose('RCON', 2, `Writing packet with type "${type}" and body "${body}".`); this.responseCallbackQueue.push((response) => { this.client.removeListener('error', onError); From 1968035cd90b1748ef832505f20f2ea205bdadb9 Mon Sep 17 00:00:00 2001 From: Marek Date: Wed, 1 Nov 2023 19:03:35 -0500 Subject: [PATCH 14/23] Update player-disconnected.js --- squad-server/log-parser/player-disconnected.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/squad-server/log-parser/player-disconnected.js b/squad-server/log-parser/player-disconnected.js index c25882a..e19ab68 100644 --- a/squad-server/log-parser/player-disconnected.js +++ b/squad-server/log-parser/player-disconnected.js @@ -1,7 +1,7 @@ export default { regex: - /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: UChannel::Close: Sending CloseBunch\. ChIndex == [0-9]+\. Name: \[UChannel\] ChIndex: [0-9]+, Closing: [0-9]+ \[UNetConnection\] RemoteAddr: ([0-9]{17}):[0-9]+, Name: SteamNetConnection_[0-9]+, Driver: GameNetDriver SteamNetDriver_[0-9]+, IsServer: YES, PC: (BP_PlayerController_C_[0-9]+), Owner: BP_PlayerController_C_[0-9]+/, - onMatch: (args, logParser) => { + /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: UChannel::Close: Sending CloseBunch\. ChIndex == [0-9]+\. Name: \[UChannel\] ChIndex: [0-9]+, Closing: [0-9]+ \[UNetConnection\] RemoteAddr: ([0-9]{17}):[0-9]+, Name: SteamNetConnection_[0-9]+, Driver: GameNetDriver SteamNetDriver_[0-9]+, IsServer: YES, PC: ([^ ]+PlayerController_C_[0-9]+), Owner: [^ ]+PlayerController_C_[0-9]+/, onMatch: (args, logParser) => { + onMatch: (args, logParser) => { const data = { raw: args[0], time: args[1], From 086dd65d625089a5731a5ed5b7e3754500aefdb4 Mon Sep 17 00:00:00 2001 From: Marek Date: Wed, 1 Nov 2023 19:56:06 -0500 Subject: [PATCH 15/23] Update package.json Patching --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ac2c386..0a5ea4b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SquadJS", - "version": "3.7.0", + "version": "3.7.1", "repository": "https://github.com/Team-Silver-Sphere/SquadJS.git", "author": "Thomas Smyth ", "license": "BSL-1.0", From a6e75376bb7f444c1f780ba5f4f60aa37b119857 Mon Sep 17 00:00:00 2001 From: Marek Date: Wed, 1 Nov 2023 19:59:58 -0500 Subject: [PATCH 16/23] Update package.json Attempt again, Understanding *hopefully* how versioning works. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0a5ea4b..a54f7fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SquadJS", - "version": "3.7.1", + "version": "3.8.0", "repository": "https://github.com/Team-Silver-Sphere/SquadJS.git", "author": "Thomas Smyth ", "license": "BSL-1.0", From 59f011bc2f3a87c749cb40fc6a778e7053df72f5 Mon Sep 17 00:00:00 2001 From: Marek Date: Wed, 1 Nov 2023 20:52:09 -0500 Subject: [PATCH 17/23] Update player-disconnected.js --- .../log-parser/player-disconnected.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/squad-server/log-parser/player-disconnected.js b/squad-server/log-parser/player-disconnected.js index e19ab68..0997697 100644 --- a/squad-server/log-parser/player-disconnected.js +++ b/squad-server/log-parser/player-disconnected.js @@ -1,16 +1,16 @@ export default { regex: - /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: UChannel::Close: Sending CloseBunch\. ChIndex == [0-9]+\. Name: \[UChannel\] ChIndex: [0-9]+, Closing: [0-9]+ \[UNetConnection\] RemoteAddr: ([0-9]{17}):[0-9]+, Name: SteamNetConnection_[0-9]+, Driver: GameNetDriver SteamNetDriver_[0-9]+, IsServer: YES, PC: ([^ ]+PlayerController_C_[0-9]+), Owner: [^ ]+PlayerController_C_[0-9]+/, onMatch: (args, logParser) => { + /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: UChannel::Close: Sending CloseBunch\. ChIndex == [0-9]+\. Name: \[UChannel\] ChIndex: [0-9]+, Closing: [0-9]+ \[UNetConnection\] RemoteAddr: ([0-9]{17}):[0-9]+, Name: SteamNetConnection_[0-9]+, Driver: GameNetDriver SteamNetDriver_[0-9]+, IsServer: YES, PC: ([^ ]+PlayerController_C_[0-9]+), Owner: [^ ]+PlayerController_C_[0-9]+/, onMatch: (args, logParser) => { - const data = { - raw: args[0], - time: args[1], - chainID: args[2], - steamID: args[3], - playerController: args[4] - }; + const data = { + raw: args[0], + time: args[1], + chainID: args[2], + steamID: args[3], + playerController: args[4] + }; - logParser.eventStore.disconnected[data.steamID] = true; - logParser.emit('PLAYER_DISCONNECTED', data); - } + logParser.eventStore.disconnected[data.steamID] = true; + logParser.emit('PLAYER_DISCONNECTED', data); + } }; From ca6a93852e9313168d51f6133c34367854e18102 Mon Sep 17 00:00:00 2001 From: Marek Date: Wed, 1 Nov 2023 20:54:28 -0500 Subject: [PATCH 18/23] 3.8.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a54f7fc..ec1b126 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SquadJS", - "version": "3.8.0", + "version": "3.8.1", "repository": "https://github.com/Team-Silver-Sphere/SquadJS.git", "author": "Thomas Smyth ", "license": "BSL-1.0", From 753fc17e6add15a285a0ea10662f17aad125d7d9 Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 2 Nov 2023 01:14:05 -0400 Subject: [PATCH 19/23] track playercontrollers for death logging --- squad-server/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/squad-server/index.js b/squad-server/index.js index 5aa1bf5..490f0a7 100644 --- a/squad-server/index.js +++ b/squad-server/index.js @@ -242,6 +242,8 @@ export default class SquadServer extends EventEmitter { this.logParser.on('PLAYER_WOUNDED', async (data) => { data.victim = await this.getPlayerByName(data.victimName); data.attacker = await this.getPlayerByName(data.attackerName); + if (!data.attacker) + data.attacker = await this.getPlayerByController(data.attackerPlayerController); if (data.victim && data.attacker) data.teamkill = @@ -257,6 +259,9 @@ export default class SquadServer extends EventEmitter { this.logParser.on('PLAYER_DIED', async (data) => { data.victim = await this.getPlayerByName(data.victimName); + data.attacker = await this.getPlayerByName(data.attackerName); + if (!data.attacker) + data.attacker = await this.getPlayerByController(data.attackerPlayerController); if (data.victim && data.attacker) data.teamkill = @@ -351,6 +356,9 @@ export default class SquadServer extends EventEmitter { players.push({ ...oldPlayerInfo[player.steamID], ...player, + playercontroller: this.logParser.eventStore.players[player.steamID] + ? this.logParser.eventStore.players[player.steamID].controller + : null, squad: await this.getSquadByID(player.teamID, player.squadID) }); @@ -542,6 +550,13 @@ export default class SquadServer extends EventEmitter { return this.getPlayerByCondition((player) => player.suffix === suffix, forceUpdate, false); } + async getPlayerByController(controller, forceUpdate) { + return this.getPlayerByCondition( + (player) => player.playercontroller === controller, + forceUpdate + ); + } + async pingSquadJSAPI() { if (this.pingSquadJSAPITimeout) clearTimeout(this.pingSquadJSAPITimeout); From 09b076f7c47939585b0123156112ec3bd49aadac Mon Sep 17 00:00:00 2001 From: sergelouie6 <49586590+sergelouie6@users.noreply.github.com> Date: Fri, 3 Nov 2023 02:28:07 +0800 Subject: [PATCH 20/23] feat: added missing properties to getListPlayers and getSquads methods --- squad-server/rcon.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/squad-server/rcon.js b/squad-server/rcon.js index 8c605b8..b618ba4 100644 --- a/squad-server/rcon.js +++ b/squad-server/rcon.js @@ -139,9 +139,11 @@ export default class SquadRcon extends Rcon { const players = []; + if(!response || response.length < 1) return players; + for (const line of response.split('\n')) { const match = line.match( - /ID: ([0-9]+) \| SteamID: ([0-9]{17}) \| Name: (.+) \| Team ID: ([0-9]+) \| Squad ID: ([0-9]+|N\/A)/ + /ID: ([0-9]+) \| SteamID: ([0-9]{17}) \| Name: (.+) \| Team ID: ([0-9]+) \| Squad ID: ([0-9]+|N\/A) \| Is Leader: (True|False) \| Role: ([A-Za-z0-9_]*)\b/ ); if (!match) continue; @@ -150,7 +152,9 @@ export default class SquadRcon extends Rcon { steamID: match[2], name: match[3], teamID: match[4], - squadID: match[5] !== 'N/A' ? match[5] : null + squadID: match[5] !== 'N/A' ? match[5] : null, + isLeader: match[6] === 'True', + role: match[7] }); } @@ -164,9 +168,11 @@ export default class SquadRcon extends Rcon { let teamName; let teamID; + if(!responseSquad || responseSquad.length < 1) return squads; + for (const line of responseSquad.split('\n')) { const match = line.match( - /ID: ([0-9]+) \| Name: (.+) \| Size: ([0-9]+) \| Locked: (True|False)/ + /ID: ([0-9]+) \| Name: (.+) \| Size: ([0-9]+) \| Locked: (True|False) \| Creator Name: (.+) \| Creator Steam ID: ([0-9]{17})/ ); const matchSide = line.match(/Team ID: (1|2) \((.+)\)/); if (matchSide) { @@ -174,11 +180,13 @@ export default class SquadRcon extends Rcon { teamName = matchSide[2]; } if (!match) continue; - await squads.push({ + squads.push({ squadID: match[1], squadName: match[2], size: match[3], locked: match[4], + creatorName: match[5], + creatorSteamID: match[6], teamID: teamID, teamName: teamName }); From 5427d360187d974b7fd1b4d9691082564daeca63 Mon Sep 17 00:00:00 2001 From: vohk <8020903+vohk@users.noreply.github.com> Date: Fri, 17 Nov 2023 22:40:14 -0800 Subject: [PATCH 21/23] Update auto-kick-unassigned.js Fixed typo in unassigned warning. --- squad-server/plugins/auto-kick-unassigned.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/plugins/auto-kick-unassigned.js b/squad-server/plugins/auto-kick-unassigned.js index 8a8d784..1a4c81b 100644 --- a/squad-server/plugins/auto-kick-unassigned.js +++ b/squad-server/plugins/auto-kick-unassigned.js @@ -17,7 +17,7 @@ export default class AutoKickUnassigned extends BasePlugin { warningMessage: { required: false, description: 'Message SquadJS will send to players warning them they will be kicked', - default: 'Join a squad, you are are unassigned and will be kicked' + default: 'Join a squad, you are unassigned and will be kicked' }, kickMessage: { required: false, From 6a9b691bcd0aed2dd89c47e5e88cfed7023391e0 Mon Sep 17 00:00:00 2001 From: werewolfboy13 Date: Sat, 18 Nov 2023 17:40:18 -0600 Subject: [PATCH 22/23] Adds Support for #322 --- README.md | 2 +- config.json | 2 +- .../log-parser/player-disconnected.js | 22 +++++++++---------- squad-server/rcon.js | 6 ++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e1b720e..b137e4f 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ Interested in creating your own plugin? [See more here](./squad-server/plugins/r
Description

Message SquadJS will send to players warning them they will be kicked

Default
-
Join a squad, you are are unassigned and will be kicked
+
Join a squad, you are unassigned and will be kicked
  • kickMessage

    Description

    Message to send to players when they are kicked

    diff --git a/config.json b/config.json index e68f5e5..c3e82bc 100644 --- a/config.json +++ b/config.json @@ -43,7 +43,7 @@ { "plugin": "AutoKickUnassigned", "enabled": true, - "warningMessage": "Join a squad, you are are unassigned and will be kicked", + "warningMessage": "Join a squad, you are unassigned and will be kicked", "kickMessage": "Unassigned - automatically removed", "frequencyOfWarnings": 30, "unassignedTimer": 360, diff --git a/squad-server/log-parser/player-disconnected.js b/squad-server/log-parser/player-disconnected.js index 0997697..352a012 100644 --- a/squad-server/log-parser/player-disconnected.js +++ b/squad-server/log-parser/player-disconnected.js @@ -1,16 +1,16 @@ export default { regex: /^\[([0-9.:-]+)]\[([ 0-9]*)]LogNet: UChannel::Close: Sending CloseBunch\. ChIndex == [0-9]+\. Name: \[UChannel\] ChIndex: [0-9]+, Closing: [0-9]+ \[UNetConnection\] RemoteAddr: ([0-9]{17}):[0-9]+, Name: SteamNetConnection_[0-9]+, Driver: GameNetDriver SteamNetDriver_[0-9]+, IsServer: YES, PC: ([^ ]+PlayerController_C_[0-9]+), Owner: [^ ]+PlayerController_C_[0-9]+/, - onMatch: (args, logParser) => { - const data = { - raw: args[0], - time: args[1], - chainID: args[2], - steamID: args[3], - playerController: args[4] - }; + onMatch: (args, logParser) => { + const data = { + raw: args[0], + time: args[1], + chainID: args[2], + steamID: args[3], + playerController: args[4] + }; - logParser.eventStore.disconnected[data.steamID] = true; - logParser.emit('PLAYER_DISCONNECTED', data); - } + logParser.eventStore.disconnected[data.steamID] = true; + logParser.emit('PLAYER_DISCONNECTED', data); + } }; diff --git a/squad-server/rcon.js b/squad-server/rcon.js index b618ba4..7209d7a 100644 --- a/squad-server/rcon.js +++ b/squad-server/rcon.js @@ -139,8 +139,8 @@ export default class SquadRcon extends Rcon { const players = []; - if(!response || response.length < 1) return players; - + if (!response || response.length < 1) return players; + for (const line of response.split('\n')) { const match = line.match( /ID: ([0-9]+) \| SteamID: ([0-9]{17}) \| Name: (.+) \| Team ID: ([0-9]+) \| Squad ID: ([0-9]+|N\/A) \| Is Leader: (True|False) \| Role: ([A-Za-z0-9_]*)\b/ @@ -168,7 +168,7 @@ export default class SquadRcon extends Rcon { let teamName; let teamID; - if(!responseSquad || responseSquad.length < 1) return squads; + if (!responseSquad || responseSquad.length < 1) return squads; for (const line of responseSquad.split('\n')) { const match = line.match( From 297ec0dc4597ddd070d3495e9a9e06e2bd678c29 Mon Sep 17 00:00:00 2001 From: Marek Date: Sat, 18 Nov 2023 17:56:23 -0600 Subject: [PATCH 23/23] Update package.json to 3.8.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ec1b126..29459d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SquadJS", - "version": "3.8.1", + "version": "3.8.2", "repository": "https://github.com/Team-Silver-Sphere/SquadJS.git", "author": "Thomas Smyth ", "license": "BSL-1.0",