diff --git a/client/src/index.js b/client/src/index.js index e87fdfe8..11b8b01c 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -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; diff --git a/client/src/modules/modulemanager.js b/client/src/modules/modulemanager.js index cdf51dce..209f32bf 100644 --- a/client/src/modules/modulemanager.js +++ b/client/src/modules/modulemanager.js @@ -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() ]); } diff --git a/client/src/modules/updater.js b/client/src/modules/updater.js new file mode 100644 index 00000000..2bf6aa50 --- /dev/null +++ b/client/src/modules/updater.js @@ -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'); + } + }); + } + +} diff --git a/client/src/modules/vendor.js b/client/src/modules/vendor.js index b0439811..7ddfc045 100644 --- a/client/src/modules/vendor.js +++ b/client/src/modules/vendor.js @@ -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() { diff --git a/client/src/styles/partials/bdsettings/button.scss b/client/src/styles/partials/bdsettings/button.scss index 3af9a8be..df81d933 100644 --- a/client/src/styles/partials/bdsettings/button.scss +++ b/client/src/styles/partials/bdsettings/button.scss @@ -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 { diff --git a/client/src/ui/components/BdSettingsWrapper.vue b/client/src/ui/components/BdSettingsWrapper.vue index 0314e5cd..4200ce1e 100644 --- a/client/src/ui/components/BdSettingsWrapper.vue +++ b/client/src/ui/components/BdSettingsWrapper.vue @@ -11,7 +11,9 @@