Beginning work on launcher.

This commit is contained in:
Daniel Scalzi
2017-05-17 17:44:46 -04:00
parent 771b0984f1
commit cc25f2c2e0
4 changed files with 97 additions and 37 deletions

View File

@@ -13,7 +13,7 @@
/* Logger font, found on https://fonts.google.com/specimen/Inconsolata?selection.family=Inconsolata */
@font-face {
font-family: inconsolata;
src: url('../fonts/Inconsolata-Bold.ttf');
src: url('../fonts/Inconsolata-Regular.ttf');
}
/*******************************************************************************
@@ -28,11 +28,21 @@ body, html, div {
padding: 0px;
}
html, body {
height: 100%;
}
html {
background: url('../images/BrownWithWignette.jpg') no-repeat center center fixed;
background-size: cover;
}
#main_content {
height: auto;
height: calc(100% - 90px);
display: flex;
}
button {
background-color: #a02d2a;
color: #ffffff;
@@ -47,6 +57,11 @@ button:hover {
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}
::selection {
background-color: #a02d2a;
color: #ffffff;
}
/*******************************************************************************
* *
* Header *
@@ -224,7 +239,38 @@ button:hover {
#content_container {
border: 3px solid #a02d2a;
height: 98%;
height: calc(98% - 41.33px);
width: 98%;
min-height: 325px;
display: flex;
}
#launcher-log {
font-family: 'inconsolata';
font-size: 12px;
color: #ffffff;
background-color: #1a1b1c;
border: none;
outline: none;
overflow-y: scroll;
display: block;
align-items: stretch;
width: 100%;
resize: none;
padding: 5px 10px;
text-shadow: 0.01px 0.01px 0.01px #ffffff;
line-height: 1.2em;
}
#launcher-log::selection {
background: rgba(160, 45, 42, .9);
color: #ffffff;
}
#launcher-log::-webkit-scrollbar {
background-color: #a02d2a;
}
#launcher-log::-webkit-scrollbar-thumb:window-inactive,
#launcher-log::-webkit-scrollbar-thumb {
background: black
}

View File

@@ -3,10 +3,10 @@ const uuidV4 = require('uuid/v4')
const path = require('path')
const child_process = require('child_process')
const ag = require('./assetguard.js')
const AdmZip = require('adm-zip')
const fs = require('fs')
const mkpath = require('mkdirp');
/* TODO - convert native extraction to use adm-zip. Currently not functional due to removal of unzip module (it was bad) */
launchMinecraft = function(versionData, basePath){
const authPromise = mojang.auth('EMAIL', 'PASS', uuidV4(), {
name: 'Minecraft',
@@ -16,6 +16,15 @@ launchMinecraft = function(versionData, basePath){
const args = finalizeArguments(versionData, data, basePath)
//TODO make this dynamic
const child = child_process.spawn('C:\\Program Files\\Java\\jre1.8.0_131\\bin\\javaw.exe', args)
child.stdout.on('data', (data) => {
console.log('minecraft:', data.toString('utf8'))
})
child.stderr.on('data', (data) => {
console.log('minecraft:', data.toString('utf8'))
})
child.on('close', (code, signal) => {
console.log('exited with code', code)
})
})
}
@@ -99,12 +108,11 @@ classpathArg = function(versionData, basePath){
const to = path.join(libPath, artifact['path'])
fs.createReadStream(to).pipe(unzip.Parse()).on('entry', function(entry){
const fileName = entry.path
const type = entry.type
const size = entry.size
let zip = new AdmZip(to)
let zipEntries = zip.getEntries()
console.log(fileName)
for(let i=0; i<zipEntries.length; i++){
const fileName = zipEntries[i].entryName
let shouldExclude = false
@@ -114,14 +122,12 @@ classpathArg = function(versionData, basePath){
}
})
if(shouldExclude){
entry.autodrain()
}
else {
if(!shouldExclude){
mkpath.sync(path.join(nativePath, fileName, '..'))
entry.pipe(fs.createWriteStream(path.join(nativePath, fileName)))
fs.writeFile(path.join(nativePath, fileName), zipEntries[i].getData())
}
})
}
cpArgs.push(to)
}

View File

@@ -12,13 +12,23 @@ $(document).on('ready', function(){
$(this).parent().toggleClass("success")
}
})
process.stdout.on('data', (data) => {
$('#launcher-log').append(data.toString('utf8'))
//console.log('minecraft:', data.toString('utf8'))
})
process.stderr.on('data', (data) => {
$('#launcher-log').append(data.toString('utf8'))
//console.log('minecraft:', data.toString('utf8'))
})
console.log('test')
console.debug('test')
})
/* Open web links in the user's default browser. */
$(document).on('click', 'a[href^="http"]', function(event) {
event.preventDefault();
//testdownloads()
shell.openExternal(this.href)
testdownloads()
//shell.openExternal(this.href)
});
testdownloads = async function(){