From b09cd2ef28ed4c2502262df4fad0299d0e95ef0d Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Fri, 12 Jun 2020 19:56:57 -0400 Subject: [PATCH] Re-enable --server and --port on patched 1.15.2 builds. (#74) --- app/assets/js/assetguard.js | 20 ++++++++++++++++++++ app/assets/js/processbuilder.js | 13 +++++++++++-- package-lock.json | 6 +++--- package.json | 2 +- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/app/assets/js/assetguard.js b/app/assets/js/assetguard.js index 6c93846..7612bff 100644 --- a/app/assets/js/assetguard.js +++ b/app/assets/js/assetguard.js @@ -194,6 +194,26 @@ class Util { } } + static isAutoconnectBroken(forgeVersion) { + + const forgeVer = forgeVersion.split('-')[1] + + const minWorking = [31, 2, 15] + const verSplit = forgeVer.split('.').map(v => Number(v)) + + if(verSplit[0] === 31) { + for(let i=0; i minWorking[i]) { + return false + } else if(verSplit[i] < minWorking[i]) { + return true + } + } + } + + return false + } + } diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index 7e708a4..060b2a9 100644 --- a/app/assets/js/processbuilder.js +++ b/app/assets/js/processbuilder.js @@ -474,11 +474,20 @@ class ProcessBuilder { } // Autoconnect - if(Util.mcVersionAtLeast('1.15', this.server.getMinecraftVersion())) { - logger.error('Server autoconnect disabled on 1.15+ due to OpenGL Stack Overflow issue.') + let isAutoconnectBroken + try { + isAutoconnectBroken = Util.isAutoconnectBroken(this.forgeData.id.split('-')[2]) + } catch(err) { + logger.error('Forge version format changed.. assuming autoconnect works.') + } + + if(isAutoconnectBroken) { + logger.error('Server autoconnect disabled on Forge 1.15.2 for builds earlier than 31.2.15 due to OpenGL Stack Overflow issue.') + logger.error('Please upgrade your Forge version to at least 31.2.15!') } else { this._processAutoConnectArg(args) } + // Forge Specific Arguments args = args.concat(this.forgeData.arguments.game) diff --git a/package-lock.json b/package-lock.json index e42169f..fbf6e9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1025,9 +1025,9 @@ } }, "electron": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/electron/-/electron-9.0.3.tgz", - "integrity": "sha512-rY59wy50z0oWp/q69zq0UIzvtcM5j2BJbLAwEoLfVNS3DLt9wDZqRqSIBvLEBl+xWbafCnRA9haEqi7ssM94GA==", + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/electron/-/electron-9.0.4.tgz", + "integrity": "sha512-QzkeZNAiNB7KxcdoQKSoaiVT/GQdB4Vt0/ZZOuU8tIKABAsni2I7ztiAbUzxcsnQsqEBSfChuPuDQ5A4VbbzPg==", "dev": true, "requires": { "@electron/get": "^1.0.1", diff --git a/package.json b/package.json index 4846649..ca482af 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ }, "devDependencies": { "cross-env": "^7.0.2", - "electron": "^9.0.3", + "electron": "^9.0.4", "electron-builder": "^22.7.0", "eslint": "^7.2.0" },