ForgeWrapper 1.5.4 & Log4j Fix

This commit is contained in:
Pierce 2021-12-13 12:44:09 -05:00
parent 28fa81c5c7
commit 4b26d6cfa2
3 changed files with 27 additions and 6 deletions

View file

@ -2,7 +2,7 @@
##### This project is complete for now. ##### This project is complete for now.
[![Build Status](https://travis-ci.com/Pierce01/MinecraftLauncher-core.svg?branch=master)](https://travis-ci.com/Pierce01/MinecraftLauncher-core) [![Build Status](https://travis-ci.com/Pierce01/MinecraftLauncher-core.svg?branch=master)](https://travis-ci.com/Pierce01/MinecraftLauncher-core)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![version](https://img.shields.io/badge/stable_version-3.16.9-blue) ![version](https://img.shields.io/badge/stable_version-3.16.10-blue)
![badge](https://img.shields.io/badge/ncurses-not_supported-purple) ![badge](https://img.shields.io/badge/ncurses-not_supported-purple)
MCLC (Minecraft Launcher Core) is a NodeJS solution for launching modded and vanilla Minecraft without having to download and format everything yourself. MCLC (Minecraft Launcher Core) is a NodeJS solution for launching modded and vanilla Minecraft without having to download and format everything yourself.
@ -118,7 +118,8 @@ let opts = {
version: '1.5.1', version: '1.5.1',
sh1: '90104e9aaa8fbedf6c3d1f6d0b90cabce080b5a9', sh1: '90104e9aaa8fbedf6c3d1f6d0b90cabce080b5a9',
size: 29892, size: 29892,
} },
logj4ConfigurationFile: ''
} }
} }
``` ```

View file

@ -23,9 +23,9 @@ class MCLCore extends EventEmitter {
}, },
fw: { fw: {
baseUrl: 'https://github.com/ZekerZhayard/ForgeWrapper/releases/download/', baseUrl: 'https://github.com/ZekerZhayard/ForgeWrapper/releases/download/',
version: '1.5.3', version: '1.5.4',
sh1: '2b0e06937349a209dbb90dca6381258daa456ad7', sh1: 'e97805af76d4c1cebb753132eadbabd92e67a17b',
size: 30486, size: 34299,
...this.options.overrides ...this.options.overrides
? this.options.overrides.fw ? this.options.overrides.fw
: undefined : undefined
@ -88,6 +88,26 @@ class MCLCore extends EventEmitter {
} else jvm.push(await this.handler.getJVM()) } else jvm.push(await this.handler.getJVM())
if (this.options.customArgs) jvm = jvm.concat(this.options.customArgs) if (this.options.customArgs) jvm = jvm.concat(this.options.customArgs)
if (this.options.overrides.logj4ConfigurationFile) {
jvm.push(`-Dlog4j.configurationFile=${path.resolve(this.options.overrides.logj4ConfigurationFile)}`)
}
// https://help.minecraft.net/hc/en-us/articles/4416199399693-Security-Vulnerability-in-Minecraft-Java-Edition
if (parseInt(versionFile.id.split('.')[1]) === 17) jvm.push('-Dlog4j2.formatMsgNoLookups=true')
if (parseInt(versionFile.id.split('.')[1]) < 17) {
if (!jvm.find(arg => arg.includes('Dlog4j.configurationFile'))) {
const configPath = path.resolve(this.options.overrides.cwd || this.options.root)
const intVersion = parseInt(versionFile.id.split('.')[1])
if (intVersion >= 12) {
await this.handler.downloadAsync('https://launcher.mojang.com/v1/objects/02937d122c86ce73319ef9975b58896fc1b491d1/log4j2_112-116.xml',
configPath, 'log4j2_112-116.xml', true, 'log4j')
jvm.push('-Dlog4j.configurationFile=log4j2_112-116.xml')
} else if (intVersion >= 7) {
await this.handler.downloadAsync('https://launcher.mojang.com/v1/objects/dd2b723346a8dcd48e7f4d245f6bf09e98db9696/log4j2_17-111.xml',
configPath, 'log4j2_17-111.xml', true, 'log4j')
jvm.push('-Dlog4j.configurationFile=log4j2_17-111.xml')
}
}
}
const classes = this.options.overrides.classes || this.handler.cleanUp(await this.handler.getClasses(modifyJson)) const classes = this.options.overrides.classes || this.handler.cleanUp(await this.handler.getClasses(modifyJson))
const classPaths = ['-cp'] const classPaths = ['-cp']

View file

@ -1,6 +1,6 @@
{ {
"name": "minecraft-launcher-core", "name": "minecraft-launcher-core",
"version": "3.16.9", "version": "3.16.10",
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS", "description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {