Skip to content

Commit

Permalink
Update checking now works, added dev keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan Kragujević committed Oct 27, 2015
1 parent 8d03ae5 commit ec88e99
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 83 deletions.
9 changes: 9 additions & 0 deletions developer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$(document).on('keydown', function(e) {
var gui = require('nw.gui');
var win = gui.Window.get();
if(e.keyCode == 123) {
win.showDevTools();
} else if(e.keyCode == 116) {
win.reloadDev();
}
})
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="tray.js"></script>
<script src="developer.js"></script>
<script src="index.js"></script>
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"window": {
"title": "ShowStream",
"icon": "appicon.png",
"toolbar": true,
"toolbar": false,
"frame": true,
"width": 420,
"height": 260,
Expand All @@ -28,5 +28,6 @@
"peerflix": "^0.32.1",
"rimraf": "^2.4.3",
"sync-request": "^2.1.0"
}
},
"node-remote": "*"
}
2 changes: 1 addition & 1 deletion tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ var checkForUpdates = new gui.MenuItem({
document.body.appendChild(iframe);
}
});
menu.append(stopMenuItem);
menu.append(checkForUpdates);
menu.append(stopMenuItem);
tray.menu = menu;
tray.tooltip = 'ShowStream';
win.hide();
21 changes: 21 additions & 0 deletions update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var openURL = function(url) {
return require('nw.gui').Shell.openExternal(url);
};
var hideWindow = function() {
require('nw.gui').Window.get().hide();
};
var fs = require('fs');
var path = require('path');
var config = JSON.parse(fs.readFileSync(path.resolve('config.json')));
var version = config.version;
$.get('http://showstream.xyz/update', function(data) {
$('.spinner').fadeOut(300);
if(data.version == version) {
$('.no-updates').fadeIn(300);
} else {
$('.update-available').fadeIn(300);
}
}).fail(function() {
$('.spinner').fadeOut(300);
$('.server-error').fadeIn(300);
});
70 changes: 70 additions & 0 deletions updates.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
.container {
background: #2195F1;
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
}

.spinner {
position: absolute;
top: 50%;
left: 50%;
margin-top: -30px;
margin-left: -30px;
}

.no-updates, .server-error {
display: none;
position: absolute;
top: 50%;
left: 0px;
width: 100%;
margin-top: -25px;
-webkit-user-select: none;
cursor: default;
}

.no-updates span, .server-error span {
display: block;
text-align: center;
color: #FFF;
font-family: 'Asap';
font-weight: 700;
font-size: 25px;
}

.update-available {
display: none;
position: absolute;
top: 50%;
left: 0px;
width: 100%;
margin-top: -45px;
-webkit-user-select: none;
cursor: default;
}

.update-available span {
display: block;
text-align: center;
color: #FFF;
font-family: 'Asap';
font-weight: 700;
font-size: 25px;
}

.update-available i {
display: block;
text-align: center;
color: #FFF;
font-family: 'Asap';
font-size: 15px;
margin-top: 10px;
}

.update-available i a {
color: #fff;
text-decoration: none;
}
86 changes: 6 additions & 80 deletions updates.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,88 +3,11 @@
<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Asap:400,400italic,700,700italic&subset=latin" />
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" href="updates.css" />
<title>ShowStream</title>
<script src="developer.js"></script>
<script src="update.js"></script>
</head>
<style>
.container {
background: #2195F1;
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
}

.spinner {
position: absolute;
top: 50%;
left: 50%;
margin-top: -30px;
margin-left: -30px;
}

.no-updates {
display: none;
position: absolute;
top: 50%;
left: 0px;
width: 100%;
margin-top: -25px;
-webkit-user-select: none;
cursor: default;
}

.no-updates span {
display: block;
text-align: center;
color: #FFF;
font-family: 'Asap';
font-weight: 700;
font-size: 25px;
}

.update-available {
display: none;
position: absolute;
top: 50%;
left: 0px;
width: 100%;
margin-top: -45px;
-webkit-user-select: none;
cursor: default;
}

.update-available span {
display: block;
text-align: center;
color: #FFF;
font-family: 'Asap';
font-weight: 700;
font-size: 25px;
}

.update-available i {
display: block;
text-align: center;
color: #FFF;
font-family: 'Asap';
font-size: 15px;
margin-top: 10px;
}

.update-available i a {
color: #fff;
text-decoration: none;
}
</style>
<script>
var openURL = function(url) {
return require('nw.gui').Shell.openExternal(url);
};
var hideWindow = function() {
require('nw.gui').Window.get().hide();
};
</script>
<body>
<div class="container">
<div class="spinner">
Expand All @@ -93,6 +16,9 @@
<div class="no-updates">
<span>You're up to date!</span>
</div>
<div class="server-error">
<span>Couldn't check for updates</span>
</div>
<div class="update-available">
<span>Update Available</span>
<i>Click <a href="#" onclick="openURL('http://showstream.xyz/download');hideWindow()">here</a> to download the latest version!</i>
Expand Down

0 comments on commit ec88e99

Please sign in to comment.