From 174c1ee791e49d97c449ae2d79672da1d10b15c1 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Thu, 7 Mar 2019 22:44:29 +0200 Subject: [PATCH] add some secrets --- client/src/index.js | 4 ++ client/src/ui/components/BdSettings.vue | 19 ++++++-- .../src/ui/components/bd/SuperSecretView.vue | 45 +++++++++++++++++++ client/src/ui/components/bd/index.js | 1 + core/src/main.js | 3 +- core/src/modules/updater.js | 16 +++++-- 6 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 client/src/ui/components/bd/SuperSecretView.vue diff --git a/client/src/index.js b/client/src/index.js index eea4c0da..b9bf27f7 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -96,6 +96,10 @@ class BetterDiscord { Events.emit('ready'); Events.emit('discord-ready'); + window.__superSecretBdMenu = function() { + Events.emit('enabledSuperSecretBdMenu'); + } + if (!Settings.get('core', 'advanced', 'ignore-content-manager-errors')) Modals.showContentManagerErrors(); } catch (err) { diff --git a/client/src/ui/components/BdSettings.vue b/client/src/ui/components/BdSettings.vue index 0b70490d..cbbbad21 100644 --- a/client/src/ui/components/BdSettings.vue +++ b/client/src/ui/components/BdSettings.vue @@ -20,6 +20,7 @@ +
@@ -37,7 +38,8 @@ -
+ +
@@ -67,7 +69,7 @@ import { BdMenuItems } from 'ui'; import { shell } from 'electron'; import { SidebarView, Sidebar, SidebarItem, ContentColumn } from './sidebar'; - import { SettingsWrapper, SettingsPanel, CssEditorView, PluginsView, ThemesView, UpdaterView, ConnectivityView } from './bd'; + import { SettingsWrapper, SettingsPanel, CssEditorView, PluginsView, ThemesView, UpdaterView, ConnectivityView, SuperSecretView } from './bd'; import { SvgX, MiGithubCircle, MiWeb, MiClose, MiTwitterCircle } from './common'; export default { @@ -78,13 +80,15 @@ items: BdMenuItems.items, Settings, SettingsWrapper, - openMenuHandler: null + openMenuHandler: null, + superSecretMenu: false, + superSecretMenuActive: false }; }, props: ['active'], components: { SidebarView, Sidebar, SidebarItem, ContentColumn, - SettingsWrapper, SettingsPanel, CssEditorView, PluginsView, ThemesView, UpdaterView, ConnectivityView, + SettingsWrapper, SettingsPanel, CssEditorView, PluginsView, ThemesView, UpdaterView, ConnectivityView, SuperSecretView, MiGithubCircle, MiWeb, MiClose, MiTwitterCircle }, computed: { @@ -103,6 +107,12 @@ }, methods: { itemOnClick(id) { + if (id === 'superSecretMenu') { + this.item = 'supersecretmenu'; + this.superSecretMenuActive = true; + return; + } + this.superSecretMenuActive = false; this.item = this.items.find(item => item.id === id); }, closeContent() { @@ -126,6 +136,7 @@ }, created() { Events.on('bd-open-menu', this.openMenuHandler = item => item && this.itemOnClick(this.items.find(i => i === item || i.id === item || i.contentid === item || i.set === item).id)); + Events.on('enabledSuperSecretBdMenu', () => this.superSecretMenu = true); }, destroyed() { if (this.openMenuHandler) Events.off('bd-open-menu', this.openMenuHandler); diff --git a/client/src/ui/components/bd/SuperSecretView.vue b/client/src/ui/components/bd/SuperSecretView.vue new file mode 100644 index 00000000..c64ee7bd --- /dev/null +++ b/client/src/ui/components/bd/SuperSecretView.vue @@ -0,0 +1,45 @@ +/** + * BetterDiscord Developer View Component + * 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. +*/ + + + + diff --git a/client/src/ui/components/bd/index.js b/client/src/ui/components/bd/index.js index 4ef07ae3..29b20c86 100644 --- a/client/src/ui/components/bd/index.js +++ b/client/src/ui/components/bd/index.js @@ -8,3 +8,4 @@ export { default as UpdaterStatus } from './UpdaterStatus.vue'; export { default as UpdaterToggle } from './UpdaterToggle.vue'; export { default as BdBadge } from './BdBadge.vue'; export { default as ConnectivityView } from './ConnectivityView.vue'; +export { default as SuperSecretView } from './SuperSecretView.vue'; diff --git a/core/src/main.js b/core/src/main.js index eab5fa26..b102f38a 100644 --- a/core/src/main.js +++ b/core/src/main.js @@ -40,7 +40,6 @@ const TEST_ARGS = () => { } } const TEST_EDITOR = TESTS && true; -const TEST_UPDATER = TESTS && true; import path from 'path'; import sass from 'node-sass'; @@ -227,6 +226,7 @@ export class BetterDiscord { configProxy = () => this.config; const autoInitComms = this.comms; const autoInitEditor = this.editor; + const autoInitUpdater = this.updater; this.init(); } @@ -358,7 +358,6 @@ export class BetterDiscord { */ async injectScripts(reload = false) { console.log(`[BetterDiscord] injecting ${this.config.getPath('client_script')}. Reload: ${reload}`); - if (TEST_UPDATER) setTimeout(this.updater.checkForUpdates, 5000); return this.windowUtils.injectScript(this.config.getPath('client_script')); } diff --git a/core/src/modules/updater.js b/core/src/modules/updater.js index 790bfedd..5fe688ba 100644 --- a/core/src/modules/updater.js +++ b/core/src/modules/updater.js @@ -81,6 +81,9 @@ export default class Updater extends Module { events(ipc) { ipc.on('updater-startUpdate', (_, updates) => this.updateAll(updates)); + ipc.on('debug-updater-forceUpdate', () => { + this.checkForUpdates(true); + }); } async updateBd(update) { @@ -179,13 +182,20 @@ export default class Updater extends Module { console.log('fallback'); } - async checkForBdUpdates() { + async checkForBdUpdates(forced = false) { try { const { coreVersion, clientVersion, editorVersion } = this.bd.config; const releaseInfo = new ReleaseInfo({ core: coreVersion, client: clientVersion, editor: editorVersion }); const latestRelease = await this.latestRelease(); + if (forced) { + latestRelease.files = latestRelease.files.map(file => { + file.version = '10.0.0'; + return file; + }); + } + releaseInfo.files = latestRelease.files; const updates = []; @@ -203,12 +213,12 @@ export default class Updater extends Module { } } - async checkForUpdates() { + async checkForUpdates(forced = false) { console.log('[BetterDiscord:Updater] Checking for updates'); this.bd.sendToDiscord('updater-checkForUpdates', ''); try { - const bd = await this.checkForBdUpdates(); + const bd = await this.checkForBdUpdates(forced); const updates = { bd, haveUpdates: false }; if (bd.length) updates.haveUpdates = true;