Working on concepts for login UI.

This commit is contained in:
Daniel Scalzi
2017-05-23 01:45:20 -04:00
parent bb566471b8
commit f8a0805c8c
6 changed files with 246 additions and 58 deletions

View File

@@ -186,7 +186,7 @@ const instance = new AssetGuard()
* 'net.minecraftforge:forge:1.11.2-13.20.0.2282', '.jar' becomes
* net\minecraftforge\forge\1.11.2-13.20.0.2282\forge-1.11.2-13.20.0.2282.jar
*
* @param {String} artifact - the artifact id string.
* @param {String} artifactid - the artifact id string.
* @param {String} extension - the extension of the file at the resolved path.
* @returns {String} - the resolved relative path from the artifact id.
*/
@@ -201,6 +201,26 @@ function _resolvePath(artifactid, extension){
return path.join.apply(path, cs)
}
/**
* Resolve an artifact id into a URL. For example,
* 'net.minecraftforge:forge:1.11.2-13.20.0.2282', '.jar' becomes
* net/minecraftforge/forge/1.11.2-13.20.0.2282/forge-1.11.2-13.20.0.2282.jar
*
* @param {String} artifactid - the artifact id string.
* @param {String} extension - the extension of the file at the resolved url.
* @returns {String} - the resolved relative URL from the artifact id.
*/
function _resolveURL(artifactid, extension){
let ps = artifactid.split(':')
let cs = ps[0].split('.')
cs.push(ps[1])
cs.push(ps[2])
cs.push(ps[1].concat('-').concat(ps[2]).concat(extension))
return cs.join('/')
}
/**
* Calculates the hash for a file using the specified algorithm.
*
@@ -724,17 +744,19 @@ function _parseDistroModules(modules, basePath, version){
let obPath = obArtifact.path == null ? _resolvePath(ob.id, obArtifact.extension) : obArtifact.path
switch(obType){
case 'forge-hosted':
case 'forge':
obPath = path.join(basePath, 'libraries', obPath)
break;
break
case 'library':
obPath = path.join(basePath, 'libraries', obPath)
break;
break
case 'forgemod':
obPath = path.join(basePath, 'mods', obPath)
break;
break
case 'litemod':
obPath = path.join(basePath, 'mods', version, obPath)
break;
break
case 'file':
default:
obPath = path.join(basePath, obPath)
}
@@ -788,6 +810,10 @@ function loadForgeData(serverpack, basePath){
})
}
function _parseForgeLibraries(){
}
/**
* This function will initiate the download processed for the specified identifiers. If no argument is
* given, all identifiers will be initiated. Note that in order for files to be processed you need to run

51
app/assets/js/modlist.js Normal file
View File

@@ -0,0 +1,51 @@
const fs = require('fs')
/**
* Class used to configure mod launch args.
*/
export class ModList {
/**
* Construct a ModList.
*
* @param {String} repositoryRoot - the base path of the mod locations.
* @param {Array.<String>} modRef - array containing the mod artifact ids.
* @param {String} parentList - parent ModList file path, null if none.
*/
constructor(repositoryRoot, modRef, parentList){
if(!arguments.length){
this.repositoryRoot = ''
this.modRef = []
}
this.repositoryRoot
this.modRef = modRef
if(parentList != null) this.parentList = parentList
}
/**
* Exports a ModList object to the specified file path.
*
* @param {ModList} modList - the ModList object to export.
* @param {String} filePath - desired filepath.
* @returns {Promise.<String>} - a promise which resolves FML modList argument.
*/
static exportModList(modList, filePath){
return new Promise(function(resolve, reject){
fs.writeFile(filePath, JSON.stringify(modList), (err) => {
if(err){
reject(err.message)
}
resolve('--modListFile ' + filePath)
})
})
}
/**
*
* @param {Object} distro - the distribution index.
*/
static generateModList(distro){
}
}

View File

@@ -14,7 +14,7 @@ function timestamp(){
const min = date.getMinutes() < 10 ? '0'.concat(date.getMinutes()) : date.getMinutes();
const sec = date.getSeconds() < 10 ? '0'.concat(date.getSeconds()) : date.getSeconds();
return os.EOL + '[' + month + '/' + day + '/' + date.getFullYear() + ' ' + hour + ':' + min + ':' + sec + ']'
return '[' + month + '/' + day + '/' + date.getFullYear() + ' ' + hour + ':' + min + ':' + sec + ']'
}
$(document).on('ready', function(){
@@ -26,14 +26,17 @@ $(document).on('ready', function(){
$(this).parent().toggleClass("success")
}
})
/*console.log = function(){
$('#launcher-log').append(timestamp() + ' [Log] - ' + Array.prototype.slice.call(arguments).join(' '))
console.log = function(){
$('#launcher-log').append(timestamp() + ' [Log] - ' + Array.prototype.slice.call(arguments).join(' ') + os.EOL)
}
console.error = function(){
$('#launcher-log').append(timestamp() + ' [Error] - ' + Array.prototype.slice.call(arguments).join(' '))
$('#launcher-log').append('<span class="log_debug">' + timestamp() + ' [Debug] - ' + Array.prototype.slice.call(arguments).join(' ') + "</span>" + os.EOL)
}
console.debug = function(){
$('#launcher-log').append('<span class="log_debug">' + timestamp() + ' [Error] - ' + Array.prototype.slice.call(arguments).join(' ') + "</span>" + os.EOL)
}
console.log('test')
//console.debug('test')*/
console.debug('test')
})
/* Open web links in the user's default browser. */