v0.1.4 alpha

Version 0.1.4 alpha for testing purposes, use if you want.
This commit is contained in:
Jiiks 2015-11-03 01:06:58 +02:00
parent 713c11248d
commit cfdb2f5037
1 changed files with 35 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/* BetterDiscordApp Entry
* Version: 1.3
* Version: 1.4
* Author: Jiiks | http://jiiks.net
* Date: 27/08/2015 - 15:51
* Last Update: 25/10/2015 - 23:48
@ -14,6 +14,7 @@ var _ipc = require('ipc');
//Beta flag
var _beta = false;
var _alerts = true;
var _version;
var _mainWindow;
@ -28,7 +29,7 @@ var _dataPath;
var _os = process.platform;
var _userfile;
var _userFile;
function BetterDiscord(mainWindow) {
@ -43,6 +44,8 @@ BetterDiscord.prototype.getUtils = function() {
BetterDiscord.prototype.init = function() {
var self = this;
//OS specific _dataPath
if (_os == "win32") {
_dataPath = "../BetterDiscordData";
@ -51,9 +54,6 @@ BetterDiscord.prototype.init = function() {
}
_userFile = _dataPath + "/user.json";
var self = this;
//Check emotedata cache
this.getUtils().log("Checking cache");
@ -90,19 +90,39 @@ BetterDiscord.prototype.init = function() {
this.getUtils().log("Cache expired: " + _cacheExpired);
//Get latest commit hash
this.getUtils().getHash(_beta, function(hash) {
_hash = hash;
self.getUtils().log("Latest Hash: " + _hash);
//Get updater
self.getUtils().download("raw.githubusercontent.com", "/Jiiks/BetterDiscordApp/"+hash+"/updater.json", function(updater) {
_updater = JSON.parse(updater);
self.getUtils().log("Latest Version: " + _updater.LatestVersion);
self.getUtils().log("CDN: " + _updater.CDN);
self.start();
});
var branch = _beta ? "beta" : "master";
this.getUtils().download("api.github.com", "/repos/Jiiks/BetterDiscordApp/commits/"+branch+"", function(data) {
try {
_hash = JSON.parse(data).sha;
}catch(err) { self.quit("Failed to load hash : " + err); }
if(typeof(_hash) == "undefined") {
self.quit("Failed to load hash");
} else {
self.getUtils().log("Hash: "+ _hash);
//Get updater
self.getUtils().download("raw.githubusercontent.com", "/Jiiks/BetterDiscordApp/"+_hash+"/updater.json", function(data) {
try {
_updater = JSON.parse(data);
}catch(err) { self.quit("Failed to load updater : " + err); }
if(typeof(_updater) == "undefined") {
self.quit("Failed to load updater");
} else {
self.getUtils().log("Latest Version: " + _updater.LatestVersion);
self.getUtils().log("Using CDN: " + _updater.CDN);
self.getUtils().log("Starting up");
self.start();
}
});
}
});
};
BetterDiscord.prototype.quit = function(reason) {
this.getUtils().log("Quitting: " + reason);
if(_alerts) this.getUtils().alert("Quitting: " + reason);
}
BetterDiscord.prototype.start = function() {
var self = this;