pull/110/head
openbuilds-engineer 2019-06-06 21:11:48 +02:00
rodzic 668b9aad60
commit 31c329aeac
3 zmienionych plików z 26 dodań i 3 usunięć

Wyświetl plik

@ -24,7 +24,7 @@
<div class="window" style="height: 100vh;">
<div class="window-caption bg-openbuilds" style="-webkit-app-region: drag;">
<div id="windowtitlebar" class="window-caption bg-openbuilds" style="-webkit-app-region: drag;">
<!-- <span class="icon mif-cog"></span> -->
<span class="icon"><img src="icon-transparent.png"/></span>
<span class="title" id="windowtitle">OpenBuilds CONTROL</span>

Wyświetl plik

@ -262,6 +262,9 @@ function initSocket() {
if (nostatusyet) {
$('#windowtitle').html("OpenBuilds CONTROL v" + status.driver.version)
if (status.driver.operatingsystem == "rpi") {
$('#windowtitlebar').hide();
}
}
nostatusyet = false;

Wyświetl plik

@ -215,6 +215,7 @@ var status = {
driver: {
version: require('./package').version,
ipaddress: ip.address(),
operatingsystem: false
},
machine: {
name: '',
@ -2179,8 +2180,9 @@ if (isElectron()) {
function createApp() {
createTrayIcon();
if (process.platform == 'darwin') {
console.log("Creating MacOS Menu")
createMenu()
console.log("Creating MacOS Menu");
createMenu();
status.driver.operatingsystem = 'macos';
}
if (process.platform == 'win32' && process.argv.length >= 2) {
var openFilePath = process.argv[1];
@ -2437,6 +2439,8 @@ if (isElectron()) {
var isPi = require('detect-rpi');
if (isPi()) {
console.log('Running on Raspberry Pi!');
status.driver.operatingsystem = 'rpi'
startChrome();
} else {
console.log("Running under NodeJS...");
}
@ -2563,4 +2567,20 @@ function isJson(item) {
return false;
}
function startChrome(callback) {
if (status.driver.operatingsystem == 'rpi') {
var terminal = cp.spawn('bash');
var chrome = {};
terminal.on('exit', function(code) {
console.log('child process exited with code ' + code);
console.log('Starting chrome');
chrome = cp.spawn('`which chromium-browser`', [
'--app=http://127.0.0.1:3000'
]);
callback(chrome);
});
}
}
process.on('exit', () => console.log('exit'))