From cc25f2c2e003c954094e5282510975033438f164 Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Wed, 17 May 2017 17:44:46 -0400 Subject: [PATCH] Beginning work on launcher. --- app/assets/css/styles.css | 52 ++++++++++++++++++++++++++++++++-- app/assets/js/launchprocess.js | 30 ++++++++++++-------- app/assets/js/script.js | 14 +++++++-- app/index.html | 38 ++++++++++++------------- 4 files changed, 97 insertions(+), 37 deletions(-) diff --git a/app/assets/css/styles.css b/app/assets/css/styles.css index a0869f6a..8bf06065 100644 --- a/app/assets/css/styles.css +++ b/app/assets/css/styles.css @@ -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 } \ No newline at end of file diff --git a/app/assets/js/launchprocess.js b/app/assets/js/launchprocess.js index b55d6054..a201d312 100644 --- a/app/assets/js/launchprocess.js +++ b/app/assets/js/launchprocess.js @@ -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 { + $('#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(){ diff --git a/app/index.html b/app/index.html index d4023d20..6de835a0 100644 --- a/app/index.html +++ b/app/index.html @@ -59,26 +59,24 @@
- +
- - + + \ No newline at end of file