Merge remote-tracking branch 'refs/remotes/origin/master' into beta

This commit is contained in:
Jiiks 2015-10-27 23:57:13 +02:00
commit 71b94ee664
2 changed files with 17 additions and 4 deletions

View File

@ -9,6 +9,9 @@ var _fs = require("fs");
var _config = require("./config.json");
var _utils = require("./utils");
//Use beta javascript
var _beta = false;
var _ipc = require('ipc');
var _version;
@ -21,7 +24,16 @@ var _userDefault = {"cache": null};
var _userConfig = {"cache": null};
var _cacheExpired = false;
var _cacheDays = 0;
var _dataPath = "../BetterDiscordData";
var _dataPath;
// OS specific _dataPath
var _os = process.platform;
if (_os == "win32") {
_dataPath = "../BetterDiscordData";
} else if (_os == "darwin") {
_dataPath = "~/Library/Application Support/discord/BetterDiscordData";
}
var _userFile = _dataPath + "/user.json";
function BetterDiscord(mainWindow) {
@ -74,7 +86,7 @@ BetterDiscord.prototype.init = function() {
this.getUtils().log("Cache expired: " + _cacheExpired);
//Get latest commit hash
this.getUtils().getHash(function(hash) {
this.getUtils().getHash(_beta, function(hash) {
_hash = hash;
self.getUtils().log("Latest Hash: " + _hash);
//Get updater

View File

@ -56,8 +56,9 @@ Utils.prototype.downloadHttp = function(url, callback) {
});
}
Utils.prototype.getHash = function(callback) {
this.download("api.github.com", "/repos/Jiiks/BetterDiscordApp/commits/master", function(data) {
Utils.prototype.getHash = function(beta, callback) {
var branch = beta ? "beta" : "master";
this.download("api.github.com", "/repos/Jiiks/BetterDiscordApp/commits/"+branch+"", function(data) {
callback(JSON.parse(data).sha);
});
}