Compare commits

...

4 Commits

Author SHA1 Message Date
Daniel Scalzi fc326ca8f1
Add version.jar to cp until 1.17. 2022-07-29 11:50:53 -04:00
Daniel Scalzi c4ceb7ab0b
Patches to get 1.17 working, need to revise into real solutions. 2022-07-29 11:50:52 -04:00
Daniel Scalzi e7dd171cea
Dependency upgrade. 2022-07-29 11:49:59 -04:00
DamsDev1 2e1ab3c266
Fix expiration token date which return always NaN (#226) 2022-05-21 16:08:29 -04:00
5 changed files with 832 additions and 492 deletions

View File

@ -468,15 +468,15 @@ class JavaGuard extends EventEmitter {
break break
} }
} }
} else { } else if(verOb.major >= 16) {
// TODO Make this logic better. Make java 16 required.
// Java 9+ // Java 9+
if(Util.mcVersionAtLeast('1.13', this.mcVersion)){ if(Util.mcVersionAtLeast('1.17', this.mcVersion)){
console.log('Java 9+ not yet tested.') meta.version = verOb
/* meta.version = verOb
++checksum ++checksum
if(checksum === goal){ if(checksum === goal){
break break
} */ }
} }
} }
// Space included so we get only the vendor. // Space included so we get only the vendor.

View File

@ -245,7 +245,7 @@ async function validateSelectedMojangAccount(){
async function validateSelectedMicrosoftAccount(){ async function validateSelectedMicrosoftAccount(){
const current = ConfigManager.getSelectedAccount() const current = ConfigManager.getSelectedAccount()
const now = new Date().getTime() const now = new Date().getTime()
const mcExpiresAt = Date.parse(current.expiresAt) const mcExpiresAt = current.expiresAt
const mcExpired = now >= mcExpiresAt const mcExpired = now >= mcExpiresAt
if(!mcExpired) { if(!mcExpired) {
@ -254,7 +254,7 @@ async function validateSelectedMicrosoftAccount(){
// MC token expired. Check MS token. // MC token expired. Check MS token.
const msExpiresAt = Date.parse(current.microsoft.expires_at) const msExpiresAt = current.microsoft.expires_at
const msExpired = now >= msExpiresAt const msExpired = now >= msExpiresAt
if(msExpired) { if(msExpired) {
@ -312,4 +312,4 @@ exports.validateSelected = async function(){
return await validateSelectedMojangAccount() return await validateSelectedMojangAccount()
} }
} }

View File

@ -96,6 +96,16 @@ class ProcessBuilder {
return child return child
} }
/**
* Get the platform specific classpath separator. On windows, this is a semicolon.
* On Unix, this is a colon.
*
* @returns {string} The classpath separator for the current operating system.
*/
static getClasspathSeparator() {
return process.platform === 'win32' ? ';' : ':'
}
/** /**
* Determine if an optional mod is enabled from its configuration value. If the * Determine if an optional mod is enabled from its configuration value. If the
* configuration value is null, the required object will be used to * configuration value is null, the required object will be used to
@ -339,7 +349,7 @@ class ProcessBuilder {
// Classpath Argument // Classpath Argument
args.push('-cp') args.push('-cp')
args.push(this.classpathArg(mods, tempNativePath).join(process.platform === 'win32' ? ';' : ':')) args.push(this.classpathArg(mods, tempNativePath).join(ProcessBuilder.getClasspathSeparator()))
// Java Arguments // Java Arguments
if(process.platform === 'darwin'){ if(process.platform === 'darwin'){
@ -377,6 +387,19 @@ class ProcessBuilder {
// JVM Arguments First // JVM Arguments First
let args = this.versionData.arguments.jvm let args = this.versionData.arguments.jvm
// Debug securejarhandler
// args.push('-Dbsl.debug=true')
if(this.forgeData.arguments.jvm != null) {
for(const argStr of this.forgeData.arguments.jvm) {
args.push(argStr
.replaceAll('${library_directory}', this.libPath)
.replaceAll('${classpath_separator}', ProcessBuilder.getClasspathSeparator())
.replaceAll('${version_name}', this.forgeData.id)
)
}
}
//args.push('-Dlog4j.configurationFile=D:\\WesterosCraft\\game\\common\\assets\\log_configs\\client-1.12.xml') //args.push('-Dlog4j.configurationFile=D:\\WesterosCraft\\game\\common\\assets\\log_configs\\client-1.12.xml')
// Java Arguments // Java Arguments
@ -489,7 +512,7 @@ class ProcessBuilder {
val = args[i].replace(argDiscovery, this.launcherVersion) val = args[i].replace(argDiscovery, this.launcherVersion)
break break
case 'classpath': case 'classpath':
val = this.classpathArg(mods, tempNativePath).join(process.platform === 'win32' ? ';' : ':') val = this.classpathArg(mods, tempNativePath).join(ProcessBuilder.getClasspathSeparator())
break break
} }
if(val != null){ if(val != null){
@ -647,9 +670,13 @@ class ProcessBuilder {
classpathArg(mods, tempNativePath){ classpathArg(mods, tempNativePath){
let cpArgs = [] let cpArgs = []
// Add the version.jar to the classpath. if(!Util.mcVersionAtLeast('1.17', this.server.getMinecraftVersion())) {
const version = this.versionData.id // Add the version.jar to the classpath.
cpArgs.push(path.join(this.commonDir, 'versions', version, version + '.jar')) // Must not be added to the classpath for Forge 1.17+.
const version = this.versionData.id
cpArgs.push(path.join(this.commonDir, 'versions', version, version + '.jar'))
}
if(this.usingLiteLoader){ if(this.usingLiteLoader){
cpArgs.push(this.llPath) cpArgs.push(this.llPath)
@ -788,6 +815,15 @@ class ProcessBuilder {
let libs = [] let libs = []
for(let sm of mdl.getSubModules()){ for(let sm of mdl.getSubModules()){
if(sm.getType() === DistroManager.Types.Library){ if(sm.getType() === DistroManager.Types.Library){
// TODO Add as file or something.
const x = sm.getIdentifier()
console.log(x)
if(x.includes(':universal') || x.includes(':slim') || x.includes(':extra') || x.includes(':srg') || x.includes(':client')) {
console.log('SKIPPING ' + x)
continue
}
libs.push(sm.getArtifact().getPath()) libs.push(sm.getArtifact().getPath())
} }
// If this module has submodules, we need to resolve the libraries for those. // If this module has submodules, we need to resolve the libraries for those.

1250
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,14 +25,14 @@
"dependencies": { "dependencies": {
"@electron/remote": "^2.0.8", "@electron/remote": "^2.0.8",
"adm-zip": "^0.5.9", "adm-zip": "^0.5.9",
"async": "^3.2.3", "async": "^3.2.4",
"discord-rpc-patch": "^4.0.1", "discord-rpc-patch": "^4.0.1",
"ejs": "^3.1.8", "ejs": "^3.1.8",
"ejs-electron": "^2.1.1", "ejs-electron": "^2.1.1",
"electron-updater": "^5.0.1", "electron-updater": "^5.0.5",
"fs-extra": "^10.1.0", "fs-extra": "^10.1.0",
"github-syntax-dark": "^0.5.0", "github-syntax-dark": "^0.5.0",
"got": "^11.8.3", "got": "^11.8.5",
"helios-core": "~0.1.0", "helios-core": "~0.1.0",
"jquery": "^3.6.0", "jquery": "^3.6.0",
"node-stream-zip": "^1.15.0", "node-stream-zip": "^1.15.0",
@ -42,9 +42,9 @@
"winreg": "^1.2.4" "winreg": "^1.2.4"
}, },
"devDependencies": { "devDependencies": {
"electron": "^18.2.4", "electron": "^19.0.10",
"electron-builder": "^23.0.3", "electron-builder": "^23.1.0",
"eslint": "^8.16.0" "eslint": "^8.20.0"
}, },
"repository": { "repository": {
"type": "git", "type": "git",