commit
92e992abd2
|
@ -47,6 +47,9 @@ function install() {
|
|||
_functionCallSplice = 446;
|
||||
_functionSplice = 547;
|
||||
_discordPath = "/Applications/Discord.app/Contents/Resources" // Defaults to Applications directory
|
||||
} else if (_os == "linux") {
|
||||
_discordPath = "/opt/DiscordCanary/resources";
|
||||
_index = "/app/index.js";
|
||||
}
|
||||
}
|
||||
console.log("Looking for discord resources at: " + _discordPath);
|
||||
|
@ -80,8 +83,12 @@ function install() {
|
|||
asar.extractAll(_discordPath + _appArchive, _discordPath + _appFolder);
|
||||
|
||||
console.log("Copying BetterDiscord");
|
||||
|
||||
if(_os == "linux") {
|
||||
fs.mkdirSync(_discordPath + _appFolder + "/node_modules/BetterDiscord");
|
||||
}
|
||||
else {
|
||||
fs.mkdirSync(_discordPath + "/node_modules/BetterDiscord");
|
||||
}
|
||||
|
||||
wrench.copyDirSyncRecursive(__dirname + "/BetterDiscord/", _discordPath + _appFolder + "/node_modules/BetterDiscord/", {forceDelete: true});
|
||||
|
||||
|
@ -99,8 +106,18 @@ function install() {
|
|||
console.log("Injecting index.js");
|
||||
|
||||
var data = fs.readFileSync(_discordPath + _index).toString().split("\n");
|
||||
|
||||
if(_os == "linux") {
|
||||
data = data.join("\n");
|
||||
data = data.replace('var _GPUSettings2 = _interopRequireDefault(_GPUSettings);','var _GPUSettings2 = _interopRequireDefault(_GPUSettings);\n\nvar _betterDiscord = require(\'BetterDiscord\');\n');
|
||||
|
||||
data = data.replace('mainWindow.setMenuBarVisibility(false);','mainWindow.setMenuBarVisibility(false);\n' + splice + '\n');
|
||||
data = data.split("\n");
|
||||
|
||||
} else {
|
||||
data.splice(_importSplice, 0, 'var _betterDiscord = require(\'betterdiscord\');\n');
|
||||
data.splice(_functionCallSplice, 0, splice);
|
||||
}
|
||||
|
||||
fs.writeFile(_discordPath + _index, data.join("\n"), function(err) {
|
||||
if(err) return console.log(err);
|
||||
|
|
|
@ -9,9 +9,10 @@ emoteBlacklist.prototype.onSwitch = function () {
|
|||
emoteBlacklist.prototype.start = function () {
|
||||
window.ebEnabled = true;
|
||||
var self = this;
|
||||
var em = localStorage["emoteBlacklist"];
|
||||
if(em == undefined) return;
|
||||
JSON.parse(em).forEach(function(emote) {
|
||||
var em = bdPluginStorage.get("emoteBlacklist", "blacklist");
|
||||
|
||||
if(em === null) return;
|
||||
em.forEach(function(emote) {
|
||||
self.remove(emote);
|
||||
self.add(emote);
|
||||
});
|
||||
|
@ -35,21 +36,20 @@ emoteBlacklist.prototype.stop = function () {
|
|||
};
|
||||
emoteBlacklist.prototype.clear = function() {
|
||||
var self = this;
|
||||
var em = localStorage["emoteBlacklist"];
|
||||
if(em == undefined) return;
|
||||
var em = JSON.parse(em);
|
||||
var em = bdPluginStorage.get("emoteBlacklist", "blacklist");
|
||||
if(em === null) return;
|
||||
em.forEach(function(emote) {
|
||||
self.remove(emote);
|
||||
});
|
||||
};
|
||||
emoteBlacklist.prototype.getSettingsPanel = function () {
|
||||
var em = localStorage["emoteBlacklist"];
|
||||
var em = bdPluginStorage.get("emoteBlacklist", "blacklist");
|
||||
|
||||
var html = '';
|
||||
html += '<h2>Emote Blacklist</2>';
|
||||
html += '<textarea id="emoteBlistTa" style="width:100%; min-height:200px;">';
|
||||
if(em != undefined) {
|
||||
JSON.parse(em).forEach(function(item) {
|
||||
if(em !== null) {
|
||||
em.forEach(function(item) {
|
||||
html += item + "\n";
|
||||
});
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ emoteBlacklist.prototype.save = function() {
|
|||
$("#emoteBlistTa").val().split("\n").forEach(function(item) {
|
||||
blist.push(item);
|
||||
});
|
||||
localStorage["emoteBlacklist"] = JSON.stringify(blist);
|
||||
bdPluginStorage.set("emoteBlacklist", "blacklist", blist);
|
||||
if(window.ebEnabled) {
|
||||
this.start();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
Note that this whole branch is deprecated. all further development is going on here: https://github.com/Jiiks/BetterDiscordApp/tree/v2
|
||||
|
||||
# BetterDiscordApp
|
||||
|
||||
# If you have issues then join the BD Discord server: [Here](https://discord.gg/0Tmfo5ZbORCRqbAd)
|
||||
|
@ -6,7 +8,7 @@
|
|||
|
||||
## All plugins must be named `*.plugin.js` and all themes must be named `*.theme.css`
|
||||
|
||||
Better Discord App enhances Discord desktop app with new features.
|
||||
Better Discord App enhances the Discord desktop app with new features.
|
||||
|
||||
![ss](http://puu.sh/oIO58.png)
|
||||
|
||||
|
|
|
@ -699,6 +699,7 @@
|
|||
padding: 0px !important;
|
||||
padding-left: 3px !important;
|
||||
color: #EBEBEB;
|
||||
z-index: 90000;
|
||||
}
|
||||
|
||||
.bd-minimal-chan #bd-show-channels {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"blacklist": [
|
||||
"Minecraft",
|
||||
"Cannon",
|
||||
"Barracks",
|
||||
"Roshan",
|
||||
|
@ -184,6 +185,34 @@
|
|||
"Affe",
|
||||
"Baby",
|
||||
"YOUTUBE",
|
||||
"Bella"
|
||||
"Bella",
|
||||
"Spooky",
|
||||
"Spaghetti",
|
||||
"Rucksack",
|
||||
"Rein",
|
||||
"Dirk",
|
||||
"Moin",
|
||||
"Heya!",
|
||||
"Crossover",
|
||||
"Kitsune",
|
||||
"Gengar",
|
||||
"Nebby",
|
||||
"Uhhh",
|
||||
"Runescape",
|
||||
"Shitpost",
|
||||
"Dunno",
|
||||
"Challenge",
|
||||
"Shulk",
|
||||
"Peach",
|
||||
"Leffen",
|
||||
"STEAK",
|
||||
"Lars",
|
||||
"Kirby",
|
||||
"Samus",
|
||||
"Toad",
|
||||
"Poopy",
|
||||
"Alexis",
|
||||
"Dante",
|
||||
"Lotus"
|
||||
]
|
||||
}
|
||||
|
|
159
js/main.js
159
js/main.js
|
@ -6,9 +6,80 @@
|
|||
* Last Update: 01/05/2016
|
||||
* https://github.com/Jiiks/BetterDiscordApp
|
||||
*/
|
||||
|
||||
/*Localstorage fix*/
|
||||
(function() {
|
||||
|
||||
let __fs = window.require("fs");
|
||||
let __process = window.require("process");
|
||||
let __platform = __process.platform;
|
||||
let __dataPath = (__platform === 'win32' ? __process.env.APPDATA : __platform === 'darwin' ? __process.env.HOME + '/Library/Preferences' : process.env.HOME + '/.config') + '/BetterDiscord/';
|
||||
|
||||
|
||||
let __data = {};
|
||||
if(__fs.existsSync(`${__dataPath}localStorage.json`)) {
|
||||
try {
|
||||
__data = JSON.parse(__fs.readFileSync(`${__dataPath}localStorage.json`))
|
||||
}catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
} else if(__fs.existsSync("localStorage.json")) {
|
||||
try {
|
||||
__data = JSON.parse(__fs.readFileSync("localStorage.json"));
|
||||
}catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
var __ls = __data;
|
||||
__ls.setItem = function(i, v) {
|
||||
__ls[i] = v;
|
||||
this.save();
|
||||
};
|
||||
__ls.getItem = function(i) {
|
||||
return __ls[i] || null;
|
||||
};
|
||||
__ls.save = function() {
|
||||
__fs.writeFileSync(`${__dataPath}/localStorage.json`, JSON.stringify(this), null, 4);
|
||||
};
|
||||
|
||||
var __proxy = new Proxy(__ls, {
|
||||
set: function(target, name, val, receiver) {
|
||||
__ls[name] = val;
|
||||
__ls.save();
|
||||
},
|
||||
get: function(target, name, receiver) {
|
||||
return __ls[name] || null;
|
||||
}
|
||||
});
|
||||
|
||||
window.localStorage = __proxy;
|
||||
|
||||
})();
|
||||
|
||||
window.bdStorage = {};
|
||||
window.bdStorage.get = function(i) {
|
||||
return betterDiscordIPC.sendSync('synchronous-message', { 'arg': 'storage', 'cmd': 'get', 'var': i });
|
||||
};
|
||||
window.bdStorage.set = function(i, v) {
|
||||
betterDiscordIPC.sendSync('synchronous-message', { 'arg': 'storage', 'cmd': 'set', 'var': i, 'data': v });
|
||||
};
|
||||
window.bdPluginStorage = {};
|
||||
window.bdPluginStorage.get = function(pn, i) {
|
||||
return betterDiscordIPC.sendSync('synchronous-message', { 'arg': 'pluginstorage', 'cmd': 'get', 'pn': pn, 'var': i });
|
||||
};
|
||||
window.bdPluginStorage.set = function(pn, i, v) {
|
||||
betterDiscordIPC.sendSync('synchronous-message', { 'arg': 'pluginstorage', 'cmd': 'set', 'pn': pn, 'var': i, 'data': v });
|
||||
};
|
||||
|
||||
betterDiscordIPC.on('asynchronous-reply', (event, arg) => {
|
||||
console.log(event);
|
||||
console.log(arg);
|
||||
});
|
||||
|
||||
var settingsPanel, emoteModule, utils, quickEmoteMenu, opublicServers, voiceMode, pluginModule, themeModule, customCssEditor, dMode;
|
||||
var jsVersion = 1.74;
|
||||
var supportedVersion = "0.2.5";
|
||||
var jsVersion = 1.77;
|
||||
var supportedVersion = "0.2.81";
|
||||
|
||||
var mainObserver;
|
||||
|
||||
|
@ -84,60 +155,25 @@ var defaultCookie = {
|
|||
var bdchangelog = {
|
||||
"changes": {
|
||||
"0a": {
|
||||
"title": "1.73 : Native sub emotes",
|
||||
"text": "Native sub emote support disabled for now due to a critical bug",
|
||||
"title": "1.77 : Local storage proxy",
|
||||
"text": "Implemented a local storage proxy for old plugin support. Do not use it for new plugins! use the bdPluginStorage.get and bdPluginStorage.set",
|
||||
"img": ""
|
||||
},
|
||||
"1a": {
|
||||
"title": "1.73 : Initial Developer Mode",
|
||||
"text": "Enable developer mode from settings!",
|
||||
"img": ""
|
||||
},
|
||||
"a": {
|
||||
"title": "v1.72 : Public Servers",
|
||||
"text": "Public servers now have categories, description, tags, dark mode and more!",
|
||||
"img": ""
|
||||
},
|
||||
"b": {
|
||||
"title": "v1.72 : Import/Export",
|
||||
"text": "Import/Export buttons now disappear in themes/plugins tabs to avoid confusion",
|
||||
"img": ""
|
||||
},
|
||||
"c": {
|
||||
"title": "v1.72 : Changelog",
|
||||
"text": "You can now reopen this changelog from the settings",
|
||||
"0b": {
|
||||
"title": "1.76 : Alternate Storage",
|
||||
"text": "<a target='blank' href='https://gist.github.com/Jiiks/267113ecb1685f39f4dc4646f9380d55'>https://gist.github.com/Jiiks/267113ecb1685f39f4dc4646f9380d55</a>",
|
||||
"img": ""
|
||||
}
|
||||
},
|
||||
"fixes": {
|
||||
"0a": {
|
||||
"title": "v1.74 : BetterDiscord Invite",
|
||||
"text": "Fixed the BetterDiscord invite link in public servers",
|
||||
"title": "1.77 : Custom css and favourite emote loading",
|
||||
"text": "Fixed custom css and favourite emote loading when they are not present",
|
||||
"img": ""
|
||||
},
|
||||
"0b": {
|
||||
"title": "v1.74 : Dev Mode",
|
||||
"text": "Fixed dev mode breaking",
|
||||
"img": ""
|
||||
},
|
||||
"0c": {
|
||||
"title": "v1.72 : Settings panel",
|
||||
"text": "Settings panel will now show no matter how you open it!",
|
||||
"img": ""
|
||||
},
|
||||
"0d": {
|
||||
"title": "v1.72 : Fixed emote edit bug",
|
||||
"text": "Edits now appear properly even with emotes!",
|
||||
"img": ""
|
||||
},
|
||||
"0e": {
|
||||
"title": "v1.72 : Public servers",
|
||||
"text": "Public servers button is visible again!",
|
||||
"img": ""
|
||||
},
|
||||
"0f": {
|
||||
"title": "v1.72 : Public servers",
|
||||
"text": "Updated public servers api endpoint url for fetching correct serverlist.",
|
||||
"title": "1.76 : Alternate Storage",
|
||||
"text": "Both BetterDiscord and plugins now use alternate storage",
|
||||
"img": ""
|
||||
}
|
||||
}
|
||||
|
@ -1168,8 +1204,8 @@ QuickEmoteMenu.prototype.init = function() {
|
|||
if(e.target.id != "rmenu") $("#rmenu").remove();
|
||||
});
|
||||
this.favoriteEmotes = {};
|
||||
var fe = localStorage["bdfavemotes"];
|
||||
if (fe != undefined) {
|
||||
var fe = bdStorage.get("bdfavemotes");
|
||||
if (fe !== "" && fe !== null) {
|
||||
this.favoriteEmotes = JSON.parse(atob(fe));
|
||||
}
|
||||
|
||||
|
@ -1332,8 +1368,7 @@ QuickEmoteMenu.prototype.updateFavorites = function () {
|
|||
this.faContainer = faContainer;
|
||||
|
||||
$("#bda-qem-favourite-container").replaceWith(faContainer);
|
||||
|
||||
window.localStorage["bdfavemotes"] = btoa(JSON.stringify(this.favoriteEmotes));
|
||||
window.bdStorage.set("bdfavemotes", btoa(JSON.stringify(this.favoriteEmotes)));
|
||||
};
|
||||
function CustomCssEditor() { }
|
||||
|
||||
|
@ -1364,7 +1399,7 @@ attachEditor += " <\/li>";
|
|||
attachEditor += " <li>";
|
||||
attachEditor += " <div class=\"checkbox\" onclick=\"settingsPanel.updateSetting(this);\">";
|
||||
attachEditor += " <div class=\"checkbox-inner\"><input id=\"bda-css-1\" type=\"checkbox\" "+(settingsCookie["bda-css-1"] ? "checked" : "")+"><span><\/span><\/div>";
|
||||
attachEditor += " <span title=\"Autosave css to localstorage when typing\">Autosave<\/span>";
|
||||
attachEditor += " <span title=\"Autosave css to storage when typing\">TEMPDISABLED<\/span>";
|
||||
attachEditor += " <\/div>";
|
||||
attachEditor += " <\/li>";
|
||||
attachEditor += " <li>";
|
||||
|
@ -1430,8 +1465,8 @@ CustomCssEditor.prototype.applyCustomCss = function (css, forceupdate, forcesave
|
|||
$("#customcss").html(css);
|
||||
}
|
||||
|
||||
if(forcesave || settingsCookie["bda-css-1"]) {
|
||||
localStorage.setItem("bdcustomcss", btoa(css));
|
||||
if(forcesave) {
|
||||
window.bdStorage.set("bdcustomcss", btoa(css));
|
||||
}
|
||||
};
|
||||
/* BetterDiscordApp Settings Panel JavaScript
|
||||
|
@ -1725,7 +1760,11 @@ SettingsPanel.prototype.construct = function () {
|
|||
//End emote settings
|
||||
|
||||
//Custom CSS Editor
|
||||
var ccss = atob(localStorage.getItem("bdcustomcss"));
|
||||
var _ccss = window.bdStorage.get("bdcustomcss");
|
||||
var ccss = "";
|
||||
if(_ccss !== null && _ccss !== "") {
|
||||
ccss = atob(_ccss);
|
||||
}
|
||||
customCssEditor.applyCustomCss(ccss, true, false);
|
||||
|
||||
settingsInner += '\
|
||||
|
@ -1977,8 +2016,8 @@ Utils.prototype.importSettings = function() {
|
|||
settingsPanel.updateSettings();
|
||||
}
|
||||
}
|
||||
localStorage["bdcustomcss"] = obj.customCss;
|
||||
var ccss = atob(localStorage.getItem("bdcustomcss"));
|
||||
window.bdStorage.set("bdcustomcss", obj.customCss);
|
||||
var ccss = window.bdStorage.get("bdcustomcss");
|
||||
if (!customCssInitialized) {
|
||||
customCssEditor.init();
|
||||
customCssInitialized = true;
|
||||
|
@ -2041,10 +2080,10 @@ Utils.prototype.importSettings = function() {
|
|||
Utils.prototype.exportSettings = function() {
|
||||
var obj = {
|
||||
settings: settingsCookie,
|
||||
customCss: localStorage["bdcustomcss"],
|
||||
customCss: window.bdStorage.get("bdcustomcss"),
|
||||
plugins: pluginCookie,
|
||||
themes: themeCookie,
|
||||
favEmotes: window.localStorage["bdfavemotes"]
|
||||
favEmotes: window.bdStorage.get("bdfavemotes")
|
||||
};
|
||||
mainCore.alert("Export Settings", '<div class="form" style="width:100%;"><div class="control-group"><textarea style="min-height:150px;">'+JSON.stringify(obj)+'</textarea></div></div>');
|
||||
};
|
||||
|
@ -2329,8 +2368,8 @@ BdWSocket.prototype.onOpen = function () {
|
|||
var data = {
|
||||
op: 2,
|
||||
d: {
|
||||
token: JSON.parse(localStorage.getItem('token')),
|
||||
properties: JSON.parse(localStorage.getItem('superProperties')),
|
||||
token: JSON.parse(window.bdStorage.get('token')),
|
||||
properties: JSON.parse(window.bdStorage.get('superProperties')),
|
||||
v: 3
|
||||
}
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -10,7 +10,7 @@
|
|||
|
||||
var _fs = require("fs");
|
||||
var _config = require("./config.json");
|
||||
var _utils = require("./utils");
|
||||
var _utils;
|
||||
var _utils2;
|
||||
var _bdIpc = require('electron').ipcMain;
|
||||
var _error = false;
|
||||
|
@ -22,11 +22,64 @@ var _mainWindow;
|
|||
var _cfg = {};
|
||||
var _extData = {};
|
||||
|
||||
var bdStorage = {};
|
||||
var bdPluginStorage = {};
|
||||
|
||||
bdStorage.defaults = {
|
||||
data: {}
|
||||
};
|
||||
|
||||
bdPluginStorage.defaults = {
|
||||
data: {}
|
||||
};
|
||||
|
||||
function initStorage() {
|
||||
if(!_fs.existsSync(_cfg.dataPath + "/bdStorage.json")) {
|
||||
bdStorage.data = bdStorage.defaults.data;
|
||||
_fs.writeFileSync(_cfg.dataPath + "/bdStorage.json", JSON.stringify(bdStorage, null, 4));
|
||||
} else {
|
||||
bdStorage.data = JSON.parse(_fs.readFileSync(_cfg.dataPath + "/bdStorage.json"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
bdStorage.get = function(i, m, pn) {
|
||||
|
||||
if(m) return bdStorage.data[i] || "";
|
||||
|
||||
if(bdPluginStorage[pn] !== undefined) {
|
||||
return bdPluginStorage[pn][i] || undefined;
|
||||
}
|
||||
|
||||
if(_fs.existsSync(_cfg.dataPath + "/plugins/" + pn + ".config.json")) {
|
||||
bdPluginStorage[pn] = JSON.parse(_fs.readFileSync(_cfg.dataPath + "/plugins/" + pn + ".config.json"));
|
||||
return bdPluginStorage[pn][i] || undefined;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
bdStorage.set = function(i, v, m, pn) {
|
||||
if(m) {
|
||||
bdStorage.data[i] = v;
|
||||
_fs.writeFileSync(_cfg.dataPath + "/bdStorage.json", JSON.stringify(bdStorage.data, null, 4));
|
||||
} else {
|
||||
if(bdPluginStorage[pn] === undefined) bdPluginStorage[pn] = {};
|
||||
bdPluginStorage[pn][i] = v;
|
||||
_fs.writeFileSync(_cfg.dataPath + "/plugins/" + pn + ".config.json", JSON.stringify(bdPluginStorage[pn], null, 4));
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
function BetterDiscord(mainWindow) {
|
||||
_mainWindow = mainWindow;
|
||||
_cfg = _config.cfg;
|
||||
_cfg.version = _config.Core.Version;
|
||||
_cfg.os = process.platform;
|
||||
_utils = _cfg.os == "linux" ? require("./Utils") : require("./utils");
|
||||
_utils2 = new _utils.Utils(mainWindow);
|
||||
hook();
|
||||
createAndCheckData();
|
||||
|
@ -35,7 +88,7 @@ function BetterDiscord(mainWindow) {
|
|||
function createAndCheckData() {
|
||||
getUtils().log("Checking data/cache");
|
||||
|
||||
_cfg.dataPath = (_cfg.os == 'win32' ? process.env.APPDATA : _cfg.os == 'darwin' ? process.env.HOME + '/Library/Preferences' : '/var/local') + '/BetterDiscord/';
|
||||
_cfg.dataPath = (_cfg.os == 'win32' ? process.env.APPDATA : _cfg.os == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + '/.config') + '/BetterDiscord/';
|
||||
_cfg.userFile = _cfg.dataPath + 'user.json';
|
||||
|
||||
try {
|
||||
|
@ -86,6 +139,7 @@ function init() {
|
|||
getUtils().attempt(getHash, 3, 0, "Failed to load hash", initUpdater, function() {
|
||||
exit("Failed to load hash after 3 attempts");
|
||||
});
|
||||
initStorage();
|
||||
}
|
||||
|
||||
function getHash(callback) {
|
||||
|
@ -94,11 +148,11 @@ function getHash(callback) {
|
|||
_cfg.hash = JSON.parse(data).sha;
|
||||
getUtils().injectVar("_bdhash", _cfg.hash);
|
||||
}catch(err) {
|
||||
callback(false);
|
||||
callback(false, err);
|
||||
return;
|
||||
}
|
||||
if(_cfg.hash == undefined) {
|
||||
callback(false);
|
||||
callback(false, "_cfg.hash == undefined");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -111,7 +165,7 @@ function getHash(callback) {
|
|||
function initUpdater() {
|
||||
getUtils().log("Getting updater");
|
||||
getUtils().attempt(getUpdater, 3, 0, "Failed to load updater", waitForDom, function() {
|
||||
exit("Failed to load updater after 3 attempts");
|
||||
exit("Failed to load updater after 3 attempts.");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -120,17 +174,22 @@ function getUpdater(callback) {
|
|||
try {
|
||||
_cfg.updater = JSON.parse(data);
|
||||
} catch(err) {
|
||||
callback(false);
|
||||
callback(false, err);
|
||||
return;
|
||||
}
|
||||
|
||||
if(_cfg.updater == undefined) {
|
||||
callback(false);
|
||||
callback(false, "_cfg.updater == undefined");
|
||||
return;
|
||||
}
|
||||
|
||||
if(_cfg.updater.LatestVersion == undefined || _cfg.updater.CDN == undefined) {
|
||||
callback(false);
|
||||
if(_cfg.updater.LatestVersion == undefined) {
|
||||
callback(false, "_cfg.updater.LatestVersion == undefined");
|
||||
return;
|
||||
}
|
||||
|
||||
if(_cfg.updater.CDN == undefined) {
|
||||
callback(false, "_cfg.updater.CDN == undefined");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -169,8 +228,8 @@ function updateExtData() {
|
|||
'type': 'javascript',
|
||||
'resource': 'Main JS',
|
||||
'domain': _cfg.updater.CDN,
|
||||
'url': '//' + _cfg.updater.CDN + '/' + _cfg.repo + '/BetterDiscordApp/' + _cfg.hash + '/js/main.min.js',
|
||||
'localurl': _cfg.localServer + '/BetterDiscordApp/js/main.js',
|
||||
'url': '//' + _cfg.updater.CDN + '/' + _cfg.repo + '/BetterDiscordApp/' + _cfg.hash + '/js/main.js',
|
||||
'localurl': _cfg.localServer + '/BetterDiscordApp/js/main.js?v=1.1',
|
||||
'message': 'load-emoteData-twitchGlobal',
|
||||
'cacheable': false,
|
||||
'variable': null
|
||||
|
@ -357,6 +416,7 @@ function load(reload) {
|
|||
}
|
||||
getUtils().log("Hooking ipc async");
|
||||
_bdIpc.on('asynchronous-message', function(event, arg) { ipcAsyncMessage(event, arg); });
|
||||
_bdIpc.on('synchronous-message', function(event, arg) { ipcSyncMessage(event, arg); });
|
||||
getUtils().log("Hooked ipc async");
|
||||
}
|
||||
initLoaders();
|
||||
|
@ -511,8 +571,32 @@ function loadApp() {
|
|||
getUtils().injectJavaScriptSync("//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js", "load-jQueryCookie");
|
||||
}
|
||||
|
||||
function ipcAsyncMessage(event, arg) {
|
||||
function ipcSyncMessage(event, arg) {
|
||||
if(typeof(arg) === "object") {
|
||||
switch(arg.arg) {
|
||||
case "storage":
|
||||
if(arg.cmd == "get") {
|
||||
event.returnValue = bdStorage.get(arg.var, true);
|
||||
}
|
||||
if(arg.cmd == "set") {
|
||||
bdStorage.set(arg.var, arg.data, true);
|
||||
event.returnValue = "saved";
|
||||
}
|
||||
break;
|
||||
case "pluginstorage":
|
||||
if(arg.cmd == "get") {
|
||||
event.returnValue = bdStorage.get(arg.var, false, arg.pn) || null;
|
||||
}
|
||||
if(arg.cmd == "set") {
|
||||
bdStorage.set(arg.var, arg.data, false, arg.pn);
|
||||
event.returnValue = "saved";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ipcAsyncMessage(event, arg) {
|
||||
if(typeof(arg) === "object") {
|
||||
switch(arg.arg) {
|
||||
case "opendir":
|
||||
|
@ -530,6 +614,17 @@ function ipcAsyncMessage(event, arg) {
|
|||
}
|
||||
getUtils().openDir(arg.path);
|
||||
break;
|
||||
case "storage":
|
||||
if(arg.cmd == "set") {
|
||||
bdStorage.set(arg.var, arg.data);
|
||||
break;
|
||||
}
|
||||
if(arg.cmd == "get") {
|
||||
var get = bdStorage.get(arg.var);
|
||||
event.sender.send('asynchronous-reply', get);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"Core": {
|
||||
"Version": "0.2.8"
|
||||
"Version": "0.2.82"
|
||||
},
|
||||
"EmoteModule": {
|
||||
"Twitch":{
|
||||
|
@ -25,7 +25,7 @@
|
|||
"beta": false,
|
||||
"local": false,
|
||||
"localServer": "http://localhost",
|
||||
"version": "0.2.8",
|
||||
"version": "0.2.82",
|
||||
"updater": null,
|
||||
"hash": null,
|
||||
"dataPath": null,
|
||||
|
|
|
@ -24,8 +24,8 @@ var _cfg;
|
|||
|
||||
// Default configs if for some reason we don't receive config params
|
||||
const _defaults = {
|
||||
installPath: (_os.platform() === 'win32' ? process.env.APPDATA : _os.platform() === 'darwin' ? `${process.env.HOME}/Library/Preferences`: `/var/local`) + '/BetterDiscord/lib/',
|
||||
dataPath: (_os.platform() === 'win32' ? process.env.APPDATA : _os.platform() === 'darwin' ? `${process.env.HOME}/Library/Preferences`: `/var/local`) + '/BetterDiscord/data/',
|
||||
installPath: (_os.platform() === 'win32' ? process.env.APPDATA : _os.platform() === 'darwin' ? `${process.env.HOME}/Library/Preferences`: `/var/local`) + '/BetterDiscord/lib',
|
||||
dataPath: (_os.platform() === 'win32' ? process.env.APPDATA : _os.platform() === 'darwin' ? `${process.env.HOME}/Library/Preferences`: `/var/local`) + '/BetterDiscord/data',
|
||||
emotesEnabled: true
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue