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(){

View File

@ -59,26 +59,24 @@
<label onclick="" class="toggle-btn success"><input type="radio" name="main_group"/>news</label><label onclick="" class="toggle-btn"><input type="radio" name="main_group"/>map</label><label onclick="" class="toggle-btn"><input type="radio" name="main_group"/>mods</label><label onclick="" class="toggle-btn"><input type="radio" name="main_group"/>faq</label><label onclick="" class="toggle-btn"><input type="radio" name="main_group"/>log</label><label onclick="" class="toggle-btn"><input type="radio" name="main_group"/>settings</label>
</div>
<div id="content_container">
<textarea id="launcher-log">[05/17/2017 04:59:13] [INFO] - Loading..
[05/17/2017 04:59:13] [SEVERE] - This is a test exception
java.lang.Exception: This is a test exception
at com.westeroscraft.LauncherExecutor.start(LauncherExecutor.java:40)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Unknown Source)
[05/17/2017 04:59:28] [INFO] - Hastebin result:
Response code: 200.
Hastebin URL: https://hastebin.com/kefezabiwa</textarea>
</div>
</div>
</div>
<!-- <div class="container">
<div class="row">
<div class="col-md-2 col-sm-2">
<div class="row">
<div class="col-md-3 col-sm-3">
<img class="player_icon" src="https://minotar.net/helm/pufferboss.png">
</div>
<div class="col-md-9 col-sm-9">
<p class="input_text">Email</p>
<input class="input" id="EMAIL">
<p class="input_text">Password</p>
<input type="password" id="PASSWORD" class="input" />
</div>
</div>
</div>
</div>
</div>
</body> -->
</body>
</html>