Updater runs every 30 minutes
This commit is contained in:
parent
2962d1fc9f
commit
eb9e3dd4c6
|
@ -16,6 +16,7 @@ import { ClientLogger as Logger, ClientIPC } from 'common';
|
||||||
class BetterDiscord {
|
class BetterDiscord {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
window.bdglobals = Globals;
|
||||||
window.ClientIPC = ClientIPC;
|
window.ClientIPC = ClientIPC;
|
||||||
window.css = CssEditor;
|
window.css = CssEditor;
|
||||||
window.pm = PluginManager;
|
window.pm = PluginManager;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
import { Events, SocketProxy, EventHook, CssEditor } from 'modules';
|
import { Events, SocketProxy, EventHook, CssEditor } from 'modules';
|
||||||
import { ProfileBadges } from 'ui';
|
import { ProfileBadges } from 'ui';
|
||||||
|
import Updater from './updater';
|
||||||
|
|
||||||
export default class {
|
export default class {
|
||||||
|
|
||||||
|
@ -20,7 +21,8 @@ export default class {
|
||||||
new ProfileBadges(),
|
new ProfileBadges(),
|
||||||
new SocketProxy(),
|
new SocketProxy(),
|
||||||
new EventHook(),
|
new EventHook(),
|
||||||
CssEditor
|
CssEditor,
|
||||||
|
new Updater()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/**
|
||||||
|
* BetterDiscord Updater Module
|
||||||
|
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
||||||
|
* All rights reserved.
|
||||||
|
* https://betterdiscord.net
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Events from './events';
|
||||||
|
import Globals from './globals';
|
||||||
|
import { $ } from 'vendor';
|
||||||
|
import { ClientLogger as Logger } from 'common';
|
||||||
|
|
||||||
|
export default class {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
window.updater = this;
|
||||||
|
this.init = this.init.bind(this);
|
||||||
|
this.checkForUpdates = this.checkForUpdates.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
get interval() {
|
||||||
|
return 60 * 1000 * 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
setInterval(this.checkForUpdates, this.interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkForUpdates() {
|
||||||
|
Events.emit('update-check-start');
|
||||||
|
Logger.info('Updater', 'Checking for updates');
|
||||||
|
$.get('https://raw.githubusercontent.com/JsSucks/BetterDiscordApp/master/package.json', e => {
|
||||||
|
const parse = JSON.parse(e);
|
||||||
|
Logger.info('Updater', `Latest Version: ${parse.version} - Current Version: ${Globals.getObject('version')}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -12,6 +12,8 @@ import WebpackModules from './webpackmodules';
|
||||||
import jQuery from 'jquery';
|
import jQuery from 'jquery';
|
||||||
import lodash from 'lodash';
|
import lodash from 'lodash';
|
||||||
|
|
||||||
|
export { jQuery as $ };
|
||||||
|
|
||||||
export default class {
|
export default class {
|
||||||
|
|
||||||
static get jQuery() {
|
static get jQuery() {
|
||||||
|
|
Loading…
Reference in New Issue