diff --git a/client/src/modules/updater.js b/client/src/modules/updater.js index 76b4ca29..ed862c9c 100644 --- a/client/src/modules/updater.js +++ b/client/src/modules/updater.js @@ -8,81 +8,10 @@ * LICENSE file in the root directory of this source tree. */ -import Events from './events'; -import Globals from './globals'; -import { ClientLogger as Logger } from 'common'; -import request from 'request-promise-native'; - export default new class { constructor() { - this.updatesAvailable = false; - this.latestVersion = undefined; - this.error = undefined; - this.init = this.init.bind(this); - this.checkForUpdates = this.checkForUpdates.bind(this); - } - - /** - * The interval to wait before checking for updates. - */ - get interval() { - return 60 * 1000 * 30; - } - - init() { - this.updateInterval = setInterval(this.checkForUpdates, this.interval); - } - - /** - * Installs an update. - * TODO - */ - async update() { - try { - await new Promise(resolve => setTimeout(resolve, 5000)); - - this.updatesAvailable = false; - this.latestVersion = Globals.version; - Events.emit('update-check-end'); - } catch (err) { - this.error = err; - this.checkForUpdates(); - throw err; - } - } - - /** - * Checks for updates. - * @return {Promise} - */ - async checkForUpdates() { - if (this.updatesAvailable) return true; - Events.emit('update-check-start'); - Logger.info('Updater', 'Checking for updates'); - - try { - const response = await request({ - uri: 'https://rawgit.com/JsSucks/BetterDiscordApp/master/package.json', - json: true - }); - - this.latestVersion = response.version; - Events.emit('update-check-end'); - Logger.info('Updater', `Latest Version: ${response.version} - Current Version: ${Globals.version}`); - - if (this.latestVersion !== Globals.version) { - this.updatesAvailable = true; - Events.emit('updates-available'); - return true; - } - - return false; - } catch (err) { - Events.emit('update-check-fail', err); - throw err; - } } } diff --git a/client/src/ui/components/bd/UpdaterView.vue b/client/src/ui/components/bd/UpdaterView.vue index 6c24e7a3..e69aa2e8 100644 --- a/client/src/ui/components/bd/UpdaterView.vue +++ b/client/src/ui/components/bd/UpdaterView.vue @@ -11,19 +11,7 @@ @@ -48,22 +36,18 @@ }, computed: { updatesAvailable() { - return this.updater.updatesAvailable; + return false; }, newVersion() { - return this.updater.latestVersion; + return '2.0.0-beta.4'; }, error() { - return this.updater.error; + return null; } }, methods: { async install() { - this.updating = true; - try { - await this.updater.update(); - } catch (err) {} - this.updating = false; + } } }