add some secrets

This commit is contained in:
Jiiks 2019-03-07 22:44:29 +02:00
parent b8793fd2b6
commit 174c1ee791
6 changed files with 79 additions and 9 deletions

View File

@ -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) {

View File

@ -20,6 +20,7 @@
<SidebarItem :item="{text, type: 'header'}" />
<SidebarItem v-for="i in category" :key="i.id" :item="i" :active="item && i.id === item.id" @click="itemOnClick(i.id)" />
</template>
<SidebarItem v-if="superSecretMenu" :item="{ _type: 'button', text: 'Super Secret' }" :active="superSecretMenuActive" @click="itemOnClick('superSecretMenu')"/>
</Sidebar>
<div slot="sidebarfooter" class="bd-info">
@ -37,7 +38,8 @@
<ContentColumn slot="content">
<transition name="bd-contentcolumn" @before-enter="animating++" @after-enter="animating--" @enter-cancelled="animating--" @before-leave="animating++" @after-leave="animating--" @leave-cancelled="animating--">
<div v-if="item" :key="item.id">
<SuperSecretView v-if="superSecretMenuActive"/>
<div v-else-if="item" :key="item.id">
<template v-if="item.component">
<component :is="item.component" :SettingsWrapper="SettingsWrapper" />
</template>
@ -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);

View File

@ -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.
*/
<template>
<SettingsWrapper headertext="Super Secret">
<div class="bd-flex bd-flexCol bd-devview">
<FormButton @click="forceUpdate">Force Update</FormButton>
<FormButton @click="debugConfig">Config Debug</FormButton>
</div>
</SettingsWrapper>
</template>
<script>
import SettingsWrapper from './SettingsWrapper.vue';
import { FormButton } from '../common';
import { Globals } from 'modules';
import { ClientIPC } from 'common';
export default {
data() {
return {
};
},
components: {
SettingsWrapper,
FormButton
},
methods: {
forceUpdate() {
ClientIPC.send('debug-updater-forceUpdate');
},
debugConfig() {
console.log(Globals);
}
}
}
</script>

View File

@ -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';

View File

@ -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'));
}

View File

@ -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;