Browse Source

added own distribution

master
Jonttuuu 10 months ago
parent
commit
c424d66937
  1. 120
      app/assets/js/configmanager.js
  2. 48
      app/assets/js/distromanager.js
  3. 74
      app/assets/js/processbuilder.js
  4. 50
      app/assets/js/scripts/landing.js
  5. 6
      app/landing.ejs
  6. 8
      app/welcome.ejs
  7. 3
      dev-app-update.yml
  8. 14
      electron-builder.yml
  9. 4
      package-lock.json
  10. 15
      package.json

120
app/assets/js/configmanager.js

@ -6,14 +6,14 @@ const logger = require('./loggerutil')('%c[ConfigManager]', 'color: #a02d2a; fon
const sysRoot = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME)
// TODO change
const dataPath = path.join(sysRoot, '.helioslauncher')
const dataPath = path.join(sysRoot, '.jonttucraft')
// Forked processes do not have access to electron, so we have this workaround.
const launcherDir = process.env.CONFIG_DIRECT_PATH || require('@electron/remote').app.getPath('userData')
/**
* Retrieve the absolute path of the launcher directory.
*
*
* @returns {string} The absolute path of the launcher directory.
*/
exports.getLauncherDirectory = function(){
@ -23,7 +23,7 @@ exports.getLauncherDirectory = function(){
/**
* Get the launcher's data directory. This is where all files related
* to game launch are installed (common, instances, java, etc).
*
*
* @returns {string} The absolute path of the launcher's data directory.
*/
exports.getDataDirectory = function(def = false){
@ -32,7 +32,7 @@ exports.getDataDirectory = function(def = false){
/**
* Set the new data directory.
*
*
* @param {string} dataDirectory The new data directory.
*/
exports.setDataDirectory = function(dataDirectory){
@ -168,7 +168,7 @@ exports.isLoaded = function(){
/**
* Validate that the destination object has at least every field
* present in the source object. Assign a default value otherwise.
*
*
* @param {Object} srcObj The source object to reference against.
* @param {Object} destObj The destination object.
* @returns {Object} A validated destination object.
@ -192,7 +192,7 @@ function validateKeySet(srcObj, destObj){
/**
* Check to see if this is the first time the user has launched the
* application. This is determined by the existance of the data path.
*
*
* @returns {boolean} True if this is the first launch, otherwise false.
*/
exports.isFirstLaunch = function(){
@ -202,7 +202,7 @@ exports.isFirstLaunch = function(){
/**
* Returns the name of the folder in the OS temp directory which we
* will use to extract and store native dependencies for game launch.
*
*
* @returns {string} The name of the folder.
*/
exports.getTempNativeFolder = function(){
@ -214,7 +214,7 @@ exports.getTempNativeFolder = function(){
/**
* Retrieve the news cache to determine
* whether or not there is newer news.
*
*
* @returns {Object} The news cache object.
*/
exports.getNewsCache = function(){
@ -223,7 +223,7 @@ exports.getNewsCache = function(){
/**
* Set the new news cache object.
*
*
* @param {Object} newsCache The new news cache object.
*/
exports.setNewsCache = function(newsCache){
@ -232,7 +232,7 @@ exports.setNewsCache = function(newsCache){
/**
* Set whether or not the news has been dismissed (checked)
*
*
* @param {boolean} dismissed Whether or not the news has been dismissed (checked).
*/
exports.setNewsCacheDismissed = function(dismissed){
@ -242,7 +242,7 @@ exports.setNewsCacheDismissed = function(dismissed){
/**
* Retrieve the common directory for shared
* game files (assets, libraries, etc).
*
*
* @returns {string} The launcher's common directory.
*/
exports.getCommonDirectory = function(){
@ -252,7 +252,7 @@ exports.getCommonDirectory = function(){
/**
* Retrieve the instance directory for the per
* server game directories.
*
*
* @returns {string} The launcher's instance directory.
*/
exports.getInstanceDirectory = function(){
@ -262,7 +262,7 @@ exports.getInstanceDirectory = function(){
/**
* Retrieve the launcher's Client Token.
* There is no default client token.
*
*
* @returns {string} The launcher's Client Token.
*/
exports.getClientToken = function(){
@ -271,7 +271,7 @@ exports.getClientToken = function(){
/**
* Set the launcher's Client Token.
*
*
* @param {string} clientToken The launcher's new Client Token.
*/
exports.setClientToken = function(clientToken){
@ -280,7 +280,7 @@ exports.setClientToken = function(clientToken){
/**
* Retrieve the ID of the selected serverpack.
*
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {string} The ID of the selected serverpack.
*/
@ -290,7 +290,7 @@ exports.getSelectedServer = function(def = false){
/**
* Set the ID of the selected serverpack.
*
*
* @param {string} serverID The ID of the new selected serverpack.
*/
exports.setSelectedServer = function(serverID){
@ -299,7 +299,7 @@ exports.setSelectedServer = function(serverID){
/**
* Get an array of each account currently authenticated by the launcher.
*
*
* @returns {Array.<Object>} An array of each stored authenticated account.
*/
exports.getAuthAccounts = function(){
@ -309,7 +309,7 @@ exports.getAuthAccounts = function(){
/**
* Returns the authenticated account with the given uuid. Value may
* be null.
*
*
* @param {string} uuid The uuid of the authenticated account.
* @returns {Object} The authenticated account with the given uuid.
*/
@ -319,10 +319,10 @@ exports.getAuthAccount = function(uuid){
/**
* Update the access token of an authenticated account.
*
*
* @param {string} uuid The uuid of the authenticated account.
* @param {string} accessToken The new Access Token.
*
*
* @returns {Object} The authenticated account object created by this action.
*/
exports.updateAuthAccount = function(uuid, accessToken){
@ -332,12 +332,12 @@ exports.updateAuthAccount = function(uuid, accessToken){
/**
* Adds an authenticated account to the database to be stored.
*
*
* @param {string} uuid The uuid of the authenticated account.
* @param {string} accessToken The accessToken of the authenticated account.
* @param {string} username The username (usually email) of the authenticated account.
* @param {string} displayName The in game name of the authenticated account.
*
*
* @returns {Object} The authenticated account object created by this action.
*/
exports.addAuthAccount = function(uuid, accessToken, username, displayName){
@ -355,9 +355,9 @@ exports.addAuthAccount = function(uuid, accessToken, username, displayName){
* Remove an authenticated account from the database. If the account
* was also the selected account, a new one will be selected. If there
* are no accounts, the selected account will be null.
*
*
* @param {string} uuid The uuid of the authenticated account.
*
*
* @returns {boolean} True if the account was removed, false if it never existed.
*/
exports.removeAuthAccount = function(uuid){
@ -379,7 +379,7 @@ exports.removeAuthAccount = function(uuid){
/**
* Get the currently selected authenticated account.
*
*
* @returns {Object} The selected authenticated account.
*/
exports.getSelectedAccount = function(){
@ -388,10 +388,10 @@ exports.getSelectedAccount = function(){
/**
* Set the selected authenticated account.
*
*
* @param {string} uuid The UUID of the account which is to be set
* as the selected account.
*
*
* @returns {Object} The selected authenticated account.
*/
exports.setSelectedAccount = function(uuid){
@ -404,7 +404,7 @@ exports.setSelectedAccount = function(uuid){
/**
* Get an array of each mod configuration currently stored.
*
*
* @returns {Array.<Object>} An array of each stored mod configuration.
*/
exports.getModConfigurations = function(){
@ -413,7 +413,7 @@ exports.getModConfigurations = function(){
/**
* Set the array of stored mod configurations.
*
*
* @param {Array.<Object>} configurations An array of mod configurations.
*/
exports.setModConfigurations = function(configurations){
@ -422,7 +422,7 @@ exports.setModConfigurations = function(configurations){
/**
* Get the mod configuration for a specific server.
*
*
* @param {string} serverid The id of the server.
* @returns {Object} The mod configuration for the given server.
*/
@ -438,7 +438,7 @@ exports.getModConfiguration = function(serverid){
/**
* Set the mod configuration for a specific server. This overrides any existing value.
*
*
* @param {string} serverid The id of the server for the given mod configuration.
* @param {Object} configuration The mod configuration for the given server.
*/
@ -459,9 +459,9 @@ exports.setModConfiguration = function(serverid, configuration){
/**
* Retrieve the minimum amount of memory for JVM initialization. This value
* contains the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
* contains the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
* 1024 MegaBytes, etc.
*
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {string} The minimum amount of memory for JVM initialization.
*/
@ -471,9 +471,9 @@ exports.getMinRAM = function(def = false){
/**
* Set the minimum amount of memory for JVM initialization. This value should
* contain the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
* contain the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
* 1024 MegaBytes, etc.
*
*
* @param {string} minRAM The new minimum amount of memory for JVM initialization.
*/
exports.setMinRAM = function(minRAM){
@ -482,9 +482,9 @@ exports.setMinRAM = function(minRAM){
/**
* Retrieve the maximum amount of memory for JVM initialization. This value
* contains the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
* contains the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
* 1024 MegaBytes, etc.
*
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {string} The maximum amount of memory for JVM initialization.
*/
@ -494,9 +494,9 @@ exports.getMaxRAM = function(def = false){
/**
* Set the maximum amount of memory for JVM initialization. This value should
* contain the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
* contain the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
* 1024 MegaBytes, etc.
*
*
* @param {string} maxRAM The new maximum amount of memory for JVM initialization.
*/
exports.setMaxRAM = function(maxRAM){
@ -505,9 +505,9 @@ exports.setMaxRAM = function(maxRAM){
/**
* Retrieve the path of the Java Executable.
*
*
* This is a resolved configuration value and defaults to null until externally assigned.
*
*
* @returns {string} The path of the Java Executable.
*/
exports.getJavaExecutable = function(){
@ -516,7 +516,7 @@ exports.getJavaExecutable = function(){
/**
* Set the path of the Java Executable.
*
*
* @param {string} executable The new path of the Java Executable.
*/
exports.setJavaExecutable = function(executable){
@ -527,7 +527,7 @@ exports.setJavaExecutable = function(executable){
* Retrieve the additional arguments for JVM initialization. Required arguments,
* such as memory allocation, will be dynamically resolved and will not be included
* in this value.
*
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {Array.<string>} An array of the additional arguments for JVM initialization.
*/
@ -539,8 +539,8 @@ exports.getJVMOptions = function(def = false){
* Set the additional arguments for JVM initialization. Required arguments,
* such as memory allocation, will be dynamically resolved and should not be
* included in this value.
*
* @param {Array.<string>} jvmOptions An array of the new additional arguments for JVM
*
* @param {Array.<string>} jvmOptions An array of the new additional arguments for JVM
* initialization.
*/
exports.setJVMOptions = function(jvmOptions){
@ -551,7 +551,7 @@ exports.setJVMOptions = function(jvmOptions){
/**
* Retrieve the width of the game window.
*
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {number} The width of the game window.
*/
@ -561,7 +561,7 @@ exports.getGameWidth = function(def = false){
/**
* Set the width of the game window.
*
*
* @param {number} resWidth The new width of the game window.
*/
exports.setGameWidth = function(resWidth){
@ -570,7 +570,7 @@ exports.setGameWidth = function(resWidth){
/**
* Validate a potential new width value.
*
*
* @param {number} resWidth The width value to validate.
* @returns {boolean} Whether or not the value is valid.
*/
@ -581,7 +581,7 @@ exports.validateGameWidth = function(resWidth){
/**
* Retrieve the height of the game window.
*
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {number} The height of the game window.
*/
@ -591,7 +591,7 @@ exports.getGameHeight = function(def = false){
/**
* Set the height of the game window.
*
*
* @param {number} resHeight The new height of the game window.
*/
exports.setGameHeight = function(resHeight){
@ -600,7 +600,7 @@ exports.setGameHeight = function(resHeight){
/**
* Validate a potential new height value.
*
*
* @param {number} resHeight The height value to validate.
* @returns {boolean} Whether or not the value is valid.
*/
@ -611,7 +611,7 @@ exports.validateGameHeight = function(resHeight){
/**
* Check if the game should be launched in fullscreen mode.
*
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {boolean} Whether or not the game is set to launch in fullscreen mode.
*/
@ -621,7 +621,7 @@ exports.getFullscreen = function(def = false){
/**
* Change the status of if the game should be launched in fullscreen mode.
*
*
* @param {boolean} fullscreen Whether or not the game should launch in fullscreen mode.
*/
exports.setFullscreen = function(fullscreen){
@ -630,7 +630,7 @@ exports.setFullscreen = function(fullscreen){
/**
* Check if the game should auto connect to servers.
*
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {boolean} Whether or not the game should auto connect to servers.
*/
@ -640,7 +640,7 @@ exports.getAutoConnect = function(def = false){
/**
* Change the status of whether or not the game should auto connect to servers.
*
*
* @param {boolean} autoConnect Whether or not the game should auto connect to servers.
*/
exports.setAutoConnect = function(autoConnect){
@ -649,7 +649,7 @@ exports.setAutoConnect = function(autoConnect){
/**
* Check if the game should launch as a detached process.
*
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {boolean} Whether or not the game will launch as a detached process.
*/
@ -659,7 +659,7 @@ exports.getLaunchDetached = function(def = false){
/**
* Change the status of whether or not the game should launch as a detached process.
*
*
* @param {boolean} launchDetached Whether or not the game should launch as a detached process.
*/
exports.setLaunchDetached = function(launchDetached){
@ -670,7 +670,7 @@ exports.setLaunchDetached = function(launchDetached){
/**
* Check if the launcher should download prerelease versions.
*
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {boolean} Whether or not the launcher should download prerelease versions.
*/
@ -680,9 +680,9 @@ exports.getAllowPrerelease = function(def = false){
/**
* Change the status of Whether or not the launcher should download prerelease versions.
*
*
* @param {boolean} launchDetached Whether or not the launcher should download prerelease versions.
*/
exports.setAllowPrerelease = function(allowPrerelease){
config.settings.launcher.allowPrerelease = allowPrerelease
}
}

48
app/assets/js/distromanager.js

@ -10,12 +10,12 @@ const logger = require('./loggerutil')('%c[DistroManager]', 'color: #a02d
* for a specific module.
*/
class Artifact {
/**
* Parse a JSON object into an Artifact.
*
*
* @param {Object} json A JSON object representing an Artifact.
*
*
* @returns {Artifact} The parsed Artifact.
*/
static fromJSON(json){
@ -26,7 +26,7 @@ class Artifact {
* Get the MD5 hash of the artifact. This value may
* be undefined for artifacts which are not to be
* validated and updated.
*
*
* @returns {string} The MD5 hash of the Artifact or undefined.
*/
getHash(){
@ -62,12 +62,12 @@ exports.Artifact
* of a module.
*/
class Required {
/**
* Parse a JSON object into a Required object.
*
*
* @param {Object} json A JSON object representing a Required object.
*
*
* @returns {Required} The parsed Required object.
*/
static fromJSON(json){
@ -87,7 +87,7 @@ class Required {
* Get the default value for a required object. If a module
* is not required, this value determines whether or not
* it is enabled by default.
*
*
* @returns {boolean} The default enabled value.
*/
isDefault(){
@ -111,10 +111,10 @@ class Module {
/**
* Parse a JSON object into a Module.
*
*
* @param {Object} json A JSON object representing a Module.
* @param {string} serverid The ID of the server to which this module belongs.
*
*
* @returns {Module} The parsed Module.
*/
static fromJSON(json, serverid){
@ -123,9 +123,9 @@ class Module {
/**
* Resolve the default extension for a specific module type.
*
*
* @param {string} type The type of the module.
*
*
* @return {string} The default extension for the given type.
*/
static _resolveDefaultExtension(type){
@ -316,9 +316,9 @@ class Server {
/**
* Parse a JSON object into a Server.
*
*
* @param {Object} json A JSON object representing a Server.
*
*
* @returns {Server} The parsed Server object.
*/
static fromJSON(json){
@ -423,9 +423,9 @@ class DistroIndex {
/**
* Parse a JSON object into a DistroIndex.
*
*
* @param {Object} json A JSON object representing a DistroIndex.
*
*
* @returns {DistroIndex} The parsed Server object.
*/
static fromJSON(json){
@ -485,9 +485,9 @@ class DistroIndex {
/**
* Get a server configuration by its ID. If it does not
* exist, null will be returned.
*
*
* @param {string} id The ID of the server.
*
*
* @returns {Server} The server configuration with the given ID or null.
*/
getServer(id){
@ -501,7 +501,7 @@ class DistroIndex {
/**
* Get the main server.
*
*
* @returns {Server} The main server.
*/
getMainServer(){
@ -533,12 +533,8 @@ let data = null
* @returns {Promise.<DistroIndex>}
*/
exports.pullRemote = function(){
if(DEV_MODE){
return exports.pullLocal()
}
return new Promise((resolve, reject) => {
const distroURL = 'http://mc.westeroscraft.com/WesterosCraftLauncher/distribution.json'
//const distroURL = 'https://gist.githubusercontent.com/dscalzi/53b1ba7a11d26a5c353f9d5ae484b71b/raw/'
const distroURL = 'https://git.jonttu.fi/Jonttucraft/JonttucraftLauncher/raw/branch/master/distribution/distribution.json'
const opts = {
url: distroURL,
timeout: 2500
@ -546,7 +542,7 @@ exports.pullRemote = function(){
const distroDest = path.join(ConfigManager.getLauncherDirectory(), 'distribution.json')
request(opts, (error, resp, body) => {
if(!error){
try {
data = DistroIndex.fromJSON(JSON.parse(body))
} catch (e) {
@ -608,4 +604,4 @@ exports.isDevMode = function(){
*/
exports.getDistribution = function(){
return data
}
}

74
app/assets/js/processbuilder.js

@ -31,7 +31,7 @@ class ProcessBuilder {
this.usingLiteLoader = false
this.llPath = null
}
/**
* Convienence method to run the functions typically used to build a process.
*/
@ -42,7 +42,7 @@ class ProcessBuilder {
this.setupLiteLoader()
logger.log('Using liteloader:', this.usingLiteLoader)
const modObj = this.resolveModConfiguration(ConfigManager.getModConfiguration(this.server.getID()).mods, this.server.getModules())
// Mod list below 1.13
if(!Util.mcVersionAtLeast('1.13', this.server.getMinecraftVersion())){
this.constructJSONModList('forge', modObj.fMods, true)
@ -50,7 +50,7 @@ class ProcessBuilder {
this.constructJSONModList('liteloader', modObj.lMods, true)
}
}
const uberModArr = modObj.fMods.concat(modObj.lMods)
let args = this.constructJVMArguments(uberModArr, tempNativePath)
@ -100,7 +100,7 @@ class ProcessBuilder {
* Determine if an optional mod is enabled from its configuration value. If the
* configuration value is null, the required object will be used to
* determine if it is enabled.
*
*
* A mod is enabled if:
* * The configuration is not null and one of the following:
* * The configuration is a boolean and true.
@ -108,7 +108,7 @@ class ProcessBuilder {
* * The configuration is null and one of the following:
* * The required object is null.
* * The required object's 'def' property is null or true.
*
*
* @param {Object | boolean} modCfg The mod configuration object.
* @param {Object} required Optional. The required object from the mod's distro declaration.
* @returns {boolean} True if the mod is enabled, false otherwise.
@ -147,7 +147,7 @@ class ProcessBuilder {
/**
* Resolve an array of all enabled mods. These mods will be constructed into
* a mod list format and enabled at launch.
*
*
* @param {Object} modCfg The mod configuration object.
* @param {Array.<Object>} mdls An array of modules to parse.
* @returns {{fMods: Array.<Object>, lMods: Array.<Object>}} An object which contains
@ -214,14 +214,14 @@ class ProcessBuilder {
// We know old forge versions follow this format.
// Error must be caused by newer version.
}
// Equal or errored
return true
}
/**
* Construct a mod list json object.
*
*
* @param {'forge' | 'liteloader'} type The mod list type to construct.
* @param {Array.<Object>} mods An array of mods to add to the mod list.
* @param {boolean} save Optional. Whether or not we should save the mod list file.
@ -242,7 +242,7 @@ class ProcessBuilder {
}
}
modList.modRef = ids
if(save){
const json = JSON.stringify(modList, null, 4)
fs.writeFileSync(type === 'forge' ? this.fmlDir : this.llDir, json, 'UTF-8')
@ -253,7 +253,7 @@ class ProcessBuilder {
// /**
// * Construct the mod argument list for forge 1.13
// *
// *
// * @param {Array.<Object>} mods An array of mods to add to the mod list.
// */
// constructModArguments(mods){
@ -271,12 +271,12 @@ class ProcessBuilder {
// } else {
// return []
// }
// }
/**
* Construct the mod argument list for forge 1.13
*
*
* @param {Array.<Object>} mods An array of mods to add to the mod list.
*/
constructModList(mods) {
@ -312,7 +312,7 @@ class ProcessBuilder {
/**
* Construct the argument array that will be passed to the JVM process.
*
*
* @param {Array.<Object>} mods An array of enabled mods which will be launched with this process.
* @param {string} tempNativePath The path to store the native libraries.
* @returns {Array.<string>} An array containing the full JVM arguments for this process.
@ -328,7 +328,7 @@ class ProcessBuilder {
/**
* Construct the argument array that will be passed to the JVM process.
* This function is for 1.12 and below.
*
*
* @param {Array.<Object>} mods An array of enabled mods which will be launched with this process.
* @param {string} tempNativePath The path to store the native libraries.
* @returns {Array.<string>} An array containing the full JVM arguments for this process.
@ -343,7 +343,7 @@ class ProcessBuilder {
// Java Arguments
if(process.platform === 'darwin'){
args.push('-Xdock:name=HeliosLauncher')
args.push('-Xdock:name=JonttucraftLauncher')
args.push('-Xdock:icon=' + path.join(__dirname, '..', 'images', 'minecraft.icns'))
}
args.push('-Xmx' + ConfigManager.getMaxRAM())
@ -363,9 +363,9 @@ class ProcessBuilder {
/**
* Construct the argument array that will be passed to the JVM process.
* This function is for 1.13+
*
*
* Note: Required Libs https://github.com/MinecraftForge/MinecraftForge/blob/af98088d04186452cb364280340124dfd4766a5c/src/fmllauncher/java/net/minecraftforge/fml/loading/LibraryFinder.java#L82
*
*
* @param {Array.<Object>} mods An array of enabled mods which will be launched with this process.
* @param {string} tempNativePath The path to store the native libraries.
* @returns {Array.<string>} An array containing the full JVM arguments for this process.
@ -377,11 +377,9 @@ class ProcessBuilder {
// JVM Arguments First
let args = this.versionData.arguments.jvm
//args.push('-Dlog4j.configurationFile=D:\\WesterosCraft\\game\\common\\assets\\log_configs\\client-1.12.xml')
// Java Arguments
if(process.platform === 'darwin'){
args.push('-Xdock:name=HeliosLauncher')
args.push('-Xdock:name=JonttucraftLauncher')
args.push('-Xdock:icon=' + path.join(__dirname, '..', 'images', 'minecraft.icns'))
}
args.push('-Xmx' + ConfigManager.getMaxRAM())
@ -396,7 +394,7 @@ class ProcessBuilder {
for(let i=0; i<args.length; i++){
if(typeof args[i] === 'object' && args[i].rules != null){
let checksum = 0
for(let rule of args[i].rules){
if(rule.os != null){
@ -483,7 +481,7 @@ class ProcessBuilder {
val = args[i].replace(argDiscovery, tempNativePath)
break
case 'launcher_name':
val = args[i].replace(argDiscovery, 'Helios-Launcher')
val = args[i].replace(argDiscovery, 'Jonttucraft-Launcher')
break
case 'launcher_version':
val = args[i].replace(argDiscovery, this.launcherVersion)
@ -515,7 +513,7 @@ class ProcessBuilder {
} else {
this._processAutoConnectArg(args)
}
// Forge Specific Arguments
args = args.concat(this.forgeData.arguments.game)
@ -530,7 +528,7 @@ class ProcessBuilder {
/**
* Resolve the arguments required by forge.
*
*
* @returns {Array.<string>} An array containing the arguments required by forge.
*/
_resolveForgeArgs(){
@ -594,7 +592,7 @@ class ProcessBuilder {
mcArgs.push('--height')
mcArgs.push(ConfigManager.getGameHeight())
}
// Mod List File Argument
mcArgs.push('--modListFile')
if(this._lteMinorVersion(9)) {
@ -602,7 +600,7 @@ class ProcessBuilder {
} else {
mcArgs.push('absolute:' + this.fmlDir)
}
// LiteLoader
if(this.usingLiteLoader){
@ -619,7 +617,7 @@ class ProcessBuilder {
/**
* Ensure that the classpath entries all point to jar files.
*
*
* @param {Array.<String>} list Array of classpath entries.
*/
_processClassPathList(list) {
@ -639,7 +637,7 @@ class ProcessBuilder {
* Resolve the full classpath argument list for this process. This method will resolve all Mojang-declared
* libraries as well as the libraries declared by the server. Since mods are permitted to declare libraries,
* this method requires all enabled mods as an input
*
*
* @param {Array.<Object>} mods An array of enabled mods which will be launched with this process.
* @param {string} tempNativePath The path to store the native libraries.
* @returns {Array.<string>} An array containing the paths of each library required by this process.
@ -675,9 +673,9 @@ class ProcessBuilder {
/**
* Resolve the libraries defined by Mojang's version data. This method will also extract
* native libraries and point to the correct location for its classpath.
*
*
* TODO - clean up function
*
*
* @param {string} tempNativePath The path to store the native libraries.
* @returns {{[id: string]: string}} An object containing the paths of each library mojang declares.
*/
@ -699,17 +697,17 @@ class ProcessBuilder {
// Extract the native library.
const exclusionArr = lib.extract != null ? lib.extract.exclude : ['META-INF/']
const artifact = lib.downloads.classifiers[lib.natives[Library.mojangFriendlyOS()].replace('${arch}', process.arch.replace('x', ''))]
// Location of native zip.
const to = path.join(this.libPath, artifact.path)
let zip = new AdmZip(to)
let zipEntries = zip.getEntries()
// Unzip the native zip.
for(let i=0; i<zipEntries.length; i++){
const fileName = zipEntries[i].entryName
let shouldExclude = false
// Exclude noted files.
@ -727,7 +725,7 @@ class ProcessBuilder {
}
})
}
}
}
}
@ -740,7 +738,7 @@ class ProcessBuilder {
* Resolve the libraries declared by this server in order to add them to the classpath.
* This method will also check each enabled mod for libraries, as mods are permitted to
* declare libraries.
*
*
* @param {Array.<Object>} mods An array of enabled mods which will be launched with this process.
* @returns {{[id: string]: string}} An object containing the paths of each library this server requires.
*/
@ -777,7 +775,7 @@ class ProcessBuilder {
/**
* Recursively resolve the path of each library required by this module.
*
*
* @param {Object} mdl A module object from the server distro index.
* @returns {Array.<string>} An array containing the paths of each library this module requires.
*/
@ -804,4 +802,4 @@ class ProcessBuilder {
}
module.exports = ProcessBuilder
module.exports = ProcessBuilder

50
app/assets/js/scripts/landing.js

@ -27,7 +27,7 @@ const loggerLanding = LoggerUtil('%c[Landing]', 'color: #000668; font-weight: bo
/**
* Show/hide the loading area.
*
*
* @param {boolean} loading True if the loading area should be shown, otherwise false.
*/
function toggleLaunchArea(loading){
@ -42,7 +42,7 @@ function toggleLaunchArea(loading){
/**
* Set the details text of the loading area.
*
*
* @param {string} details The new text for the loading details.
*/
function setLaunchDetails(details){
@ -51,7 +51,7 @@ function setLaunchDetails(details){
/**
* Set the value of the loading progress bar and display that value.
*
*
* @param {number} value The progress value.
* @param {number} max The total size.
* @param {number|string} percent Optional. The percentage to display on the progress label.
@ -64,7 +64,7 @@ function setLaunchPercentage(value, max, percent = ((value/max)*100)){
/**
* Set the value of the OS progress bar and display that on the UI.
*
*
* @param {number} value The progress value.
* @param {number} max The total download size.
* @param {number|string} percent Optional. The percentage to display on the progress label.
@ -76,7 +76,7 @@ function setDownloadPercentage(value, max, percent = ((value/max)*100)){
/**
* Enable or disable the launch button.
*
*
* @param {boolean} val True to enable, false to disable.
*/
function setLaunchEnabled(val){
@ -210,7 +210,7 @@ const refreshMojangStatuses = async function(){
loggerLanding.warn('Unable to refresh Mojang service status.')
loggerLanding.debug(err)
}
document.getElementById('mojangStatusEssentialContainer').innerHTML = tooltipEssentialHTML
document.getElementById('mojangStatusNonEssentialContainer').innerHTML = tooltipNonEssentialHTML
document.getElementById('mojang_status_icon').style.color = Mojang.statusToHex(status)
@ -245,7 +245,7 @@ const refreshServerStatus = async function(fade = false){
document.getElementById('landingPlayerLabel').innerHTML = pLabel
document.getElementById('player_count').innerHTML = pVal
}
}
refreshMojangStatuses()
@ -257,7 +257,7 @@ let serverStatusListener = setInterval(() => refreshServerStatus(true), 300000)
/**
* Shows an error overlay, toggles off the launch area.
*
*
* @param {string} title The overlay title.
* @param {string} desc The overlay description.
*/
@ -281,9 +281,9 @@ let extractListener
/**
* Asynchronously scan the system for valid Java installations.
*
*
* @param {string} mcVersion The Minecraft version we are scanning for.
* @param {boolean} launchAfter Whether we should begin to launch after scanning.
* @param {boolean} launchAfter Whether we should begin to launch after scanning.
*/
function asyncSystemScan(mcVersion, launchAfter = true){
@ -314,7 +314,7 @@ function asyncSystemScan(mcVersion, launchAfter = true){
sysAEx.stdio[2].on('data', (data) => {
loggerSysAEx.log(data)
})
sysAEx.on('message', (m) => {
if(m.context === 'validateJava'){
@ -323,7 +323,7 @@ function asyncSystemScan(mcVersion, launchAfter = true){
// Show this information to the user.
setOverlayContent(
'No Compatible<br>Java Installation Found',
'In order to join WesterosCraft, you need a 64-bit installation of Java 8. Would you like us to install a copy?',
'In order to play, you need a 64-bit installation of Java 8. Would you like us to install a copy?',
'Install Java',
'Install Manually'
)
@ -338,7 +338,7 @@ function asyncSystemScan(mcVersion, launchAfter = true){
//$('#overlayDismiss').toggle(false)
setOverlayContent(
'Java is Required<br>to Launch',
'A valid x64 installation of Java 8 is required to launch.<br><br>Please refer to our <a href="https://github.com/dscalzi/HeliosLauncher/wiki/Java-Management#manually-installing-a-valid-version-of-java">Java Management Guide</a> for instructions on how to manually install Java.',
'A valid x64 installation of Java 8 is required to launch.',
'I Understand',
'Go Back'
)
@ -384,7 +384,7 @@ function asyncSystemScan(mcVersion, launchAfter = true){
// User will have to follow the guide to install Java.
setOverlayContent(
'Unexpected Issue:<br>Java Download Failed',
'Unfortunately we\'ve encountered an issue while attempting to install Java. You will need to manually install a copy. Please check out our <a href="https://github.com/dscalzi/HeliosLauncher/wiki">Troubleshooting Guide</a> for more details and instructions.',
'Unfortunately we\'ve encountered an issue while attempting to install Java. You will need to manually install a copy.',
'I Understand'
)
setOverlayHandler(() => {
@ -606,7 +606,7 @@ function dlAsync(login = true){
switch(m.data){
case 'download':
loggerLaunchSuite.error('Error while downloading:', m.error)
if(m.error.code === 'ENOENT'){
showLaunchFailure(
'Download Error',
@ -683,7 +683,7 @@ function dlAsync(login = true){
if(SERVER_JOINED_REGEX.test(data)){
DiscordWrapper.updateDetails('Exploring the Realm!')
} else if(GAME_JOINED_REGEX.test(data)){
DiscordWrapper.updateDetails('Sailing to Westeros!')
DiscordWrapper.updateDetails('eeeeeeee')
}
}
@ -691,7 +691,7 @@ function dlAsync(login = true){
data = data.trim()
if(data.indexOf('Could not find or load main class net.minecraft.launchwrapper.Launch') > -1){
loggerLaunchSuite.error('Game launch failed, LaunchWrapper was not downloaded properly.')
showLaunchFailure('Error During Launch', 'The main file, LaunchWrapper, failed to download properly. As a result, the game cannot launch.<br><br>To fix this issue, temporarily turn off your antivirus software and launch the game again.<br><br>If you have time, please <a href="https://github.com/dscalzi/HeliosLauncher/issues">submit an issue</a> and let us know what antivirus software you use. We\'ll contact them and try to straighten things out.')
showLaunchFailure('Error During Launch', 'The main file, LaunchWrapper, failed to download properly. As a result, the game cannot launch.')
}
}
@ -782,8 +782,8 @@ let newsGlideCount = 0
/**
* Show the news UI via a slide animation.
*
* @param {boolean} up True to slide up, otherwise false.
*
* @param {boolean} up True to slide up, otherwise false.
*/
function slide_(up){
const lCUpper = document.querySelector('#landingContainer > #upper')
@ -857,7 +857,7 @@ let newsLoadingListener = null
/**
* Set the news loading animation.
*
*
* @param {boolean} val True to set loading animation, otherwise false.
*/
function setNewsLoading(val){
@ -899,7 +899,7 @@ newsArticleContentScrollable.onscroll = (e) => {
/**
* Reload the news without restarting.
*
*
* @returns {Promise.<void>} A promise which resolves when the news
* content has finished loading and transitioning.
*/
@ -927,7 +927,7 @@ function showNewsAlert(){
/**
* Initialize News UI. This will load the news and prepare
* the UI accordingly.
*
*
* @returns {Promise.<void>} A promise which resolves when the news
* content has finished loading and transitioning.
*/
@ -1013,7 +1013,7 @@ function initNews(){
const switchHandler = (forward) => {
let cArt = parseInt(newsContent.getAttribute('article'))
let nxtArt = forward ? (cArt >= newsArr.length-1 ? 0 : cArt + 1) : (cArt <= 0 ? newsArr.length-1 : cArt - 1)
displayArticle(newsArr[nxtArt], nxtArt+1)
}
@ -1029,7 +1029,7 @@ function initNews(){
}
})
})
}
@ -1059,7 +1059,7 @@ document.addEventListener('keydown', (e) => {
/**
* Display a news article on the UI.
*
*
* @param {Object} articleObject The article meta object.
* @param {number} index The article index.
*/

6
app/landing.ejs

@ -30,7 +30,7 @@
<div class="mediaDivider"></div>
<div id="externalMedia">
<div class="mediaContainer">
<a href="https://github.com/dscalzi/HeliosLauncher" class="mediaURL" id="linkURL">
<a href="https://git.jonttu.fi/Jonttucraft/JonttucraftLauncher" class="mediaURL" id="linkURL">
<svg id="linkSVG" class="mediaSVG" viewBox="35.34 34.3575 70.68 68.71500">
<g>
<path d="M75.37,65.51a3.85,3.85,0,0,0-1.73.42,8.22,8.22,0,0,1,.94,3.76A8.36,8.36,0,0,1,66.23,78H46.37a8.35,8.35,0,1,1,0-16.7h9.18a21.51,21.51,0,0,1,6.65-8.72H46.37a17.07,17.07,0,1,0,0,34.15H66.23A17,17,0,0,0,82.77,65.51Z"/>
@ -41,7 +41,7 @@
</div>
<div class="mediaContainer">
<a href="#" class="mediaURL" id="twitterURL" disabled>
<svg id="twitterSVG" class="mediaSVG" viewBox="0 0 5000 4060" preserveAspectRatio="xMidYMid meet">
<svg id="twitterSVG" class="mediaSVG" viewBox="0 0 5000 4060" preserveAspectRatio="xMidYMid meet">
<g>
<path d="M1210 4048 c-350 -30 -780 -175 -1124 -378 -56 -33 -86 -57 -86 -68 0 -16 7 -17 83 -9 114 12 349 1 493 -22 295 -49 620 -180 843 -341 l54 -38 -49 -7 c-367 -49 -660 -256 -821 -582 -30 -61 -53 -120 -51 -130 3 -16 12 -17 73 -13 97 7 199 5 270 -4 l60 -9 -65 -22 c-341 -117 -609 -419 -681 -769 -18 -88 -26 -226 -13 -239 4 -3 32 7 63 22 68 35 198 77 266 86 28 4 58 9 68 12 10 2 -22 -34 -72 -82 -240 -232 -353 -532 -321 -852 15 -149 79 -347 133 -418 16 -20 17 -19 49 20 377 455 913 795 1491 945 160 41 346 74 485 86 l82 7 -7 -59 c-5 -33 -7 -117 -6 -189 2 -163 31 -286 103 -430 141 -285 422 -504 708 -550 112 -19 333 -19 442 0 180 30 335 108 477 239 l58 54 95 -24 c143 -36 286 -89 427 -160 70 -35 131 -60 135 -56 19 19 -74 209 -151 312 -50 66 -161 178 -216 217 l-30 22 73 -14 c111 -21 257 -63 353 -101 99 -39 99 -39 99 -19 0 57 -237 326 -412 468 l-88 71 6 51 c4 28 1 130 -5 226 -30 440 -131 806 -333 1202 -380 745 -1036 1277 -1823 1477 -243 62 -430 81 -786 78 -134 0 -291 -5 -349 -10z"/>
</g>
@ -217,4 +217,4 @@
</div>
</div>
<script src="./assets/js/scripts/landing.js"></script>
</div>
</div>

8
app/welcome.ejs

@ -5,10 +5,10 @@
</div>-->
<div id="welcomeContent">
<img id="welcomeImageSeal" src="assets/images/SealCircle.png"/>
<span id="welcomeHeader">WELCOME TO WESTEROSCRAFT</span>
<span id="welcomeDescription">Our mission is to recreate the universe imagined by author George RR Martin in his fantasy series, A Song of Ice and Fire. Through the collaborative effort of thousands of community members, we have sought to create Westeros as accurately and precisely as possible within Minecraft. The world we are creating is yours to explore. Journey from Dorne to Castle Black, and if you aren’t afraid, beyond the Wall itself, but best not delay. As the words of House Stark ominously warn: Winter is Coming.</span>
<span id="welcomeHeader">WELCOME TO JONTTUCRAFT</span>
<span id="welcomeDescription">This is custom minecraft launcher for Jonttucraft minecraft server.</span>
<br>
<span id="welcomeDescCTA">You are just a few clicks away from Westeros.</span>
<span id="welcomeDescCTA"></span>
<button id="welcomeButton">
<div id="welcomeButtonContent">
CONTINUE
@ -22,4 +22,4 @@
</button>
</div>
<script src="./assets/js/scripts/welcome.js"></script>
</div>
</div>

3
dev-app-update.yml

@ -1,3 +0,0 @@
owner: dscalzi
repo: HeliosLauncher
provider: github

14
electron-builder.yml

@ -1,5 +1,5 @@
appId: 'helioslauncher'
productName: 'Helios Launcher'
appId: 'jonttucraftlauncher'
productName: 'Jonttucraft Launcher'
artifactName: '${productName}-setup-${version}.${ext}'
copyright: 'Copyright © 2018-2021 Daniel Scalzi'
@ -8,14 +8,14 @@ asar: true
compression: 'maximum'
files:
- '!{dist,.gitignore,.vscode,docs,dev-app-update.yml,.travis.yml,.nvmrc,.eslintrc.json,build.js}'
- '!{dist,.gitignore,.vscode,dev-app-update.yml,.travis.yml,.nvmrc,.eslintrc.json,build.js}'
extraResources:
- 'libraries'
# Windows Configuration
win:
target:
win:
target:
- target: 'nsis'
arch: 'x64'
@ -37,7 +37,7 @@ mac:
category: 'public.app-category.games'
# Linux Configuration
linux:
linux:
target: 'AppImage'
maintainer: 'Daniel Scalzi'
vendor: 'Daniel Scalzi'
@ -48,4 +48,4 @@ linux:
directories:
buildResources: 'build'
output: 'dist'
output: 'dist'

4
package-lock.json

@ -1,6 +1,6 @@
{
"name": "helioslauncher",
"version": "1.8.0",
"name": "jonttucraftlauncher",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

15
package.json

@ -1,14 +1,11 @@
{
"name": "helioslauncher",
"version": "1.8.0",
"productName": "Helios Launcher",
"name": "jonttucraftlauncher",
"version": "1.0.0",
"productName": "Jonttucraft Launcher",
"description": "Modded Minecraft Launcher",
"author": "Daniel Scalzi (https://github.com/dscalzi/)",
"author": "Jonttu (https://jonttu.fi)",
"license": "UNLICENSED",
"homepage": "https://github.com/dscalzi/HeliosLauncher",
"bugs": {
"url": "https://github.com/dscalzi/HeliosLauncher/issues"
},
"homepage": "https://jonttucraft.com",
"private": true,
"main": "index.js",
"scripts": {
@ -46,6 +43,6 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/dscalzi/HeliosLauncher.git"
"url": "https://git.jonttu.fi/Jonttucraft/JonttucraftLauncher.git"
}
}
Loading…
Cancel
Save