diff --git a/app/assets/js/assetguard.js b/app/assets/js/assetguard.js index 6def451..dde64c3 100644 --- a/app/assets/js/assetguard.js +++ b/app/assets/js/assetguard.js @@ -247,6 +247,20 @@ class AssetGuard extends EventEmitter { return cs.join('/') } + /** + * Resolves an artiface id without the version. For example, + * 'net.minecraftforge:forge:1.11.2-13.20.0.2282' becomes + * 'net.minecraftforge:forge'. + * + * @param {string} artifactid The artifact id string. + * @returns {string} The resolved identifier without the version. + */ + static _resolveWithoutVersion(artifactid){ + let ps = artifactid.split(':') + + return ps[0] + ':' + ps[1] + } + // #endregion // Static Hash Validation Functions diff --git a/app/assets/js/configmanager.js b/app/assets/js/configmanager.js index 138d28d..5a9bf47 100644 --- a/app/assets/js/configmanager.js +++ b/app/assets/js/configmanager.js @@ -69,7 +69,8 @@ const DEFAULT_CONFIG = { clientToken: uuidV4().replace(/-/g, ''), selectedServer: null, // Resolved selectedAccount: null, - authenticationDatabase: {} + authenticationDatabase: {}, + modConfigurations: [] } let config = null; @@ -92,7 +93,6 @@ exports.save = function(){ */ exports.load = function(){ // Determine the effective configuration. - //const EFFECTIVE_CONFIG = config == null ? DEFAULT_CONFIG : config const filePath = path.join(dataPath, 'config.json') if(!fs.existsSync(filePath)){ @@ -353,6 +353,57 @@ exports.setSelectedAccount = function(uuid){ return authAcc } +/** + * Get an array of each mod configuration currently stored. + * + * @returns {Array.} An array of each stored mod configuration. + */ +exports.getModConfigurations = function(){ + return config.modConfigurations +} + +/** + * Set the array of stored mod configurations. + * + * @param {Array.} configurations An array of mod configurations. + */ +exports.setModConfigurations = function(configurations){ + config.modConfigurations = 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. + */ +exports.getModConfiguration = function(serverid){ + const cfgs = config.modConfigurations + for(let i=0; i { if(data != null) { + syncModConfigurations(data) if(document.readyState === 'complete'){ showMainUI() } else {