Skip to content
This repository has been archived by the owner on Jun 27, 2021. It is now read-only.

Commit

Permalink
Update to master + include reload patch
Browse files Browse the repository at this point in the history
  • Loading branch information
rauenzi committed Dec 22, 2018
2 parents c042575 + dde3dc2 commit 96f27d0
Show file tree
Hide file tree
Showing 16 changed files with 238 additions and 281 deletions.
4 changes: 3 additions & 1 deletion advanced_installation.md
Expand Up @@ -17,7 +17,9 @@
process.env.injDir = '<path>';
```
where `<path>` is the location of the ED folder.


Make sure to escape paths, for example `C:\Users\<Username>\Documents\EnhancedDiscord\EnhancedDiscord` should be `C:\\Users\\<Username>\\Documents\\EnhancedDiscord\\EnhancedDiscord`

5. Between the line you just added and the original contents, add the following:
```js
const { BrowserWindow, session } = require('electron');
Expand Down
44 changes: 23 additions & 21 deletions dom_shit.js
Expand Up @@ -34,7 +34,7 @@ let c = {
}
}
// config util
window.ED = {plugins: {}};
window.ED = { plugins: {}, version: '2.2.0' };
Object.defineProperty(window.ED, 'config', {
get: function() {
return require('./config.json') || {};
Expand Down Expand Up @@ -64,25 +64,14 @@ function loadPlugin(plugin) {
}
}

window.ED.localStorage = window.localStorage;

process.once("loaded", async () => {
c.log(`Loading v${window.ED.version}...`);
while (typeof window.webpackJsonp === 'undefined')
await c.sleep(1000); // wait until this is loaded in order to use it for modules

c.log('Loading v2.1.0...');

let x = setInterval(() => {
if (window._ws) {
window.ED.webSocket = window._ws;
clearInterval(x);
}
}, 100);

let y = setInterval(() => {
if (window.localStorage) {
window.ED.localStorage = window.localStorage;
clearInterval(y);
}
}, 100);
window.ED.webSocket = window._ws;

/* Add helper functions that make plugins easy to create */
window.req = webpackJsonp.push([[], {
Expand Down Expand Up @@ -165,14 +154,14 @@ process.once("loaded", async () => {

if (window.ED.config.antiTrack !== false)
window.monkeyPatch(window.findModule('track'), 'track', () => {});

while (Object.keys(window.req.c).length < 5000)
await c.sleep(1000); // wait until most modules are loaded for plugins

if (window.ED.config.bdPlugins)
await BDManager.setup(currentWindow);
//load and validate plugins

//load and validate plugins
let pluginFiles = fs.readdirSync(path.join(process.env.injDir, 'plugins'));
let plugins = {};
for (let i in pluginFiles) {
Expand All @@ -190,7 +179,7 @@ process.once("loaded", async () => {
c.warn(`Failed to load ${pluginFiles[i]}: ${err}\n${err.stack}`, p);
}
}

for (let id in plugins) {
if (!plugins[id] || !plugins[id].name || typeof plugins[id].load !== 'function') {
c.info(`Skipping invalid plugin: ${id}`); plugins[id] = null; continue;
Expand All @@ -199,8 +188,21 @@ process.once("loaded", async () => {
if (window.ED.config[id] && window.ED.config[id].enabled == false) continue;
loadPlugin(plugins[id]);
}

window.ED.plugins = plugins;

const ht = window.findModule('hideToken'), cw = findModule('consoleWarning');
// prevent client from removing token from localstorage when dev tools is opened, or reverting your token if you change it
monkeyPatch(ht, 'hideToken', () => {});
monkeyPatch(ht, 'showToken', () => {});
// change the console warning to be more fun
monkeyPatch(cw, 'consoleWarning', () => {
console.log("%cHold Up!", "color: #7289DA; -webkit-text-stroke: 2px black; font-size: 72px; font-weight: bold;");
console.log("%cIf you're reading this, you're probably smarter than most Discord developers.", "font-size: 16px;");
console.log("%cPasting anything in here could actually improve the Discord client.", "font-size: 18px; font-weight: bold; color: red;");
console.log("%cUnless you understand exactly what you're doing, keep this window open to browse our bad code.", "font-size: 16px;");
console.log("%cIf you don't understand exactly what you're doing, you should come work with us: https://discordapp.com/jobs", "font-size: 16px;");
});
})


Expand Down
1 change: 1 addition & 0 deletions installer/EnhancedDiscordUI/EnhancedDiscordUI.csproj
Expand Up @@ -60,6 +60,7 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="LogWriter.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
Expand Down

0 comments on commit 96f27d0

Please sign in to comment.