Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
v0.1.4 alpha
Browse files Browse the repository at this point in the history
Version 0.1.4 alpha for testing purposes, use if you want.
  • Loading branch information
Jiiks committed Nov 2, 2015
1 parent 713c112 commit cfdb2f5
Showing 1 changed file with 35 additions and 15 deletions.
50 changes: 35 additions & 15 deletions lib/BetterDiscord.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,6 +14,7 @@ var _ipc = require('ipc');

//Beta flag
var _beta = false;
var _alerts = true;

var _version;
var _mainWindow;
Expand All @@ -28,7 +29,7 @@ var _dataPath;


var _os = process.platform;
var _userfile;
var _userFile;


function BetterDiscord(mainWindow) {
Expand All @@ -43,6 +44,8 @@ BetterDiscord.prototype.getUtils = function() {

BetterDiscord.prototype.init = function() {

var self = this;

//OS specific _dataPath
if (_os == "win32") {
_dataPath = "../BetterDiscordData";
Expand All @@ -51,9 +54,6 @@ BetterDiscord.prototype.init = function() {
}
_userFile = _dataPath + "/user.json";


var self = this;

//Check emotedata cache
this.getUtils().log("Checking cache");

Expand Down Expand Up @@ -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;
Expand Down

1 comment on commit cfdb2f5

@Jiiks
Copy link
Owner Author

@Jiiks Jiiks commented on cfdb2f5 Nov 2, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually 0.1.6a but oh well.

Please sign in to comment.