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

Commit

Permalink
Merge hotfix + hidden channels fix to beta
Browse files Browse the repository at this point in the history
  • Loading branch information
joe27g committed Aug 6, 2020
2 parents 6f2013b + 71f79a0 commit 100b18e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions dom_shit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = window.require('path');
const fs = window.require('fs');
const electron = window.require('electron');
electron.contextBridge.exposeInMainWorld = (key, val) => window[key] = val; // Expose DiscordNative
const Module = window.require('module').Module;
Module.globalPaths.push(path.resolve(electron.remote.app.getAppPath(), 'node_modules'));
const currentWindow = electron.remote.getCurrentWindow();
Expand Down
4 changes: 3 additions & 1 deletion injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class BrowserWindow extends electron.BrowserWindow {
// Make sure Node integration is enabled
originalOptions.webPreferences.nodeIntegration = true;
// Make sure remote module is enabled
originalOptions.webPreferences.enableRemoteModule = true;
originalOptions.webPreferences.enableRemoteModule = true;
// Make sure context isolation is disabled
originalOptions.webPreferences.contextIsolation = false;
originalOptions.webPreferences.preload = path.join(process.env.injDir, 'dom_shit.js');
originalOptions.webPreferences.transparency = true;

Expand Down
19 changes: 9 additions & 10 deletions plugins/hidden_channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ const Plugin = require('../plugin');

let getChannel, g_dc, g_cat, ha, disp, chanM, fm, reb, sv, cs, csp, ghp, gs, gsr, pf, sw = {}, g = {}, ai = {};

// copied from Discord's minified JS
function N(e,o,l,n){let r;r||(r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103);const t=e&&e.defaultProps,f=arguments.length-3;if(o||0===f||(o={children:void 0}),o&&t)for(const e in t)void 0===o[e]&&(o[e]=t[e]);else o||(o=t||{});if(1===f)o.children=n;else if(f>1){const e=new Array(f);for(let o=0;o<f;o++)e[o]=arguments[o+3];o.children=e}return{$$typeof:r,type:e,key:void 0===l?null:""+l,ref:null,props:o,_owner:null}}

module.exports = new Plugin({
name: 'Hidden Channels',
description: 'Shows hidden channels and lets you view server permissions.',
Expand Down Expand Up @@ -75,11 +72,14 @@ module.exports = new Plugin({
});

const clk = window.EDApi.findModuleByDisplayName("Clickable")
//const icon = window.EDApi.findModuleByDisplayName("Icon");
const Tooltip = window.EDApi.findModule('TooltipContainer').TooltipContainer;
const { Messages } = window.EDApi.findModule('Messages');
const getIcon = window.EDApi.findModule(m => m.id && typeof m.keys === 'function' && m.keys().includes('./Gear'));
const Gear = getIcon('./Gear').default;

reb = window.EDApi.findModule(m => m.default && m.default.prototype && m.default.prototype.renderEditButton).default.prototype;
/*window.EDApi.monkeyPatch(reb, "renderEditButton", function(b) {
return N(clk, {
window.EDApi.monkeyPatch(reb, "renderEditButton", function(b) {
return window.EDApi.React.createElement(Tooltip, { text: Messages.EDIT_CHANNEL }, window.EDApi.React.createElement(clk, {
className: ai.iconItem,
onClick: function() {
module.exports._editingGuild = null;
Expand All @@ -88,13 +88,12 @@ module.exports = new Plugin({
},
onMouseEnter: b.thisObject.props.onMouseEnter,
onMouseLeave: b.thisObject.props.onMouseLeave
}, void 0, N(icon, {
name: "Gear",
}, window.EDApi.React.createElement(Gear, {
width: 16,
height: 16,
className: ai.actionIcon
}));
});*/
})));
});

sv = EDApi.findModuleByDisplayName("SettingsView").prototype;
EDApi.monkeyPatch(sv, 'getPredicateSections', {before: b => {
Expand Down

0 comments on commit 100b18e

Please sign in to comment.