Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent redistributing Minecraft official jar #304

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/assets/js/processbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,13 @@ class ProcessBuilder {
libs = {...libs, ...res}
}
}
} else if(type === Type.Forge){
// Forge installer generated libraries
const forgeLibs = []
for (const library of this.forgeData.libraries) {
forgeLibs.push(path.join(ConfigManager.getCommonDirectory(), 'libraries', library.downloads.artifact.path))
}
libs = {...libs, ...forgeLibs}
}
}

Expand Down
28 changes: 28 additions & 0 deletions app/assets/js/scripts/landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const cp = require('child_process')
const crypto = require('crypto')
const { URL } = require('url')
const { join } = require('path')
const {
MojangRestAPI,
getServerStatus
Expand Down Expand Up @@ -552,6 +553,33 @@ async function dlAsync(login = true) {
serv.rawServer.id
)

// Install Forge
let wrapperPath
if(isDev) {
wrapperPath = join(process.cwd(), 'libraries', 'java', 'ForgeInstallerCLI.jar')
} else {
const exePath = remote.app.getPath('exe')
if(process.platform === 'darwin'){
wrapperPath = join(exePath, '..', '..', 'Resources', 'libraries', 'java', 'ForgeInstallerCLI.jar')
} else {
wrapperPath = join(exePath, '..', 'resources', 'libraries', 'java', 'ForgeInstallerCLI.jar')
}
}

// Launch Forge Installer
loggerLaunchSuite.info('Installing Forge.')
setLaunchDetails('Installing Forge..')
setLaunchPercentage(0)
const jExe = ConfigManager.getJavaExecutable(ConfigManager.getSelectedServer())
await distributionIndexProcessor.installForge(jExe, wrapperPath, percent => {
setDownloadPercentage(percent)
})
setDownloadPercentage(100)

// Remove download bar.
remote.getCurrentWindow().setProgressBar(-1)

// After Forge installed, we can get the Forge version data.
const forgeData = await distributionIndexProcessor.loadForgeVersionJson(serv)
const versionData = await mojangIndexProcessor.getVersionJson()

Expand Down
Binary file added libraries/java/ForgeInstallerCLI.jar
Binary file not shown.