commit
5ba8c41850
|
@ -16,6 +16,7 @@ import { ClientLogger as Logger, ClientIPC } from 'common';
|
|||
class BetterDiscord {
|
||||
|
||||
constructor() {
|
||||
window.bdglobals = Globals;
|
||||
window.ClientIPC = ClientIPC;
|
||||
window.css = CssEditor;
|
||||
window.pm = PluginManager;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
import { Events, SocketProxy, EventHook, CssEditor } from 'modules';
|
||||
import { ProfileBadges } from 'ui';
|
||||
import Updater from './updater';
|
||||
|
||||
export default class {
|
||||
|
||||
|
@ -20,7 +21,8 @@ export default class {
|
|||
new ProfileBadges(),
|
||||
new SocketProxy(),
|
||||
new EventHook(),
|
||||
CssEditor
|
||||
CssEditor,
|
||||
new Updater()
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* 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');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'https://rawgit.com/JsSucks/BetterDiscordApp/master/package.json',
|
||||
cache: false,
|
||||
success: e => {
|
||||
Logger.info('Updater', `Latest Version: ${e.version} - Current Version: ${Globals.getObject('version')}`);
|
||||
Events.emit('update-check-end');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,8 @@ import WebpackModules from './webpackmodules';
|
|||
import jQuery from 'jquery';
|
||||
import lodash from 'lodash';
|
||||
|
||||
export { jQuery as $ };
|
||||
|
||||
export default class {
|
||||
|
||||
static get jQuery() {
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
top: 27px;
|
||||
}
|
||||
|
||||
.platform-linux & {
|
||||
top: 0;
|
||||
}
|
||||
.platform-linux & {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.bd-settings-button-btn {
|
||||
background-image: $logoSmallBw;
|
||||
|
@ -38,6 +38,11 @@
|
|||
&.bd-loading {
|
||||
animation: bd-settings-button-pulse 1.5s infinite;
|
||||
}
|
||||
|
||||
&.bd-updates {
|
||||
filter: hue-rotate(250deg) !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.bd-active {
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
<template>
|
||||
<div class="bd-settings-wrapper" :class="[{active: active}, 'platform-' + this.platform]">
|
||||
<div class="bd-settings-button" :class="{'bd-active': active}" @click="showSettings">
|
||||
<div class="bd-settings-button-btn" :class="[{'bd-loading': !loaded}]"></div>
|
||||
<div v-if="updating === 0" v-tooltip.right="'Checking for updates'" class="bd-settings-button-btn bd-loading"></div>
|
||||
<div v-else-if="updating === 2" v-tooltip.right="'Updates available!'" class="bd-settings-button-btn bd-updates"></div>
|
||||
<div v-else class="bd-settings-button-btn" :class="[{'bd-loading': !loaded}]"></div>
|
||||
</div>
|
||||
<BdSettings :active="active" :close="hideSettings" />
|
||||
</div>
|
||||
|
@ -25,6 +27,7 @@
|
|||
data() {
|
||||
return {
|
||||
loaded: false,
|
||||
updating: false,
|
||||
active: false,
|
||||
platform: global.process.platform
|
||||
}
|
||||
|
@ -49,6 +52,9 @@
|
|||
},
|
||||
created() {
|
||||
Events.on('ready', e => this.loaded = true);
|
||||
Events.on('update-check-start', e => this.updating = 0);
|
||||
Events.on('update-check-end', e => this.updating = 1);
|
||||
Events.on('updates-available', e => this.updating = 2);
|
||||
window.addEventListener('keyup', this.keyupListener);
|
||||
},
|
||||
destroyed() {
|
||||
|
|
Loading…
Reference in New Issue