From ad5e5bf2900b27717a823f6634ca08e42afe8dde Mon Sep 17 00:00:00 2001 From: Skillet Date: Wed, 15 Feb 2023 10:13:05 -0500 Subject: [PATCH 01/53] Don't record PlayerName --- squadjsPlugins/db-log-addOn.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 3085ab2..03a0443 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -39,9 +39,6 @@ export default class DBLogPlayerTime extends DBLog { primaryKey: true, autoIncrement: true }, - playerName: { - type: DataTypes.STRING - }, joinTime: { type: DataTypes.DATE }, @@ -115,7 +112,6 @@ export default class DBLogPlayerTime extends DBLog { await this.models.PlayerTime.create({ server: this.options.overrideServerID || this.server.id, player: info.player.steamID, - playerName: info.player.name, joinTime: info.time, joinedSeeding: this.seeding }); From 37da4689d976b904b443127ac0452c97aa3c4978 Mon Sep 17 00:00:00 2001 From: Skillet Date: Wed, 15 Feb 2023 11:17:07 -0500 Subject: [PATCH 02/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 03a0443..01ccc5c 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -109,6 +109,10 @@ export default class DBLogPlayerTime extends DBLog { async onPlayerConnected(info) { if(info.player){ + await this.models.SteamUser.upsert({ + steamID: info.attacker.steamID, + lastName: info.attacker.name + }); await this.models.PlayerTime.create({ server: this.options.overrideServerID || this.server.id, player: info.player.steamID, @@ -120,6 +124,10 @@ export default class DBLogPlayerTime extends DBLog { async onPlayerDisconnected(info) { if(info.player){ + await this.models.SteamUser.upsert({ + steamID: info.attacker.steamID, + lastName: info.attacker.name + }); await this.models.PlayerTime.update( { leaveTime: info.time }, { where: { player: info.player.steamID, leaveTime: null, server: this.options.overrideServerID || this.server.id } } From 319a9e47c824e851ea4cf9c0aeee814f8976a28f Mon Sep 17 00:00:00 2001 From: Skillet Date: Wed, 15 Feb 2023 11:25:24 -0500 Subject: [PATCH 03/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 01ccc5c..aca799b 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -110,8 +110,8 @@ export default class DBLogPlayerTime extends DBLog { async onPlayerConnected(info) { if(info.player){ await this.models.SteamUser.upsert({ - steamID: info.attacker.steamID, - lastName: info.attacker.name + steamID: info.player.steamID, + lastName: info.player.name }); await this.models.PlayerTime.create({ server: this.options.overrideServerID || this.server.id, @@ -125,8 +125,8 @@ export default class DBLogPlayerTime extends DBLog { async onPlayerDisconnected(info) { if(info.player){ await this.models.SteamUser.upsert({ - steamID: info.attacker.steamID, - lastName: info.attacker.name + steamID: info.player.steamID, + lastName: info.player.name }); await this.models.PlayerTime.update( { leaveTime: info.time }, From 1cf304388bc0ca768e01ac12e875955336078251 Mon Sep 17 00:00:00 2001 From: Skillet Date: Wed, 15 Feb 2023 18:10:44 -0500 Subject: [PATCH 04/53] use custom squadjs --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 488d554..36ea0c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ apt-get update su "${USER}" - <<- __EOC__ ( - git clone --depth 1 --branch "v${squadjs_version}" https://github.com/Team-Silver-Sphere/SquadJS.git "${USER_HOME}/SquadJS" + git clone --depth 1 https://github.com/AsgardEternal/SquadJS.git "${USER_HOME}/SquadJS" cd "${USER_HOME}/SquadJS" || exit 1 yarn install yarn cache clean From b221f96d497e0d1194478cd2cb71aa7c580908cf Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 00:45:05 -0500 Subject: [PATCH 05/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index aca799b..3cc1b64 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -95,16 +95,14 @@ export default class DBLogPlayerTime extends DBLog { async onUpdatedA2SInformation(info) { await super.onUpdatedA2SInformation(info); - - if(info.a2sPlayerCount >= this.options.seedingThreshold && this.seeding === true) { - await this.models.PlayerTime.update( + + if((this.seeding === true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ + this.seeding = false; + await this.models.PlayerTime.update( { seedTime: info.time }, { where: { seedTime: null, joinedSeeding: 1, leaveTime: null, server: this.options.overrideServerID || this.server.id } } - ); - } - - if(this.seeding === true && info.a2sPlayerCount >= this.options.seedingThreshold) this.seeding = false; - else if(this.seeding === false && (info.a2sPlayerCount-20) < this.options.seedingThreshold) this.seeding = true; + ); + }else if(this.seeding === false && (info.a2sPlayerCount-20) < this.options.seedingThreshold) this.seeding = true; } async onPlayerConnected(info) { From 4a13a3f840d564d615db8e4b7e06ca2220e6e010 Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 01:25:08 -0500 Subject: [PATCH 06/53] Update main.yml --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f710ecf..2f0fd8e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,6 +33,5 @@ jobs: context: . file: ./Dockerfile push: true - cache-from: type=registry,ref=${{ vars.DOCKER_REGISTRY_URL }}/squadjs:latest cache-to: type=inline tags: "${{ vars.DOCKER_REGISTRY_URL }}/squadjs:latest" From 57efa1dd75b1ec2f21a1fef5dcf68f677e412317 Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 01:40:56 -0500 Subject: [PATCH 07/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 3cc1b64..e7f9c18 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -106,6 +106,7 @@ export default class DBLogPlayerTime extends DBLog { } async onPlayerConnected(info) { + console.log(info); if(info.player){ await this.models.SteamUser.upsert({ steamID: info.player.steamID, @@ -121,6 +122,7 @@ export default class DBLogPlayerTime extends DBLog { } async onPlayerDisconnected(info) { + console.log(info); if(info.player){ await this.models.SteamUser.upsert({ steamID: info.player.steamID, From d550afacdcb31e6af7168fe14ff1819a7db5ac7a Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 01:48:46 -0500 Subject: [PATCH 08/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index e7f9c18..2609f57 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -97,12 +97,16 @@ export default class DBLogPlayerTime extends DBLog { await super.onUpdatedA2SInformation(info); if((this.seeding === true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ + console.log('switching to Live'); this.seeding = false; await this.models.PlayerTime.update( { seedTime: info.time }, { where: { seedTime: null, joinedSeeding: 1, leaveTime: null, server: this.options.overrideServerID || this.server.id } } ); - }else if(this.seeding === false && (info.a2sPlayerCount-20) < this.options.seedingThreshold) this.seeding = true; + }else if(this.seeding === false && (info.a2sPlayerCount-20) < this.options.seedingThreshold){ + console.log('switching to seeding'); + this.seeding = true; + } } async onPlayerConnected(info) { From 708b14bf516e438aa577a1880adc469d61d67df4 Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 01:52:00 -0500 Subject: [PATCH 09/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 2609f57..8fb6d6a 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -96,14 +96,14 @@ export default class DBLogPlayerTime extends DBLog { async onUpdatedA2SInformation(info) { await super.onUpdatedA2SInformation(info); - if((this.seeding === true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ + if((this.seeding == true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ console.log('switching to Live'); this.seeding = false; await this.models.PlayerTime.update( { seedTime: info.time }, { where: { seedTime: null, joinedSeeding: 1, leaveTime: null, server: this.options.overrideServerID || this.server.id } } ); - }else if(this.seeding === false && (info.a2sPlayerCount-20) < this.options.seedingThreshold){ + }else if(this.seeding == false && (info.a2sPlayerCount-20) < this.options.seedingThreshold){ console.log('switching to seeding'); this.seeding = true; } From 6fedab417d5375bd980f0ee7f3258fcd33b9af4f Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 02:02:17 -0500 Subject: [PATCH 10/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 1 + 1 file changed, 1 insertion(+) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 8fb6d6a..d27b64d 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -95,6 +95,7 @@ export default class DBLogPlayerTime extends DBLog { async onUpdatedA2SInformation(info) { await super.onUpdatedA2SInformation(info); + console.log(info); if((this.seeding == true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ console.log('switching to Live'); From dac74f45fe09028d9e49c3d301b1fc9189de2740 Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 02:37:14 -0500 Subject: [PATCH 11/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index d27b64d..8eec195 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -97,14 +97,15 @@ export default class DBLogPlayerTime extends DBLog { await super.onUpdatedA2SInformation(info); console.log(info); - if((this.seeding == true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ + if((this.seeding == true) && (info.a2sPlayerCount >= 1)){ console.log('switching to Live'); this.seeding = false; + let curDateTime = new Date(); await this.models.PlayerTime.update( - { seedTime: info.time }, + { seedTime: curDateTime.getFullYear() + '-' + (curDateTime.getMonth() + 1) + '-' + curDateTime.getDate()+'T'+curDateTime.getHours()+':'+curDateTime.getMinutes()+':'+curDateTime.getSeconds()+'Z'}, { where: { seedTime: null, joinedSeeding: 1, leaveTime: null, server: this.options.overrideServerID || this.server.id } } ); - }else if(this.seeding == false && (info.a2sPlayerCount-20) < this.options.seedingThreshold){ + }else if(this.seeding == false && (info.a2sPlayerCount) < 1){ console.log('switching to seeding'); this.seeding = true; } From b96a9c259e3f119a1c0dd607186a46b88fcee971 Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 02:42:51 -0500 Subject: [PATCH 12/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 8eec195..96fad31 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -101,8 +101,10 @@ export default class DBLogPlayerTime extends DBLog { console.log('switching to Live'); this.seeding = false; let curDateTime = new Date(); + let timeNow = curDateTime.getFullYear() + '-' + (curDateTime.getMonth() + 1) + '-' + curDateTime.getDate()+' '+curDateTime.getHours()+':'+curDateTime.getMinutes()+':'+curDateTime.getSeconds(); + console.log(timeNow); await this.models.PlayerTime.update( - { seedTime: curDateTime.getFullYear() + '-' + (curDateTime.getMonth() + 1) + '-' + curDateTime.getDate()+'T'+curDateTime.getHours()+':'+curDateTime.getMinutes()+':'+curDateTime.getSeconds()+'Z'}, + { seedTime: timeNow }, { where: { seedTime: null, joinedSeeding: 1, leaveTime: null, server: this.options.overrideServerID || this.server.id } } ); }else if(this.seeding == false && (info.a2sPlayerCount) < 1){ From 426d476f0ae8a1d2c03d3ba5c222d92bb130ded1 Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 19:08:34 -0500 Subject: [PATCH 13/53] hook into player_kicked event --- squadjsPlugins/db-log-addOn.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 96fad31..db5bf3e 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -81,6 +81,7 @@ export default class DBLogPlayerTime extends DBLog { await super.mount(); this.server.on('PLAYER_CONNECTED', this.onPlayerConnected); this.server.on('PLAYER_DISCONNECTED', this.onPlayerDisconnected); + this.server.on('PLAYER_KICKED', this.onPlayerDisconnected); } async unmount() { @@ -91,6 +92,7 @@ export default class DBLogPlayerTime extends DBLog { await super.unmount(); this.server.removeEventListener('PLAYER_CONNECTED', this.onPlayerConnected); this.server.removeEventListener('PLAYER_DISCONNECTED', this.onPlayerDisconnected); + this.server.removeEventListener('PLAYER_KICKED', this.onPlayerDisconnected); } async onUpdatedA2SInformation(info) { From 25cb18afcb5eb8b7f66903fa68ed5e624da8e32d Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 19:11:23 -0500 Subject: [PATCH 14/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index db5bf3e..68bb84c 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -102,11 +102,8 @@ export default class DBLogPlayerTime extends DBLog { if((this.seeding == true) && (info.a2sPlayerCount >= 1)){ console.log('switching to Live'); this.seeding = false; - let curDateTime = new Date(); - let timeNow = curDateTime.getFullYear() + '-' + (curDateTime.getMonth() + 1) + '-' + curDateTime.getDate()+' '+curDateTime.getHours()+':'+curDateTime.getMinutes()+':'+curDateTime.getSeconds(); - console.log(timeNow); await this.models.PlayerTime.update( - { seedTime: timeNow }, + { seedTime: new Date() }, { where: { seedTime: null, joinedSeeding: 1, leaveTime: null, server: this.options.overrideServerID || this.server.id } } ); }else if(this.seeding == false && (info.a2sPlayerCount) < 1){ From 6ab45d01f9feba475a915e222c693e36deee3ce9 Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 19:12:29 -0500 Subject: [PATCH 15/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 68bb84c..37392ab 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -99,14 +99,14 @@ export default class DBLogPlayerTime extends DBLog { await super.onUpdatedA2SInformation(info); console.log(info); - if((this.seeding == true) && (info.a2sPlayerCount >= 1)){ + if((this.seeding == true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ console.log('switching to Live'); this.seeding = false; await this.models.PlayerTime.update( { seedTime: new Date() }, { where: { seedTime: null, joinedSeeding: 1, leaveTime: null, server: this.options.overrideServerID || this.server.id } } ); - }else if(this.seeding == false && (info.a2sPlayerCount) < 1){ + }else if(this.seeding == false && (info.a2sPlayerCount-20) < this.options.seedingThreshold){ console.log('switching to seeding'); this.seeding = true; } From 65e778a9eb402e890143206f559c119e36c5b172 Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 16 Feb 2023 20:32:58 -0500 Subject: [PATCH 16/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 37392ab..14e13b3 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -102,8 +102,11 @@ export default class DBLogPlayerTime extends DBLog { if((this.seeding == true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ console.log('switching to Live'); this.seeding = false; + let curDateTime = new Date(); + let timeNow = curDateTime.getFullYear() + '-' + (curDateTime.getMonth() + 1) + '-' + curDateTime.getDate()+' '+curDateTime.getHours()+':'+curDateTime.getMinutes()+':'+curDateTime.getSeconds(); + console.log(timeNow); await this.models.PlayerTime.update( - { seedTime: new Date() }, + { seedTime: timeNow }, { where: { seedTime: null, joinedSeeding: 1, leaveTime: null, server: this.options.overrideServerID || this.server.id } } ); }else if(this.seeding == false && (info.a2sPlayerCount-20) < this.options.seedingThreshold){ From 02cf7fae4e929d0c9b1e5d2510eab4381a1468c9 Mon Sep 17 00:00:00 2001 From: Skillet Date: Fri, 17 Feb 2023 02:16:52 -0500 Subject: [PATCH 17/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 14e13b3..8c17014 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -81,7 +81,6 @@ export default class DBLogPlayerTime extends DBLog { await super.mount(); this.server.on('PLAYER_CONNECTED', this.onPlayerConnected); this.server.on('PLAYER_DISCONNECTED', this.onPlayerDisconnected); - this.server.on('PLAYER_KICKED', this.onPlayerDisconnected); } async unmount() { @@ -92,7 +91,6 @@ export default class DBLogPlayerTime extends DBLog { await super.unmount(); this.server.removeEventListener('PLAYER_CONNECTED', this.onPlayerConnected); this.server.removeEventListener('PLAYER_DISCONNECTED', this.onPlayerDisconnected); - this.server.removeEventListener('PLAYER_KICKED', this.onPlayerDisconnected); } async onUpdatedA2SInformation(info) { From a29b3199f6a8c4d66bbf4e6800423e0e0a2fe8ad Mon Sep 17 00:00:00 2001 From: Skillet Date: Fri, 17 Feb 2023 02:37:09 -0500 Subject: [PATCH 18/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 1 - 1 file changed, 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 8c17014..5b119c1 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -95,7 +95,6 @@ export default class DBLogPlayerTime extends DBLog { async onUpdatedA2SInformation(info) { await super.onUpdatedA2SInformation(info); - console.log(info); if((this.seeding == true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ console.log('switching to Live'); From 2ae23e2cfd6b40fea1dc7993df8be56b671cda53 Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 18 Feb 2023 15:59:13 -0500 Subject: [PATCH 19/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 5b119c1..6004198 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -118,14 +118,13 @@ export default class DBLogPlayerTime extends DBLog { await this.models.SteamUser.upsert({ steamID: info.player.steamID, lastName: info.player.name - }); + });} await this.models.PlayerTime.create({ server: this.options.overrideServerID || this.server.id, - player: info.player.steamID, + player: info.steamID, joinTime: info.time, joinedSeeding: this.seeding }); - } } async onPlayerDisconnected(info) { @@ -134,11 +133,10 @@ export default class DBLogPlayerTime extends DBLog { await this.models.SteamUser.upsert({ steamID: info.player.steamID, lastName: info.player.name - }); + });} await this.models.PlayerTime.update( { leaveTime: info.time }, - { where: { player: info.player.steamID, leaveTime: null, server: this.options.overrideServerID || this.server.id } } + { where: { player: info.steamID, leaveTime: null, server: this.options.overrideServerID || this.server.id } } ); - } } } From b1e3c57ccb8a8c8419b9133157148a3d1d5e9b5c Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 20 Feb 2023 05:34:30 -0500 Subject: [PATCH 20/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 6004198..f73008d 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -118,13 +118,14 @@ export default class DBLogPlayerTime extends DBLog { await this.models.SteamUser.upsert({ steamID: info.player.steamID, lastName: info.player.name - });} + }); await this.models.PlayerTime.create({ server: this.options.overrideServerID || this.server.id, player: info.steamID, joinTime: info.time, joinedSeeding: this.seeding - }); + });} + else console.log('player is null'); } async onPlayerDisconnected(info) { From 1e7a41a950a2cb3278d3d1affeacd63bbd69c017 Mon Sep 17 00:00:00 2001 From: Skillet Date: Wed, 1 Mar 2023 04:03:08 -0500 Subject: [PATCH 21/53] remove the cache --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f0fd8e..631d11f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,5 +33,4 @@ jobs: context: . file: ./Dockerfile push: true - cache-to: type=inline tags: "${{ vars.DOCKER_REGISTRY_URL }}/squadjs:latest" From 4f0612fab7d41709b6d07331b83b6ce59c337a63 Mon Sep 17 00:00:00 2001 From: Skillet Date: Wed, 1 Mar 2023 13:32:18 -0500 Subject: [PATCH 22/53] add database repair for playertimes table --- squadjsPlugins/db-log-addOn.js | 69 ++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index f73008d..f2e58bd 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -74,42 +74,65 @@ export default class DBLogPlayerTime extends DBLog { async prepareToMount() { await super.prepareToMount(); - await this.models.PlayerTime.sync(); + await this.models.PlayerTime.sync(); + } async mount() { await super.mount(); - this.server.on('PLAYER_CONNECTED', this.onPlayerConnected); - this.server.on('PLAYER_DISCONNECTED', this.onPlayerDisconnected); + this.server.on('PLAYER_CONNECTED', this.onPlayerConnected); + this.server.on('PLAYER_DISCONNECTED', this.onPlayerDisconnected); + } + + async repairDB() { + await super.repairDB(); + let lastTickTime = this.models.TickRate.findOne( + { where: { server: this.options.overrideServerID || this.server.id}, + order: [['id', 'DESC']]} + ); + let lastServerTime = lastTickTime.time; + let playerOnlineID = []; + for (player of this.players){ + playerOnlineID.push(player.steamID); + } + const {not} = Sequelize.Op; + this.models.PlayerTime.update( + { leaveTime: lastServerTime }, + { where: { + leaveTime: null, + server: this.options.overrideServerID || this.server.id, + [not]: [{player: playerOnlineID}] + } } + ); } async unmount() { - this.models.PlayerTime.update( - { leaveTime: 0 }, - { where: { leaveTime: null , server: this.options.overrideServerID || this.server.id } } - ); + this.models.PlayerTime.update( + { leaveTime: 0 }, + { where: { leaveTime: null , server: this.options.overrideServerID || this.server.id } } + ); await super.unmount(); - this.server.removeEventListener('PLAYER_CONNECTED', this.onPlayerConnected); - this.server.removeEventListener('PLAYER_DISCONNECTED', this.onPlayerDisconnected); + this.server.removeEventListener('PLAYER_CONNECTED', this.onPlayerConnected); + this.server.removeEventListener('PLAYER_DISCONNECTED', this.onPlayerDisconnected); } async onUpdatedA2SInformation(info) { await super.onUpdatedA2SInformation(info); - if((this.seeding == true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ - console.log('switching to Live'); - this.seeding = false; - let curDateTime = new Date(); - let timeNow = curDateTime.getFullYear() + '-' + (curDateTime.getMonth() + 1) + '-' + curDateTime.getDate()+' '+curDateTime.getHours()+':'+curDateTime.getMinutes()+':'+curDateTime.getSeconds(); - console.log(timeNow); - await this.models.PlayerTime.update( - { seedTime: timeNow }, - { where: { seedTime: null, joinedSeeding: 1, leaveTime: null, server: this.options.overrideServerID || this.server.id } } - ); - }else if(this.seeding == false && (info.a2sPlayerCount-20) < this.options.seedingThreshold){ - console.log('switching to seeding'); - this.seeding = true; - } + if((this.seeding == true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ + console.log('switching to Live'); + this.seeding = false; + let curDateTime = new Date(); + let timeNow = curDateTime.getFullYear() + '-' + (curDateTime.getMonth() + 1) + '-' + curDateTime.getDate()+' '+curDateTime.getHours()+':'+curDateTime.getMinutes()+':'+curDateTime.getSeconds(); + console.log(timeNow); + await this.models.PlayerTime.update( + { seedTime: timeNow }, + { where: { seedTime: null, joinedSeeding: 1, leaveTime: null, server: this.options.overrideServerID || this.server.id } } + ); + }else if(this.seeding == false && (info.a2sPlayerCount-20) < this.options.seedingThreshold){ + console.log('switching to seeding'); + this.seeding = true; + } } async onPlayerConnected(info) { From b2ca04840c4687d3ef6954da5329951ee7ee185c Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 2 Mar 2023 04:53:27 -0500 Subject: [PATCH 23/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 1 + 1 file changed, 1 insertion(+) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index f2e58bd..4af78d5 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -92,6 +92,7 @@ export default class DBLogPlayerTime extends DBLog { ); let lastServerTime = lastTickTime.time; let playerOnlineID = []; + console.log(this.players); for (player of this.players){ playerOnlineID.push(player.steamID); } From 7def712f2ff3c25e0d5b4d18e6b92d6b96e2fc0c Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 2 Mar 2023 05:01:52 -0500 Subject: [PATCH 24/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 4af78d5..d09138a 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -92,8 +92,8 @@ export default class DBLogPlayerTime extends DBLog { ); let lastServerTime = lastTickTime.time; let playerOnlineID = []; - console.log(this.players); - for (player of this.players){ + let players = await this.rcon.getListPlayers(); + for (player of players){ playerOnlineID.push(player.steamID); } const {not} = Sequelize.Op; From ff2d3c84adfd11258edd04082b43eeb474bedbb1 Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 2 Mar 2023 05:18:57 -0500 Subject: [PATCH 25/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index d09138a..428cf5f 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -30,6 +30,8 @@ export default class DBLogPlayerTime extends DBLog { super(server, options, connectors); this.seeding = false; + this.repairSessions = true; + this.lastTickTime = null; this.createModel( 'PlayerTime', @@ -92,7 +94,8 @@ export default class DBLogPlayerTime extends DBLog { ); let lastServerTime = lastTickTime.time; let playerOnlineID = []; - let players = await this.rcon.getListPlayers(); + console.log(this); + let players = await this.server.rcon.getListPlayers(); for (player of players){ playerOnlineID.push(player.steamID); } @@ -119,6 +122,22 @@ export default class DBLogPlayerTime extends DBLog { async onUpdatedA2SInformation(info) { await super.onUpdatedA2SInformation(info); + + if(this.repairSessions == true){ + let playerOnlineID = []; + for (player of this.server){ + playerOnlineID.push(player.steamID); + } + const {not} = Sequelize.Op; + this.models.PlayerTime.update( + { leaveTime: lastServerTime }, + { where: { + leaveTime: null, + server: this.options.overrideServerID || this.server.id, + [not]: [{player: playerOnlineID}] + } } + ); + } if((this.seeding == true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ console.log('switching to Live'); From 8080df93b1489ffceb188ceecc399d4d42387868 Mon Sep 17 00:00:00 2001 From: Skillet Date: Thu, 2 Mar 2023 05:27:21 -0500 Subject: [PATCH 26/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 428cf5f..22afd17 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -94,9 +94,7 @@ export default class DBLogPlayerTime extends DBLog { ); let lastServerTime = lastTickTime.time; let playerOnlineID = []; - console.log(this); - let players = await this.server.rcon.getListPlayers(); - for (player of players){ + for (player of this.server.players){ playerOnlineID.push(player.steamID); } const {not} = Sequelize.Op; @@ -122,22 +120,6 @@ export default class DBLogPlayerTime extends DBLog { async onUpdatedA2SInformation(info) { await super.onUpdatedA2SInformation(info); - - if(this.repairSessions == true){ - let playerOnlineID = []; - for (player of this.server){ - playerOnlineID.push(player.steamID); - } - const {not} = Sequelize.Op; - this.models.PlayerTime.update( - { leaveTime: lastServerTime }, - { where: { - leaveTime: null, - server: this.options.overrideServerID || this.server.id, - [not]: [{player: playerOnlineID}] - } } - ); - } if((this.seeding == true) && (info.a2sPlayerCount >= this.options.seedingThreshold)){ console.log('switching to Live'); From 9a6e18a69109b87e115280853681ac3a258221da Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 4 Mar 2023 08:24:09 -0500 Subject: [PATCH 27/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 22afd17..dc80c88 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -139,30 +139,33 @@ export default class DBLogPlayerTime extends DBLog { async onPlayerConnected(info) { console.log(info); - if(info.player){ - await this.models.SteamUser.upsert({ + if(info.player){ + await this.models.SteamUser.upsert({ steamID: info.player.steamID, lastName: info.player.name }); - await this.models.PlayerTime.create({ - server: this.options.overrideServerID || this.server.id, - player: info.steamID, - joinTime: info.time, - joinedSeeding: this.seeding - });} - else console.log('player is null'); + await this.models.PlayerTime.create({ + server: this.options.overrideServerID || this.server.id, + player: info.steamID, + joinTime: info.time, + joinedSeeding: this.seeding + }); + console.log('player connect complete'); + } else console.log('player is null'); } async onPlayerDisconnected(info) { console.log(info); - if(info.player){ - await this.models.SteamUser.upsert({ + if(info.player){ + await this.models.SteamUser.upsert({ steamID: info.player.steamID, lastName: info.player.name - });} - await this.models.PlayerTime.update( - { leaveTime: info.time }, - { where: { player: info.steamID, leaveTime: null, server: this.options.overrideServerID || this.server.id } } - ); + }); + } + let rowAffect = await this.models.PlayerTime.update( + { leaveTime: info.time }, + { where: { player: info.steamID, leaveTime: null, server: this.options.overrideServerID || this.server.id } } + ); + console.log('player disconnect rows update: %i', rowAffect[0]); } } From 18ddd401cb0657d567bbed7073d99f6a2df89471 Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 4 Mar 2023 09:44:29 -0500 Subject: [PATCH 28/53] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 631d11f..7b7cf86 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: Docker Image CI on: workflow_dispatch: schedule: - - cron: '30 17 * * *' + - cron: '45 18 * * *' push: branches: - Development From 22631f081de8ed7fead7b54d0b37294d76d05d00 Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 4 Mar 2023 10:02:59 -0500 Subject: [PATCH 29/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index dc80c88..3de5c9c 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -81,24 +81,31 @@ export default class DBLogPlayerTime extends DBLog { } async mount() { + console.log('Mounting db-log'); await super.mount(); + console.log('finished mounting db-log'); this.server.on('PLAYER_CONNECTED', this.onPlayerConnected); this.server.on('PLAYER_DISCONNECTED', this.onPlayerDisconnected); + console.log('finished mounting db-log-addOn'); } async repairDB() { + console.log('starting DB repair'); await super.repairDB(); - let lastTickTime = this.models.TickRate.findOne( + console.log('starting DB repair for addOn'); + let lastTickTime = await this.models.TickRate.findOne( { where: { server: this.options.overrideServerID || this.server.id}, order: [['id', 'DESC']]} ); + console.log('last tick found:', lastTickTime); let lastServerTime = lastTickTime.time; let playerOnlineID = []; for (player of this.server.players){ playerOnlineID.push(player.steamID); } + console.log('players online:', playerOnlineID); const {not} = Sequelize.Op; - this.models.PlayerTime.update( + let rowUpdate = await this.models.PlayerTime.update( { leaveTime: lastServerTime }, { where: { leaveTime: null, @@ -106,6 +113,8 @@ export default class DBLogPlayerTime extends DBLog { [not]: [{player: playerOnlineID}] } } ); + console.log('updated playerTimes row count: %i', rowUpdate[0]); + console.log('finish DB repair'); } async unmount() { From 29568dcb6f4ed6c0dc075b921a7a7a8728818e8f Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 4 Mar 2023 10:27:04 -0500 Subject: [PATCH 30/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 3de5c9c..7d0e160 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -99,19 +99,21 @@ export default class DBLogPlayerTime extends DBLog { ); console.log('last tick found:', lastTickTime); let lastServerTime = lastTickTime.time; + console.log('last time found:', lastServerTime); let playerOnlineID = []; for (player of this.server.players){ playerOnlineID.push(player.steamID); } console.log('players online:', playerOnlineID); - const {not} = Sequelize.Op; + const Op = require('sequelize').Op; let rowUpdate = await this.models.PlayerTime.update( { leaveTime: lastServerTime }, { where: { leaveTime: null, server: this.options.overrideServerID || this.server.id, - [not]: [{player: playerOnlineID}] + { [Op.ne]: { player: playerOnlineID } } } } + { logging: console.log } ); console.log('updated playerTimes row count: %i', rowUpdate[0]); console.log('finish DB repair'); From a88349b1ece72c633931c92dcc7f661d00905d9a Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 4 Mar 2023 10:33:02 -0500 Subject: [PATCH 31/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 7d0e160..1fcd668 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -111,7 +111,7 @@ export default class DBLogPlayerTime extends DBLog { { where: { leaveTime: null, server: this.options.overrideServerID || this.server.id, - { [Op.ne]: { player: playerOnlineID } } + [Op.ne]: { player: playerOnlineID } } } { logging: console.log } ); From 1afde41836e25470773a6877cf52215857dd5fcd Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 4 Mar 2023 10:38:49 -0500 Subject: [PATCH 32/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 1fcd668..0e502e6 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -112,7 +112,7 @@ export default class DBLogPlayerTime extends DBLog { leaveTime: null, server: this.options.overrideServerID || this.server.id, [Op.ne]: { player: playerOnlineID } - } } + } }, { logging: console.log } ); console.log('updated playerTimes row count: %i', rowUpdate[0]); From 06672d1edf36cc883efeaa3c3f3f63877b95835a Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 4 Mar 2023 10:45:46 -0500 Subject: [PATCH 33/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 0e502e6..3f5b45f 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -105,13 +105,12 @@ export default class DBLogPlayerTime extends DBLog { playerOnlineID.push(player.steamID); } console.log('players online:', playerOnlineID); - const Op = require('sequelize').Op; let rowUpdate = await this.models.PlayerTime.update( { leaveTime: lastServerTime }, { where: { leaveTime: null, server: this.options.overrideServerID || this.server.id, - [Op.ne]: { player: playerOnlineID } + $not: { player: playerOnlineID } } }, { logging: console.log } ); From 75ed52848a2bf178d602cdb1ff4116b105e9c201 Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 4 Mar 2023 10:54:13 -0500 Subject: [PATCH 34/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 1 + 1 file changed, 1 insertion(+) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 3f5b45f..718561f 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -101,6 +101,7 @@ export default class DBLogPlayerTime extends DBLog { let lastServerTime = lastTickTime.time; console.log('last time found:', lastServerTime); let playerOnlineID = []; + playerOnlineID.push(0); for (player of this.server.players){ playerOnlineID.push(player.steamID); } From 38abd3ba97a3edcb22a883cd503ddf8cfdf8e525 Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 4 Mar 2023 11:01:07 -0500 Subject: [PATCH 35/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 718561f..12b51ac 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -106,12 +106,13 @@ export default class DBLogPlayerTime extends DBLog { playerOnlineID.push(player.steamID); } console.log('players online:', playerOnlineID); + const {ne} = Sequalize.Op; let rowUpdate = await this.models.PlayerTime.update( { leaveTime: lastServerTime }, { where: { leaveTime: null, server: this.options.overrideServerID || this.server.id, - $not: { player: playerOnlineID } + player: { [ne]: playerOnlineID } } }, { logging: console.log } ); From ea770d94580303dab5ef643284cdf974c4074b13 Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 4 Mar 2023 11:05:36 -0500 Subject: [PATCH 36/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 12b51ac..42b3d13 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -106,7 +106,7 @@ export default class DBLogPlayerTime extends DBLog { playerOnlineID.push(player.steamID); } console.log('players online:', playerOnlineID); - const {ne} = Sequalize.Op; + const {ne} = Sequelize.Op; let rowUpdate = await this.models.PlayerTime.update( { leaveTime: lastServerTime }, { where: { From 6e18ef763405b00c2e5cd32cd93e1f9ed5b4de66 Mon Sep 17 00:00:00 2001 From: Skillet Date: Sat, 4 Mar 2023 23:19:45 -0500 Subject: [PATCH 37/53] Fix race condition with connect/disconnect events --- squadjsPlugins/db-log-addOn.js | 1 + 1 file changed, 1 insertion(+) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 42b3d13..4b10cde 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -167,6 +167,7 @@ export default class DBLogPlayerTime extends DBLog { } async onPlayerDisconnected(info) { + await sleep (500); console.log(info); if(info.player){ await this.models.SteamUser.upsert({ From 8c68eba9436789728c997a3280c4228782c3cb35 Mon Sep 17 00:00:00 2001 From: Skillet Date: Sun, 5 Mar 2023 16:57:28 -0500 Subject: [PATCH 38/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 4b10cde..55cef3e 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -102,7 +102,7 @@ export default class DBLogPlayerTime extends DBLog { console.log('last time found:', lastServerTime); let playerOnlineID = []; playerOnlineID.push(0); - for (player of this.server.players){ + for (const player of this.server.players){ playerOnlineID.push(player.steamID); } console.log('players online:', playerOnlineID); From fcc86e95f6037b3617b68194d1b7103c87152277 Mon Sep 17 00:00:00 2001 From: Skillet Date: Sun, 5 Mar 2023 17:10:38 -0500 Subject: [PATCH 39/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 55cef3e..d43f32e 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -107,15 +107,15 @@ export default class DBLogPlayerTime extends DBLog { } console.log('players online:', playerOnlineID); const {ne} = Sequelize.Op; - let rowUpdate = await this.models.PlayerTime.update( - { leaveTime: lastServerTime }, - { where: { - leaveTime: null, - server: this.options.overrideServerID || this.server.id, - player: { [ne]: playerOnlineID } - } }, - { logging: console.log } - ); +// let rowUpdate = await this.models.PlayerTime.update( +// { leaveTime: lastServerTime }, +// { where: { +// leaveTime: null, +// server: this.options.overrideServerID || this.server.id, +// player: { [ne]: playerOnlineID } +// } }, +// { logging: console.log } +// ); console.log('updated playerTimes row count: %i', rowUpdate[0]); console.log('finish DB repair'); } From 5c4877f1d333e2ea2cebb9b07b009ab3df637703 Mon Sep 17 00:00:00 2001 From: Skillet Date: Sun, 5 Mar 2023 18:51:59 -0500 Subject: [PATCH 40/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index d43f32e..f15fb34 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -116,7 +116,7 @@ export default class DBLogPlayerTime extends DBLog { // } }, // { logging: console.log } // ); - console.log('updated playerTimes row count: %i', rowUpdate[0]); +// console.log('updated playerTimes row count: %i', rowUpdate[0]); console.log('finish DB repair'); } From e8c0607fe28de7261bb521666c509aa1220b9cda Mon Sep 17 00:00:00 2001 From: Skillet Date: Sun, 5 Mar 2023 23:34:47 -0500 Subject: [PATCH 41/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index f15fb34..3770c51 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -102,9 +102,9 @@ export default class DBLogPlayerTime extends DBLog { console.log('last time found:', lastServerTime); let playerOnlineID = []; playerOnlineID.push(0); - for (const player of this.server.players){ - playerOnlineID.push(player.steamID); - } +// for (const player of this.server.players){ +// playerOnlineID.push(player.steamID); +// } console.log('players online:', playerOnlineID); const {ne} = Sequelize.Op; // let rowUpdate = await this.models.PlayerTime.update( From 53af31370de7c014428e8bad0322ac2f8697dc78 Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 09:52:36 -0500 Subject: [PATCH 42/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 3770c51..23ef886 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -102,21 +102,21 @@ export default class DBLogPlayerTime extends DBLog { console.log('last time found:', lastServerTime); let playerOnlineID = []; playerOnlineID.push(0); -// for (const player of this.server.players){ -// playerOnlineID.push(player.steamID); -// } + for (const player of this.server.players){ + playerOnlineID.push(player.steamID); + } console.log('players online:', playerOnlineID); - const {ne} = Sequelize.Op; -// let rowUpdate = await this.models.PlayerTime.update( -// { leaveTime: lastServerTime }, -// { where: { -// leaveTime: null, -// server: this.options.overrideServerID || this.server.id, -// player: { [ne]: playerOnlineID } -// } }, -// { logging: console.log } -// ); -// console.log('updated playerTimes row count: %i', rowUpdate[0]); +// const {ne, not, in} = Sequelize.Op; + let rowUpdate = await this.models.PlayerTime.update( + { leaveTime: lastServerTime }, + { where: { + leaveTime: {[Op.not]: null}, + server: this.options.overrideServerID || this.server.id, + player: { [Op.ne]: {[Op.in]: playerOnlineID} } + } }, + { logging: console.log } + ); + console.log('updated playerTimes row count: %i', rowUpdate[0]); console.log('finish DB repair'); } From 7648f6cc45d2cf9887d695d8f24243c14ad0701d Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 10:05:17 -0500 Subject: [PATCH 43/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 1 + 1 file changed, 1 insertion(+) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 23ef886..e61108d 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -1,4 +1,5 @@ import Sequelize from 'sequelize'; +import Op from 'sequalize'; import DBLog from './db-log.js'; From fd189396c4ef1bf24198202ebc6a3a2b76296505 Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 10:09:50 -0500 Subject: [PATCH 44/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index e61108d..36c3d12 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -111,7 +111,7 @@ export default class DBLogPlayerTime extends DBLog { let rowUpdate = await this.models.PlayerTime.update( { leaveTime: lastServerTime }, { where: { - leaveTime: {[Op.not]: null}, + leaveTime: {[Op.is]: null}, server: this.options.overrideServerID || this.server.id, player: { [Op.ne]: {[Op.in]: playerOnlineID} } } }, From 2402b53b09ea7d2f993493f16adb1ad8b6810965 Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 10:14:52 -0500 Subject: [PATCH 45/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 36c3d12..15f44fd 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -1,5 +1,5 @@ import Sequelize from 'sequelize'; -import Op from 'sequalize'; +import Op from 'sequelize'; import DBLog from './db-log.js'; From bf032ac302eb8f12675236d6ffdddc0d649b72a2 Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 10:26:51 -0500 Subject: [PATCH 46/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 15f44fd..4538438 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -1,5 +1,4 @@ import Sequelize from 'sequelize'; -import Op from 'sequelize'; import DBLog from './db-log.js'; @@ -107,13 +106,13 @@ export default class DBLogPlayerTime extends DBLog { playerOnlineID.push(player.steamID); } console.log('players online:', playerOnlineID); -// const {ne, not, in} = Sequelize.Op; + const {ne, not, in: opIn, is} = Sequelize.Op; let rowUpdate = await this.models.PlayerTime.update( { leaveTime: lastServerTime }, { where: { - leaveTime: {[Op.is]: null}, + leaveTime: {[is]: null}, server: this.options.overrideServerID || this.server.id, - player: { [Op.ne]: {[Op.in]: playerOnlineID} } + player: { [ne]: {[opIn]: playerOnlineID} } } }, { logging: console.log } ); From a86eb830e5bf52b834cd6d5fe6ec1e94e092e2ff Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 10:34:36 -0500 Subject: [PATCH 47/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 4538438..359b669 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -112,7 +112,7 @@ export default class DBLogPlayerTime extends DBLog { { where: { leaveTime: {[is]: null}, server: this.options.overrideServerID || this.server.id, - player: { [ne]: {[opIn]: playerOnlineID} } + player: { [not]: {[opIn]: playerOnlineID} } } }, { logging: console.log } ); From 628c10c5dbba3539b5434f504ce61b882a809a93 Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 10:41:57 -0500 Subject: [PATCH 48/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 359b669..2611205 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -106,13 +106,13 @@ export default class DBLogPlayerTime extends DBLog { playerOnlineID.push(player.steamID); } console.log('players online:', playerOnlineID); - const {ne, not, in: opIn, is} = Sequelize.Op; + const {ne, not, notIn, is} = Sequelize.Op; let rowUpdate = await this.models.PlayerTime.update( { leaveTime: lastServerTime }, { where: { leaveTime: {[is]: null}, server: this.options.overrideServerID || this.server.id, - player: { [not]: {[opIn]: playerOnlineID} } + player: {[notIn]: playerOnlineID} } }, { logging: console.log } ); From ef3d4095f8ba4eb8bdbc97e2e985a21a8fe324ea Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 11:11:37 -0500 Subject: [PATCH 49/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 2611205..ff5fed0 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -113,8 +113,9 @@ export default class DBLogPlayerTime extends DBLog { leaveTime: {[is]: null}, server: this.options.overrideServerID || this.server.id, player: {[notIn]: playerOnlineID} - } }, - { logging: console.log } + }, + logging: console.log + } ); console.log('updated playerTimes row count: %i', rowUpdate[0]); console.log('finish DB repair'); From fe5a9c0670ee601a161314ebc0d27a16860b88a6 Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 11:24:27 -0500 Subject: [PATCH 50/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index ff5fed0..d3a27e9 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -98,7 +98,7 @@ export default class DBLogPlayerTime extends DBLog { order: [['id', 'DESC']]} ); console.log('last tick found:', lastTickTime); - let lastServerTime = lastTickTime.time; + let lastServerTime = String(lastTickTime.time); console.log('last time found:', lastServerTime); let playerOnlineID = []; playerOnlineID.push(0); @@ -108,10 +108,10 @@ export default class DBLogPlayerTime extends DBLog { console.log('players online:', playerOnlineID); const {ne, not, notIn, is} = Sequelize.Op; let rowUpdate = await this.models.PlayerTime.update( - { leaveTime: lastServerTime }, + { leaveTime: (lastServerTime) }, { where: { leaveTime: {[is]: null}, - server: this.options.overrideServerID || this.server.id, + server: (this.options.overrideServerID || this.server.id), player: {[notIn]: playerOnlineID} }, logging: console.log From 3ec6c523ddfb87fe5eb489b44fbfc8e0ed3828d8 Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 11:39:00 -0500 Subject: [PATCH 51/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index d3a27e9..e22afa2 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -93,12 +93,15 @@ export default class DBLogPlayerTime extends DBLog { console.log('starting DB repair'); await super.repairDB(); console.log('starting DB repair for addOn'); - let lastTickTime = await this.models.TickRate.findOne( - { where: { server: this.options.overrideServerID || this.server.id}, - order: [['id', 'DESC']]} + let lastTickTime = await this.models.TickRate.findOne({ + where: { server: this.options.overrideServerID || this.server.id}, + order: [['id', 'DESC']], + logging: console.log + } ); console.log('last tick found:', lastTickTime); - let lastServerTime = String(lastTickTime.time); + let lastServerDate = lastTickTime.time; + let lastServerTime = lastServerDate.getFullYear() + '-' + (lastServerDate.getMonth() + 1) + '-' + lastServerDate.getDate()+' '+lastServerDate.getHours()+':'+lastServerDate.getMinutes()+':'+lastServerDate.getSeconds(); console.log('last time found:', lastServerTime); let playerOnlineID = []; playerOnlineID.push(0); @@ -111,7 +114,7 @@ export default class DBLogPlayerTime extends DBLog { { leaveTime: (lastServerTime) }, { where: { leaveTime: {[is]: null}, - server: (this.options.overrideServerID || this.server.id), + server: this.options.overrideServerID || this.server.id, player: {[notIn]: playerOnlineID} }, logging: console.log From dfdd5f4286a061205265515009f48ec3d7a24387 Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 11:48:53 -0500 Subject: [PATCH 52/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index e22afa2..e5d9d85 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -111,7 +111,7 @@ export default class DBLogPlayerTime extends DBLog { console.log('players online:', playerOnlineID); const {ne, not, notIn, is} = Sequelize.Op; let rowUpdate = await this.models.PlayerTime.update( - { leaveTime: (lastServerTime) }, + { leaveTime: lastServerTime }, { where: { leaveTime: {[is]: null}, server: this.options.overrideServerID || this.server.id, From fa06490818a26e146aebd7ec840b9e4f8d3422a9 Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 12:42:02 -0500 Subject: [PATCH 53/53] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index e5d9d85..a59804b 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -110,14 +110,18 @@ export default class DBLogPlayerTime extends DBLog { } console.log('players online:', playerOnlineID); const {ne, not, notIn, is} = Sequelize.Op; + let updateVals = { leaveTime: lastServerTime }; + let whereStuff = { + leaveTime: {[is]: null}, + server: this.options.overrideServerID || this.server.id, + player: {[notIn]: playerOnlineID} + }; + console.log(updateVals); + console.log(whereStuff); let rowUpdate = await this.models.PlayerTime.update( - { leaveTime: lastServerTime }, - { where: { - leaveTime: {[is]: null}, - server: this.options.overrideServerID || this.server.id, - player: {[notIn]: playerOnlineID} - }, - logging: console.log + updateVals, { + where: whereStuff, + logging: console.log } ); console.log('updated playerTimes row count: %i', rowUpdate[0]);