Setup the server code in the configuration
This commit is contained in:
parent
d51b79a399
commit
411c9fce34
@ -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,13 +32,31 @@ exports.getDataDirectory = function(def = false){
|
||||
|
||||
/**
|
||||
* Set the new data directory.
|
||||
*
|
||||
*
|
||||
* @param {string} dataDirectory The new data directory.
|
||||
*/
|
||||
exports.setDataDirectory = function(dataDirectory){
|
||||
config.settings.launcher.dataDirectory = dataDirectory
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the launcher's server code if set. This will be used to load hidden servers.
|
||||
*
|
||||
* @returns {string} The server code that has been put into the launcher
|
||||
*/
|
||||
exports.getServerCode = function(def = false){
|
||||
return !def ? config.settings.launcher.serverCode : DEFAULT_CONFIG.settings.launcher.serverCode
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the new server code
|
||||
*
|
||||
* @param {string} serverCode The new server code.
|
||||
*/
|
||||
exports.setServerCode = function(serverCode){
|
||||
config.settings.launcher.serverCode = serverCode
|
||||
}
|
||||
|
||||
const configPath = path.join(exports.getLauncherDirectory(), 'config.json')
|
||||
const configPathLEGACY = path.join(dataPath, 'config.json')
|
||||
const firstLaunch = !fs.existsSync(configPath) && !fs.existsSync(configPathLEGACY)
|
||||
@ -91,7 +109,8 @@ const DEFAULT_CONFIG = {
|
||||
},
|
||||
launcher: {
|
||||
allowPrerelease: false,
|
||||
dataDirectory: dataPath
|
||||
dataDirectory: dataPath,
|
||||
serverCode: null
|
||||
}
|
||||
},
|
||||
newsCache: {
|
||||
|
@ -136,6 +136,8 @@ function initSettingsValues(){
|
||||
v.value = gFn()
|
||||
} else if (cVal === 'DataDirectory'){
|
||||
v.value = gFn()
|
||||
} else if (cVal === 'ServerCode'){
|
||||
v.value = gFn()
|
||||
} else if(cVal === 'JVMOptions'){
|
||||
v.value = gFn().join(' ')
|
||||
} else {
|
||||
|
@ -270,7 +270,7 @@
|
||||
<div class="settingsServerCodeTitle">Server Code</div>
|
||||
<div class="settingsServerCodeContent">
|
||||
<div class="settingsServerCodeActions">
|
||||
<input class="settingsServerCodeVal" id="settingsJavaExecVal" type="text" value="" cValue="ServerCode">
|
||||
<input class="settingsServerCodeVal" type="text" value="" cValue="ServerCode">
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingsServerCodeDesc">Any server code here (if valid) will grant you access to certain modpacks or servers that are set up to use the code.</div>
|
||||
|
Loading…
Reference in New Issue
Block a user