Fixing build, custom css theme, minfied files

This commit is contained in:
Jean Ouina 2020-07-29 18:29:36 +02:00
parent 2dd4315b39
commit 1ac66bf493
18 changed files with 541 additions and 325 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -353,7 +353,7 @@
#bda-qem {
border-radius: 5px 5px 0 0;
background: #2f3136;
background: var(--background-secondary);
border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
height: 30px;
display: flex;
@ -367,7 +367,7 @@
#bda-qem button {
border-left: 1px solid #202225;
background: #2f3136;
background: var(--background-secondary);
box-shadow: rgba(0, 0, 0, 0.1) 1px 0 0 0;
flex-grow: 1;
color: #FFF;
@ -420,7 +420,7 @@
#bda-qem-favourite-container {
width: 384px;
height: 424px;
background-color: #2f3136;
background-color: var(--background-secondary);
border-radius: 0 0 5px 5px;
}
@ -615,13 +615,13 @@
}
#pubslayer h2.ui-form-title {
color: #f6f6f7;
color: var(--header-primary);
text-transform: uppercase;
font-weight: 600;
}
#pubslayer h5.ui-form-title {
color: #f6f6f7;
color: var(--header-primary);
}
#pubslayer button {
@ -641,7 +641,7 @@
}
#pubslayer input {
color: #f6f6f7;
color: var(--header-primary);
background-color: rgba(0, 0, 0, .1);
border-color: rgba(0, 0, 0, .3);
padding: 10px;
@ -666,8 +666,8 @@
.bd-detached-css-editor #bd-customcss-attach-controls button {
margin: 0;
width: 100px;
background: #31332b;
color: #FFF;
background: var(--background-primary);
color: var(--header-primary);
height: 26px;
font-weight: 600;
margin-top: 5px;
@ -676,15 +676,16 @@
.standardSidebarView-3F1I7i #bd-customcss-attach-controls button:hover,
.bd-detached-css-editor #bd-customcss-attach-controls button:hover {
background: #3b3e44;
background: var(--background-primary);
}
.contentRegion-3nDuYy #bd-customcss-attach-controls,
#bd-customcss-detach-container #bd-customcss-attach-controls {
background: #272822;
color: #FFF;
border: none;
box-shadow: 0px 1px 0px 0px #2F3129 inset;
.contentRegion-3nDuYy #bd-customcss-attach-controls,
#bd-customcss-detach-container #bd-customcss-attach-controls {
background: var(--background-secondary-alt);
color: var(--header-primary);
box-shadow: 0px 1px 0px 0px var(--background-secondary-alt) inset;
border: 1px solid var(--background-floating);
border-top: none;
}
@ -696,7 +697,7 @@
}
.standardSidebarView-3F1I7i #editor-detached h3 {
color: #87909c;
color: var(--header-secondary);
font-weight: 600;
font-size: 22px;
}
@ -706,7 +707,7 @@
margin-left: calc(50% - 100px);
margin-top: 20px;
background: var(--bd-blue);
color: #FFF;
color: var(--header-primary);
font-weight: 600;
border-radius: 5px;
font-size: 20px;
@ -727,15 +728,15 @@
.line-numbers {
white-space: pre;
color: gray;
color: var(--text-normal);
padding: 10px 5px 0 5px;
background: #24262a;
background: var(--background-secondary-alt);
overflow: hidden;
}
.ace_editor {
width: 100%;
background: #292B2F;
background: var(--background-secondary);
outline: none;
color: white;
padding: 10px;
@ -763,7 +764,7 @@
top: 0;
right: 0;
bottom: 0;
background-color: #36393e;
background-color: var(--background-primary);
}
#bd-customcss-detach-editor {
@ -776,8 +777,7 @@
}
#bd-customcss-detach-controls {
background: #E8E8E8;
border-top: 1px solid #ADADAD;
background: var(--text-normal);
box-shadow: inset 0px 1px 0px 0px white;
height: 100%;
padding: 5px;
@ -792,8 +792,8 @@
width: 90px;
height: 30px;
margin-top: 8px;
background-color: #738bd7;
color: #fff;
background-color: var(--blurple);
color: var(--header-primary);
font-size: 19px;
}
@ -819,9 +819,9 @@
}
#bd-customcss-attach-controls {
background: #E8E8E8;
border: 1px solid #FFF;
border-top: 1px solid #ADADAD;
background: var(--text-normal);
border: 1px solid var(--header-primary);
border-top: 1px solid var(--text-normal);
box-shadow: inset 0px 1px 0px 0px white;
height: 100%;
padding: 5px;
@ -845,8 +845,8 @@
width: 90px;
height: 30px;
margin-top: 8px;
background-color: #738bd7;
color: #fff;
background-color: var(--blurple);
color: var(--header-primary);
font-size: 19px;
}
@ -872,7 +872,7 @@
body .ace_closeButton::before {
content: "✖";
color: #36393f;
color: var(--background-primary);
}
body .ace_closeButton:active {
@ -880,20 +880,20 @@
}
.theme-dark div #ace_settingsmenu {
color: #f6f6f7;
background: #36393f;
color: var(--header-primary);
background: var(--background-primary);
box-shadow: 0 0 0 1px rgba(32, 34, 37, .6), 0 2px 10px 0 rgba(0, 0, 0, .2);
}
.theme-dark div #ace_settingsmenu select,
.theme-dark div #ace_settingsmenu input[type="text"] {
color: #f6f6f7;
background: #2F3136;
color: var(--header-primary);
background: var(--background-secondary);
border: 1px solid #484B52;
}
.theme-dark div .ace_closeButton::before {
color: #f6f6f7;
color: var(--header-primary);
}
/* editor help text */
@ -904,7 +904,7 @@
}
#bd-customcss-attach-controls .help-text .inline {
background: #31332B;
background: var(--background-secondary);
padding: .2em;
margin: -.2em 0;
border-radius: 3px;
@ -1050,7 +1050,7 @@
}
.theme-dark h2.ui-form-title {
color: #f6f6f7;
color: var(--header-primary);
}
.theme-light h2.ui-form-title {
@ -1070,7 +1070,7 @@
}
.theme-dark .ui-switch-item h3 {
color: #f6f6f7;
color: var(--header-primary);
}
.theme-light .ui-switch-item h3 {
@ -1136,7 +1136,7 @@
top: 3px;
left: 3px;
bottom: 3px;
background: #f6f6f7;
background: var(--header-primary);
border-radius: 10px;
transition: all .15s ease;
box-shadow: 0 3px 1px 0 rgba(0, 0, 0, .05), 0 2px 2px 0 rgba(0, 0, 0, .1), 0 3px 3px 0 rgba(0, 0, 0, .05);
@ -1208,7 +1208,7 @@
.theme-dark .bd-addon-list .bd-addon-card {
background-color: rgba(32, 34, 37, .6);
color: #f6f6f7;
color: var(--header-primary);
border-color: #202225;
}
@ -1235,7 +1235,7 @@
}
.theme-dark .bd-addon-list .bda-header {
color: #f6f6f7;
color: var(--header-primary);
border-bottom-color: rgba(114, 118, 125, .3);
}
@ -1428,7 +1428,7 @@
}
.bd-modal-wrapper .bd-modal-body {
background-color: #36393f;
background-color: var(--background-primary);
color: #fff;
flex-direction: row;
overflow: hidden;
@ -1595,7 +1595,7 @@
.bd-toast {
animation: bd-toast-up 300ms ease;
transform: translateY(-10px);
background: #36393F;
background: var(--background-primary);
padding: 10px;
border-radius: 5px;
box-shadow: 0 0 0 1px rgba(32, 34, 37, .6), 0 2px 10px 0 rgba(0, 0, 0, .2);
@ -1970,7 +1970,7 @@
/* add/create server */
.bda-dark .theme-dark .root-1gCeng,
.bda-dark .slide-2pHaq5 {
background: #36393f;
background: var(--background-primary);
}
.bda-dark .root-1gCeng .input-1mgnkM {
@ -1980,18 +1980,18 @@
.bda-dark .theme-dark .theme-dark .action-1lSjCi,
.bda-dark .theme-dark .theme-light .action-1lSjCi {
background: #2F3136;
background: var(--background-secondary);
}
.bda-dark .theme-dark .theme-light .footer-3rDWdC {
background: #2f3136;
background: var(--background-secondary);
box-shadow: none;
}
/* centered or */
.bda-dark .theme-dark .theme-dark .or-3THJsp,
.bda-dark .theme-dark .theme-light .or-3THJsp {
background: #2F3136;
background: var(--background-secondary);
order: 2;
height: 56px;
width: 56px;
@ -2016,16 +2016,16 @@
}
.bda-dark .theme-dark .theme-light .footer-2yfCgX {
background: #2F3136;
background: var(--background-secondary);
}
/* Region Select */
.bda-dark .theme-dark .regionSelectModal-12e-57 {
background: #36393f;
background: var(--background-primary);
}
.bda-dark .theme-dark .regionSelectModal-12e-57 .regionSelectModalOption-2DSIZ3 {
background: #2F3136;
background: var(--background-secondary);
border: 2px solid #484B52;
}
@ -2143,7 +2143,7 @@
}
.bd-select-wrapper {
color: #f6f6f7;
color: var(--header-primary);
font-size: 13px;
display: flex;
align-items: center;
@ -2157,7 +2157,7 @@
.bd-select {
position: relative;
cursor: pointer;
color: #f6f6f7;
color: var(--header-primary);
font-size: 13px;
display: flex;
align-items: center;
@ -2184,7 +2184,7 @@
.bd-select .bd-select-options {
position: absolute;
background: #2F3136;
background: var(--background-secondary);
border-radius: 0 0 3px 3px;
max-height: 300px;
min-width: calc(100% + 2px);

File diff suppressed because one or more lines are too long

View File

@ -263,8 +263,9 @@ export default new class ContentManager {
try {window.require(path.resolve(baseFolder, filename));}
catch (error) {return {name: filename, file: filename, message: "Could not be compiled.", error: {message: error.message, stack: error.stack}};}
const content = window.require(path.resolve(baseFolder, filename));
if(!content.name)return {name: filename, file: filename, message: "Cannot escape the ID.", error: {message: "Cannot read property 'replace' of undefined", stack: "Cannot read property 'replace' of undefined"}}
if(!content.name)return {name: filename, file: filename, message: "Cannot escape the ID.", error: new Error("Cannot read property 'replace' of undefined")}
content.id = Utils.escapeID(content.name);
//if(!id)return {name: filename, file: filename, message: "Invalid ID", error: new Error("Please fix the name of "+filename+". BetterDiscord can't escape an ID.")}
if (isPlugin) {
if (!content.type) return;
try {

View File

@ -2,7 +2,6 @@ import {bbdVersion} from "../0globals";
import WebpackModules from "./webpackModules";
import BDV2 from "./v2";
import DOM from "./domtools";
export default class Utils {
/** Document/window width */
static get screenWidth() { return Math.max(document.documentElement.clientWidth, window.innerWidth || 0); }
@ -40,7 +39,7 @@ export default class Utils {
}
static getTextArea() {
return DOM.query("."+this.removeDa(BDModules.get(e => e.channelTextArea && e.titleWrapper)[0].channelTextArea)+" textarea");
return DOM.query("."+removeDa(BDModules.get(e => e.channelTextArea && e.titleWrapper)[0].channelTextArea)+" textarea");
}
static insertText(textarea, text) {
@ -201,8 +200,8 @@ export default class Utils {
*/
static showToast(content, options = {}) {
if (!document.querySelector(".bd-toasts")) {
const container = document.querySelector("."+this.removeDa(BDModules.get(e => e.sidebar && e.hasNotice)[0].sidebar)+" + div") || null;
const memberlist = container ? container.querySelector("."+this.removeDa(BDModules.get(e => e.membersWrap)[0].membersWrap)) : null;
const container = document.querySelector("."+removeDa(BDModules.get(e => e.sidebar && e.hasNotice)[0].sidebar)+" + div") || null;
const memberlist = container ? container.querySelector("."+removeDa(BDModules.get(e => e.membersWrap)[0].membersWrap)) : null;
const form = container ? container.querySelector("form") : null;
const left = container ? container.getBoundingClientRect().left : 310;
const right = memberlist ? memberlist.getBoundingClientRect().left : 0;
@ -482,12 +481,16 @@ export default class Utils {
}, {modalKey: key});
}
static removeDa(className){
if(!className)return className
return className.split(" ").filter(e => !e.startsWith("da-")).join(" ")
static get removeDa(){
return removeDa
}
}
function removeDa(className){
if(!className)return className
return className.split(" ").filter(e => !e.startsWith("da-")).join(" ")
}
Utils.showToast = Utils.suppressErrors(Utils.showToast, "Could not show toast.");
window.Lightcord.BetterDiscord.Utils = Utils

View File

@ -353,7 +353,7 @@
#bda-qem {
border-radius: 5px 5px 0 0;
background: #2f3136;
background: var(--background-secondary);
border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
height: 30px;
display: flex;
@ -367,7 +367,7 @@
#bda-qem button {
border-left: 1px solid #202225;
background: #2f3136;
background: var(--background-secondary);
box-shadow: rgba(0, 0, 0, 0.1) 1px 0 0 0;
flex-grow: 1;
color: #FFF;
@ -420,7 +420,7 @@
#bda-qem-favourite-container {
width: 384px;
height: 424px;
background-color: #2f3136;
background-color: var(--background-secondary);
border-radius: 0 0 5px 5px;
}
@ -615,13 +615,13 @@
}
#pubslayer h2.ui-form-title {
color: #f6f6f7;
color: var(--header-primary);
text-transform: uppercase;
font-weight: 600;
}
#pubslayer h5.ui-form-title {
color: #f6f6f7;
color: var(--header-primary);
}
#pubslayer button {
@ -641,7 +641,7 @@
}
#pubslayer input {
color: #f6f6f7;
color: var(--header-primary);
background-color: rgba(0, 0, 0, .1);
border-color: rgba(0, 0, 0, .3);
padding: 10px;
@ -666,8 +666,8 @@
.bd-detached-css-editor #bd-customcss-attach-controls button {
margin: 0;
width: 100px;
background: #31332b;
color: #FFF;
background: var(--background-primary);
color: var(--header-primary);
height: 26px;
font-weight: 600;
margin-top: 5px;
@ -676,15 +676,16 @@
.standardSidebarView-3F1I7i #bd-customcss-attach-controls button:hover,
.bd-detached-css-editor #bd-customcss-attach-controls button:hover {
background: #3b3e44;
background: var(--background-primary);
}
.contentRegion-3nDuYy #bd-customcss-attach-controls,
#bd-customcss-detach-container #bd-customcss-attach-controls {
background: #272822;
color: #FFF;
border: none;
box-shadow: 0px 1px 0px 0px #2F3129 inset;
.contentRegion-3nDuYy #bd-customcss-attach-controls,
#bd-customcss-detach-container #bd-customcss-attach-controls {
background: var(--background-secondary-alt);
color: var(--header-primary);
box-shadow: 0px 1px 0px 0px var(--background-secondary-alt) inset;
border: 1px solid var(--background-floating);
border-top: none;
}
@ -696,7 +697,7 @@
}
.standardSidebarView-3F1I7i #editor-detached h3 {
color: #87909c;
color: var(--header-secondary);
font-weight: 600;
font-size: 22px;
}
@ -706,7 +707,7 @@
margin-left: calc(50% - 100px);
margin-top: 20px;
background: var(--bd-blue);
color: #FFF;
color: var(--header-primary);
font-weight: 600;
border-radius: 5px;
font-size: 20px;
@ -727,15 +728,15 @@
.line-numbers {
white-space: pre;
color: gray;
color: var(--text-normal);
padding: 10px 5px 0 5px;
background: #24262a;
background: var(--background-secondary-alt);
overflow: hidden;
}
.ace_editor {
width: 100%;
background: #292B2F;
background: var(--background-secondary);
outline: none;
color: white;
padding: 10px;
@ -763,7 +764,7 @@
top: 0;
right: 0;
bottom: 0;
background-color: #36393e;
background-color: var(--background-primary);
}
#bd-customcss-detach-editor {
@ -776,8 +777,7 @@
}
#bd-customcss-detach-controls {
background: #E8E8E8;
border-top: 1px solid #ADADAD;
background: var(--text-normal);
box-shadow: inset 0px 1px 0px 0px white;
height: 100%;
padding: 5px;
@ -792,8 +792,8 @@
width: 90px;
height: 30px;
margin-top: 8px;
background-color: #738bd7;
color: #fff;
background-color: var(--blurple);
color: var(--header-primary);
font-size: 19px;
}
@ -819,9 +819,9 @@
}
#bd-customcss-attach-controls {
background: #E8E8E8;
border: 1px solid #FFF;
border-top: 1px solid #ADADAD;
background: var(--text-normal);
border: 1px solid var(--header-primary);
border-top: 1px solid var(--text-normal);
box-shadow: inset 0px 1px 0px 0px white;
height: 100%;
padding: 5px;
@ -845,8 +845,8 @@
width: 90px;
height: 30px;
margin-top: 8px;
background-color: #738bd7;
color: #fff;
background-color: var(--blurple);
color: var(--header-primary);
font-size: 19px;
}
@ -872,7 +872,7 @@
body .ace_closeButton::before {
content: "✖";
color: #36393f;
color: var(--background-primary);
}
body .ace_closeButton:active {
@ -880,20 +880,20 @@
}
.theme-dark div #ace_settingsmenu {
color: #f6f6f7;
background: #36393f;
color: var(--header-primary);
background: var(--background-primary);
box-shadow: 0 0 0 1px rgba(32, 34, 37, .6), 0 2px 10px 0 rgba(0, 0, 0, .2);
}
.theme-dark div #ace_settingsmenu select,
.theme-dark div #ace_settingsmenu input[type="text"] {
color: #f6f6f7;
background: #2F3136;
color: var(--header-primary);
background: var(--background-secondary);
border: 1px solid #484B52;
}
.theme-dark div .ace_closeButton::before {
color: #f6f6f7;
color: var(--header-primary);
}
/* editor help text */
@ -904,7 +904,7 @@
}
#bd-customcss-attach-controls .help-text .inline {
background: #31332B;
background: var(--background-secondary);
padding: .2em;
margin: -.2em 0;
border-radius: 3px;
@ -1050,7 +1050,7 @@
}
.theme-dark h2.ui-form-title {
color: #f6f6f7;
color: var(--header-primary);
}
.theme-light h2.ui-form-title {
@ -1070,7 +1070,7 @@
}
.theme-dark .ui-switch-item h3 {
color: #f6f6f7;
color: var(--header-primary);
}
.theme-light .ui-switch-item h3 {
@ -1136,7 +1136,7 @@
top: 3px;
left: 3px;
bottom: 3px;
background: #f6f6f7;
background: var(--header-primary);
border-radius: 10px;
transition: all .15s ease;
box-shadow: 0 3px 1px 0 rgba(0, 0, 0, .05), 0 2px 2px 0 rgba(0, 0, 0, .1), 0 3px 3px 0 rgba(0, 0, 0, .05);
@ -1208,7 +1208,7 @@
.theme-dark .bd-addon-list .bd-addon-card {
background-color: rgba(32, 34, 37, .6);
color: #f6f6f7;
color: var(--header-primary);
border-color: #202225;
}
@ -1235,7 +1235,7 @@
}
.theme-dark .bd-addon-list .bda-header {
color: #f6f6f7;
color: var(--header-primary);
border-bottom-color: rgba(114, 118, 125, .3);
}
@ -1428,7 +1428,7 @@
}
.bd-modal-wrapper .bd-modal-body {
background-color: #36393f;
background-color: var(--background-primary);
color: #fff;
flex-direction: row;
overflow: hidden;
@ -1595,7 +1595,7 @@
.bd-toast {
animation: bd-toast-up 300ms ease;
transform: translateY(-10px);
background: #36393F;
background: var(--background-primary);
padding: 10px;
border-radius: 5px;
box-shadow: 0 0 0 1px rgba(32, 34, 37, .6), 0 2px 10px 0 rgba(0, 0, 0, .2);
@ -1970,7 +1970,7 @@
/* add/create server */
.bda-dark .theme-dark .root-1gCeng,
.bda-dark .slide-2pHaq5 {
background: #36393f;
background: var(--background-primary);
}
.bda-dark .root-1gCeng .input-1mgnkM {
@ -1980,18 +1980,18 @@
.bda-dark .theme-dark .theme-dark .action-1lSjCi,
.bda-dark .theme-dark .theme-light .action-1lSjCi {
background: #2F3136;
background: var(--background-secondary);
}
.bda-dark .theme-dark .theme-light .footer-3rDWdC {
background: #2f3136;
background: var(--background-secondary);
box-shadow: none;
}
/* centered or */
.bda-dark .theme-dark .theme-dark .or-3THJsp,
.bda-dark .theme-dark .theme-light .or-3THJsp {
background: #2F3136;
background: var(--background-secondary);
order: 2;
height: 56px;
width: 56px;
@ -2016,16 +2016,16 @@
}
.bda-dark .theme-dark .theme-light .footer-2yfCgX {
background: #2F3136;
background: var(--background-secondary);
}
/* Region Select */
.bda-dark .theme-dark .regionSelectModal-12e-57 {
background: #36393f;
background: var(--background-primary);
}
.bda-dark .theme-dark .regionSelectModal-12e-57 .regionSelectModalOption-2DSIZ3 {
background: #2F3136;
background: var(--background-secondary);
border: 2px solid #484B52;
}
@ -2143,7 +2143,7 @@
}
.bd-select-wrapper {
color: #f6f6f7;
color: var(--header-primary);
font-size: 13px;
display: flex;
align-items: center;
@ -2157,7 +2157,7 @@
.bd-select {
position: relative;
cursor: pointer;
color: #f6f6f7;
color: var(--header-primary);
font-size: 13px;
display: flex;
align-items: center;
@ -2184,7 +2184,7 @@
.bd-select .bd-select-options {
position: absolute;
background: #2F3136;
background: var(--background-secondary);
border-radius: 0 0 3px 3px;
max-height: 300px;
min-width: calc(100% + 2px);

View File

@ -33,7 +33,7 @@ export default class V2C_CssEditor extends BDV2.reactComponent {
componentDidMount() {
// this.updateLineCount();
this.editor = ace.edit("bd-customcss-editor");
this.editor.setTheme("ace/theme/monokai");
this.editor.setTheme("ace/theme/discord");
this.editor.session.setMode("ace/mode/css");
this.editor.setShowPrintMargin(false);
this.editor.setFontSize(14);

View File

@ -23,7 +23,7 @@ export default class V2C_CssEditorDetached extends BDV2.reactComponent {
BDV2.editorDetached = true;
// this.updateLineCount();
this.editor = ace.edit("bd-customcss-editor-detached");
this.editor.setTheme("ace/theme/monokai");
this.editor.setTheme("ace/theme/discord");
this.editor.session.setMode("ace/mode/css");
this.editor.setShowPrintMargin(false);
this.editor.setFontSize(14);

View File

@ -10,10 +10,10 @@
"author": "jeanouina",
"license": "ISC",
"dependencies": {
"@discordjs/collection": "^0.1.5",
"ts-loader": "^7.0.5"
"@discordjs/collection": "0.1.5"
},
"devDependencies": {
"typescript": "^3.9.5"
"typescript": "^3.9.5",
"ts-loader": "^7.0.5"
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,35 +0,0 @@
/**
* @name LightcordApiExemple
*/
module.exports = class LightcordApiExemple {
getName() {return "LightcordApiExemple";} // Name of your plugin to show on the plugins page
getDescription() {return "Describe the basic functions. Maybe a support server link.";} // Description to show on the plugins page
getVersion() {return "0.0.1";} // Current version. I recommend following semantic versioning <http://semver.org/> (e.g. 0.0.1)
getAuthor() {return "Not Thomiz";} // Your name
load() {} // Called when the plugin is loaded in to memory
start() {
if(!("Lightcord" in window) || !("Api" in window.Lightcord)){
bdApi.showToast("This plugin only works in Lightcord.")
return
}
console.log(`LightcordAPI is availaible !`)
} // Called when the plugin is activated (including after reloads)
stop() {} // Called when the plugin is deactivated
observer(changes) {} // Observer for the `document`. Better documentation than I can provide is found here: <https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver>
getSettingsPanel(){
const Markdown = BDModules.get(e => e.default && e.default.displayName === "Markdown")[0].default
let settings = Markdown.prototype.render.call({
props: Object.assign({
className: "",
children: "> warn\n> sltsv"
}, Markdown.defaultProps)
})
return window.Lightcord.Api.Utils.ReactToHTML(settings)
}
}

View File

@ -1,6 +1,7 @@
import Utils from "./Utils"
import Notices, { notices } from "../components/private/Notices"
import { isNative } from "./environnement";
import WebpackLoader from "./WebpackLoader";
export function patch(){
/** START NOTICE */
@ -101,6 +102,96 @@ export function patch(){
}
})
/** END USERPROFILE PATCH */
/** START WEBHOOK PATCH */
/*
let usedWebhooks = {}
getModule(e => e && e.Request && e.Request.prototype && e.Request.prototype.end)
.then(RequestModule => {
const end = RequestModule.Request.prototype.end
RequestModule.Request.prototype.end = function(){
if(this.url.endsWith("/messages") && /\/channels\/\d+\/messages/g.test(this.url) && this.method === "POST"){ // sending message
let channelId = this.url.split("/channels/")[1].split("/messages")[0]
if(usedWebhooks[channelId]){ // webhook is availlable
let webhook = usedWebhooks[channelId]
let url = `/webhooks/${webhook.id}/${webhook.token}?wait=true`
this.url = url
}
}
return end.call(this, ...arguments)
}
})
getModule(e => e.default && e.default.displayName === "Webhook")
.then(webhookComponent => {
const renderEdit = webhookComponent.default.prototype.renderEdit
webhookComponent.default.prototype.renderEdit = function(){
const webhook = this.props.webhook
let returnValue = renderEdit.call(this, ...arguments)
returnValue.props.children = [returnValue.props.children]
let message = usedWebhooks[webhook.channel_id] && usedWebhooks[webhook.channel_id].id === webhook.id ? "Stop talking with this webhook" : "Talk with this webhook"
returnValue.props.children.push(React.createElement(window.Lightcord.Api.Components.inputs.Button, {color: "green", wrapper: false, onClick(){
if(usedWebhooks[webhook.channel_id] && usedWebhooks[webhook.channel_id].id === webhook.id){
delete usedWebhooks[webhook.channel_id]
}else{
usedWebhooks[webhook.channel_id] = {
id: webhook.id,
token: webhook.token
}
}
webhookPanels.forEach(e => e())
}}, message))
return returnValue
}
})
let webhookPanels = []
let getComp = (comp) => {
class SettingsWebhooks extends React.PureComponent {
constructor(props){
super(props)
}
componentWillMount(){
this.id = uuid()
this.component = new comp(this.props)
let func = () => {
this.component.forceUpdate()
}
func.id = this.id
webhookPanels.push(func)
}
componentWillUnmount(){
this.component = null
webhookPanels = webhookPanels.filter(e => e.id !== this.id)
}
render(){
return this.component.render()
}
static displayName = "SettingsWebhooks"
}
return SettingsWebhooks
}
getModule(e => e.default && e.default.displayName === "FluxContainer(SettingsWebhooks)")
.then(webhooksComponents => {
let comp = webhooksComponents.default
webhooksComponents.default = getComp(comp)
WebpackLoader.find(e => e.default && e.default.displayName === "FluxContainer(FluxContainer(SettingsWebhooks))")
.forEach(mod => {
mod.default = getComp(mod.default)
})
})*/
/** END WEBHOOK PATCH */
}
// TODO: Add in app-notifications / confirmations.

View File

@ -16,31 +16,33 @@ A simple - customizable - Discord Client
## What's this ?
[Lightcord](https://lightcord.github.io) is a simple and customizable client for Discord.
It includes [BandagedBD](https://github.com/rauenzi/BetterDiscordApp), [Glasstron](https://github.com/AryToNeX/Glasstron) and a discord.js like api.
It includes [BandagedBD](https://github.com/rauenzi/BetterDiscordApp), [Glasstron](https://github.com/AryToNeX/Glasstron) and a [discord.js-like api](https://github.com/Lightcord/Lightcord/tree/master/DiscordJS).
## Informations
Lightcord doesn't *patch* Discord with it's content. If it was, Discord would update itself and break the patch. That's why Lightcord is a standalone Discord client. Just grab the latest release version you need, and launch it !
Lightcord doesn't *patch* Discord with it's content. If it was, Discord could update itself and break the patch. That's why Lightcord is a standalone Discord client. Just grab the latest release version you need, and launch it !
## Installing
You can download a release from the [releases tab](https://github.com/Lightcord/Lightcord/releases).
If you want to run it from source, follow these instructions:
## Running from source
Prequeresites: Node.js, NPM
To run from source, follow these instructions:
```sh
git clone https://github.com/Lightcord/Lightcord
cd Lightcord
npm i
npm run devInstall
npm run test
npm test
```
*You will have to do that everytime you pull/clone*
<br/>
Discord will launch next. You can see you have done it right by looking at the icon.
Lightcord will launch next. You can see you have done it right by looking at the icon.
![icon](https://github.com/Lightcord/Lightcord/blob/master/imagery/68747470733a2f2f692e696d6775722e636f6d2f72486e73504e4f2e706e67.png?raw=true)
<br />
Then everytime you want to launch it just type in
```sh
npm run run
```
*You can find an experimental linux tutorial in our Discord, or use the AUR*
## AUR (unofficial)

View File

@ -31,16 +31,47 @@ async function main(){
async function processNextDir(folder, folders, predicate, compile, ignoreModules){
if(typeof ignoreModules === "undefined")ignoreModules = false
for(let file of fs.readdirSync(folder, {withFileTypes: true})){
let files = fs.readdirSync(folder, {withFileTypes: true})
for(let file of files){
if(file.isFile()){
let isMinified = file.name.endsWith(".min.js") || file.name.endsWith(".min.css")
let filepath = path.join(folder, file.name)
if(predicate(filepath) && filepath.split(/[\\/]+/).reverse()[1] !== "js"){
let type = file.name.split(".").pop().toLowerCase()
if(type === file.name)type = ""
if([
"ts",
"md",
"gitignore"
].includes(type)){
console.warn(`\x1b[33mIgnored file ${path.relative(folders.startDir, filepath)} because of type ${type}\x1b[0m`)
continue
}
if([
"tsconfig.json",
"webpack.config.js"
].includes(file.name)){
console.warn(`\x1b[33mIgnored file ${path.relative(folders.startDir, filepath)} because of name ${file.name}\x1b[0m`)
continue
}
if(folders.exclude && folders.exclude.test(filepath)){
console.warn(`\x1b[33mIgnored file ${path.relative(folders.startDir, filepath)} because regex\x1b[0m`)
continue
}
let hasMinifiedVersion = (type === "js" || type === "css") && !isMinified && files.find(f => {
return f.name === file.name.split(".").slice(0, -1).join(".")+".min."+type
})
if(hasMinifiedVersion){
console.warn(`\x1b[33mIgnored file ${path.relative(folders.startDir, filepath)} because it has a minified version.\x1b[0m`)
continue
}
if(!isMinified && predicate(filepath) && filepath.split(/[\\/]+/).reverse()[1] !== "js"){
await compile(filepath, path.join(filepath.replace(folders.startDir, folders.newDir)), "..")
}else{
await fs.promises.copyFile(filepath, filepath.replace(folders.startDir, folders.newDir))
}
}else if(file.isDirectory()){
if(ignoreModules && file.name === "node_modules")continue
if(folders.exclude && folders.exclude.test(path.join(folder, file.name)))continue
await fs.promises.mkdir(path.join(folder, file.name).replace(folders.startDir, folders.newDir), {recursive: true})
await processNextDir(path.join(folder, file.name), ...Array.from(arguments).slice(1))
}
@ -61,7 +92,7 @@ async function main(){
}
}).then(() => {
console.info(`Copied files and minified them from ${startDir}.`)
}).catch(console.error)
})
await processNextDir(path.join(__dirname, "modules"), {
startDir: path.join(__dirname, "modules"),
@ -94,53 +125,51 @@ async function main(){
await processNextDir(path.join(__dirname, "LightcordApi"), {
startDir: path.join(__dirname, "LightcordApi"),
newDir: path.join(__dirname, "distApp", "LightcordApi")
newDir: path.join(__dirname, "distApp", "LightcordApi"),
exclude: /(src|webpack\.config\.js|tsconfig\.json|dist)/g
}, ((filepath) => filepath.endsWith(".js") && (!production ? !filepath.includes("node_modules") : true)), async (filepath, newpath) => {
if(filepath.includes("node_modules"))return // don't minify node_modules, and don't include them at all. Installing later
console.info(`Minifying ${filepath} to ${newpath}`)
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
}).then(() => {
}, true).then(() => {
console.info(`Copied files and minified them from ${path.join(__dirname, "LightcordApi")}.`)
})
await fs.promises.rmdir(path.join(__dirname, "distApp", "LightcordApi", "src"), {"recursive": true})
await fs.promises.rmdir(path.join(__dirname, "distApp", "LightcordApi", "dist"), {"recursive": true})
await fs.promises.unlink(path.join(__dirname, "distApp", "LightcordApi", "webpack.config.js"))
await fs.promises.unlink(path.join(__dirname, "distApp", "LightcordApi", "tsconfig.json"))
console.log(child_process.execSync("npm install --only=prod", {
encoding: "binary",
cwd: path.join(__dirname, "distApp", "LightcordApi")
}))
await processNextDir(path.join(__dirname, "DiscordJS"), {
startDir: path.join(__dirname, "DiscordJS"),
newDir: path.join(__dirname, "distApp", "DiscordJS")
}, ((filepath) => filepath.endsWith(".js") && (!production ? !filepath.includes("node_modules") : true)), async (filepath, newpath) => {
if(filepath.includes("node_modules"))return // don't minify node_modules, and don't include them at all
console.info(`Minifying ${filepath} to ${newpath}`)
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
}).then(() => {
console.info(`Copied files and minified them from ${path.join(__dirname, "DiscordJS")}.`)
})
function processDJS(dir){
fs.mkdirSync(path.join(__dirname, "distApp", "DiscordJS", dir), {recursive: true})
return processNextDir(path.join(__dirname, "DiscordJS", dir), {
startDir: path.join(__dirname, "DiscordJS", dir),
newDir: path.join(__dirname, "distApp", "DiscordJS", dir)
}, ((filepath) => filepath.endsWith(".js") && (!production ? !filepath.includes("node_modules") : true)), async (filepath, newpath) => {
if(filepath.includes("node_modules"))return // don't minify node_modules, and don't include them at all
console.info(`Minifying ${filepath} to ${newpath}`)
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
}).then(() => {
console.info(`Copied files and minified them from ${path.join(__dirname, "DiscordJS", dir)}.`)
})
}
async function copyFileDJS(file){
await fs.promises.writeFile(path.join(__dirname, "distApp", "DiscordJS", file), await fs.promises.readFile(path.join(__dirname, "DiscordJS", file)))
}
await fs.promises.rmdir(path.join(__dirname, "distApp", "DiscordJS", "src"), {"recursive": true})
await fs.promises.unlink(path.join(__dirname, "distApp", "DiscordJS", "webpack.config.js"))
await fs.promises.unlink(path.join(__dirname, "distApp", "DiscordJS", "tsconfig.json"))
await processDJS("dist")
await copyFileDJS("package.json")
console.log(child_process.execSync("npm install --only=prod", {
encoding: "binary",
cwd: path.join(__dirname, "distApp", "LightcordApi")
cwd: path.join(__dirname, "distApp", "DiscordJS")
}))
fs.mkdirSync(path.join(__dirname, "distApp", "BetterDiscordApp", "js"), {recursive: true})
fs.mkdirSync(path.join(__dirname, "distApp", "BetterDiscordApp", "css"), {recursive: true})
fs.mkdirSync(path.join(__dirname, "distApp", "BetterDiscordApp", "dist"), {recursive: true})
const BDPackageJSON = require("./BetterDiscordApp/package.json")
fs.writeFileSync(path.join(__dirname, "distApp", "BetterDiscordApp", "package.json"), JSON.stringify(BDPackageJSON), "utf8")
fs.writeFileSync(path.join(__dirname, "distApp", "BetterDiscordApp", "css", "main.css"), fs.readFileSync(path.join(__dirname, "BetterDiscordApp", "css", "main.css")))
fs.writeFileSync(path.join(__dirname, "distApp", "BetterDiscordApp", "css", "main.min.css"), fs.readFileSync(path.join(__dirname, "BetterDiscordApp", "css", "main.min.css")))
fs.writeFileSync(path.join(__dirname, "distApp", "BetterDiscordApp", "js", "main.js"), fs.readFileSync(path.join(__dirname, "BetterDiscordApp", "js", "main.js")))
fs.writeFileSync(path.join(__dirname, "distApp", "BetterDiscordApp", "js", "main.min.js"), fs.readFileSync(path.join(__dirname, "BetterDiscordApp", "js", "main.min.js")))
fs.writeFileSync(path.join(__dirname, "distApp", "BetterDiscordApp", "dist", "style.min.css"), fs.readFileSync(path.join(__dirname, "BetterDiscordApp", "dist", "style.min.css")))
fs.writeFileSync(path.join(__dirname, "distApp", "BetterDiscordApp", "dist", "index.min.js"), fs.readFileSync(path.join(__dirname, "BetterDiscordApp", "dist", "index.min.js")))
await fs.promises.mkdir(path.join(__dirname, "distApp", "splash", "videos"), {recursive: true})
await processNextDir(path.join(__dirname, "splash"), {
@ -155,9 +184,11 @@ async function main(){
}).then(() => {
console.info(`Copied files and minified them from ${path.join(__dirname, "splash")}.`)
})
fs.writeFileSync(path.join(__dirname, "distApp", "LICENSE"), fs.readFileSync(path.join(__dirname, "LICENSE")))
let packageJSON = require("./package.json")
packageJSON.scripts.build = packageJSON.scripts.build.replace("./distApp", ".")
packageJSON.scripts["build:electron_linux"] = packageJSON.scripts["build:electron_linux"].replace("./distApp", ".")
packageJSON.scripts["build:electron_win"] = packageJSON.scripts["build:electron_win"].replace("./distApp", ".")
fs.writeFileSync(path.join(__dirname, "distApp", "package.json"), JSON.stringify(packageJSON), "utf8")
@ -167,4 +198,8 @@ async function main(){
cwd: path.join(__dirname, "distApp")
}))
}
main()
main()
.catch(err => {
console.error(err)
process.exit(1)
})

View File

@ -10782,8 +10782,135 @@
var n = new o(e, t);
return n.setUndoManager(new u), n
}, t.EditSession = o, t.UndoManager = u, t.version = "1.2.9"
}), define("ace/theme/monokai", ["require", "exports", "module", "ace/lib/dom"], function(e, t, n) {
t.isDark = !0, t.cssClass = "ace-monokai", t.cssText = ".ace-monokai .ace_gutter {background: #2F3129;color: #8F908A}.ace-monokai .ace_print-margin {width: 1px;background: #555651}.ace-monokai {background-color: #272822;color: #F8F8F2}.ace-monokai .ace_cursor {color: #F8F8F0}.ace-monokai .ace_marker-layer .ace_selection {background: #49483E}.ace-monokai.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #272822;}.ace-monokai .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-monokai .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #49483E}.ace-monokai .ace_marker-layer .ace_active-line {background: #202020}.ace-monokai .ace_gutter-active-line {background-color: #272727}.ace-monokai .ace_marker-layer .ace_selected-word {border: 1px solid #49483E}.ace-monokai .ace_invisible {color: #52524d}.ace-monokai .ace_entity.ace_name.ace_tag,.ace-monokai .ace_keyword,.ace-monokai .ace_meta.ace_tag,.ace-monokai .ace_storage {color: #F92672}.ace-monokai .ace_punctuation,.ace-monokai .ace_punctuation.ace_tag {color: #fff}.ace-monokai .ace_constant.ace_character,.ace-monokai .ace_constant.ace_language,.ace-monokai .ace_constant.ace_numeric,.ace-monokai .ace_constant.ace_other {color: #AE81FF}.ace-monokai .ace_invalid {color: #F8F8F0;background-color: #F92672}.ace-monokai .ace_invalid.ace_deprecated {color: #F8F8F0;background-color: #AE81FF}.ace-monokai .ace_support.ace_constant,.ace-monokai .ace_support.ace_function {color: #66D9EF}.ace-monokai .ace_fold {background-color: #A6E22E;border-color: #F8F8F2}.ace-monokai .ace_storage.ace_type,.ace-monokai .ace_support.ace_class,.ace-monokai .ace_support.ace_type {font-style: italic;color: #66D9EF}.ace-monokai .ace_entity.ace_name.ace_function,.ace-monokai .ace_entity.ace_other,.ace-monokai .ace_entity.ace_other.ace_attribute-name,.ace-monokai .ace_variable {color: #A6E22E}.ace-monokai .ace_variable.ace_parameter {font-style: italic;color: #FD971F}.ace-monokai .ace_string {color: #E6DB74}.ace-monokai .ace_comment {color: #75715E}.ace-monokai .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y}";
}), define("ace/theme/discord", ["require", "exports", "module", "ace/lib/dom"], function(e, t, n) {
//TODO: Finish discord theme for custom css.
t.isDark = !0, t.cssClass = "ace-discord", t.cssText = `
.ace-discord {
background-color: var(--background-secondary);
color: var(--text-normal);
border: 1px solid var(--background-floating);
border-bottom: none
}
.ace-discord .ace_gutter {
background: var(--background-secondary-alt);
color: var(--text-normal);
}
.ace-discord .ace_print-margin {
width: 1px;
background: none;
}
.ace-discord .ace_marker-layer .ace_active-line {
background: var(--background-tertiary);
}
.ace-discord .ace_gutter-active-line {
background-color: var(--background-tertiary);
}
.ace-discord .ace_text-layer {
color: var(--text-normal);
}
.ace-discord .ace_cursor {
color: var(--text-normal)
}
.ace-discord .ace_marker-layer .ace_selection {
background: var(--background-accent)
}
.ace-discord.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px var(--background-secondary);
}
.ace-discord .ace_marker-layer .ace_step {
background: rgb(102, 82, 0)
}
.ace-discord .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid var(--background-primary)
}
.ace-discord .ace_marker-layer .ace_selected-word {
border: 1px solid var(--background-primary)
}
.ace-discord .ace_invisible {
color: var(--text-muted)
}
.ace-discord .ace_entity.ace_name.ace_tag,
.ace-discord .ace_keyword,
.ace-discord .ace_meta.ace_tag,
.ace-discord .ace_storage {
color: #F92672
}
.ace-discord .ace_punctuation,
.ace-discord .ace_punctuation.ace_tag {
color: #fff
}
.ace-discord .ace_constant.ace_character,
.ace-discord .ace_constant.ace_language,
.ace-discord .ace_constant.ace_numeric,
.ace-discord .ace_constant.ace_other {
color: #AE81FF
}
.ace-discord .ace_invalid {
color: #F8F8F0;
background-color: #F92672
}
.ace-discord .ace_invalid.ace_deprecated {
color: #F8F8F0;
background-color: #AE81FF
}
.ace-discord .ace_support.ace_constant,
.ace-discord .ace_support.ace_function {
color: #66D9EF
}
.ace-discord .ace_fold {
background-color: #A6E22E;
border-color: #F8F8F2
}
.ace-discord .ace_storage.ace_type,
.ace-discord .ace_support.ace_class,
.ace-discord .ace_support.ace_type {
font-style: italic;
color: #66D9EF
}
.ace-discord .ace_entity.ace_name.ace_function,
.ace-discord .ace_entity.ace_other,
.ace-discord .ace_entity.ace_other.ace_attribute-name,
.ace-discord .ace_variable {
color: #A6E22E
}
.ace-discord .ace_variable.ace_parameter {
font-style: italic;
color: #FD971F
}
.ace-discord .ace_string {
color: #E6DB74
}
.ace-discord .ace_comment {
color: #75715E
}
.ace-discord .ace_indent-guide {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y
}`;
var r = e("../lib/dom");
r.importCssString(t.cssText, t.cssClass)
}), define("ace/mode/css_highlight_rules", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/mode/text_highlight_rules"], function(e, t, n) {

View File

@ -7,6 +7,8 @@ const electron = require("electron")
const fetch = require("node-fetch").default
const uuid = require("uuid/v4")
const isPackaged = __filename.includes("app.asar")
const events = exports.events = new EventEmitter()
const logger = exports.logger = new Logger("Lightcord")
const appSettings = electron.remote.getGlobal("appSettings")
@ -157,7 +159,7 @@ async function privateInit(){
let constants = ModuleLoader.get(m=>m.API_HOST)[0]
let dispatcher = ModuleLoader.get(m=>m.Dispatcher&&m.default&&m.default.dispatch)[0].default
require("../../../../../BetterDiscordApp/dist/style.css")
require(formatMinified(path.join(__dirname, "../../../../../BetterDiscordApp/dist/style{min}.css")))
require("./lightcord.css")
function getCurrentHypesquad(){
@ -278,7 +280,7 @@ async function privateInit(){
DiscordNative.ipc.send("UPDATE_THEME", data.settings.theme)
})
require("lightcordapi/js/main.min.js")
require(formatMinified("lightcordapi/js/main{min}.js"))
/*
if(shouldShowPrompt){
@ -351,7 +353,7 @@ async function privateInit(){
dispatcher.subscribe(constants.ActionTypes.CONNECTION_OPEN || "CONNECTION_OPEN", onConn)
}*/
const BetterDiscord = window.BetterDiscord = window.mainCore = new(require("../../../../../BetterDiscordApp/dist/index.js").default)(BetterDiscordConfig, require("./betterdiscord"))
const BetterDiscord = window.BetterDiscord = window.mainCore = new(require(formatMinified("../../../../../BetterDiscordApp/dist/index{min}.js")).default)(BetterDiscordConfig, require("./betterdiscord"))
const Utils = window.Lightcord.BetterDiscord.Utils
const DOMTools = window.Lightcord.BetterDiscord.DOM
@ -1069,96 +1071,6 @@ async function privateInit(){
}
})().catch(console.error.bind(console, `%c[Error Bot shit]`, "color:red"))
let usedWebhooks = {}
ensureExported(e => e && e.Request && e.Request.prototype && e.Request.prototype.end)
.then(RequestModule => {
console.log("RequestModule", RequestModule)
const end = RequestModule.Request.prototype.end
RequestModule.Request.prototype.end = function(){
if(this.url.endsWith("/messages") && /\/channels\/\d+\/messages/g.test(this.url) && this.method === "POST"){ // sending message
let channelId = this.url.split("/channels/")[1].split("/messages")[0]
if(usedWebhooks[channelId]){ // webhook is availlable
let webhook = usedWebhooks[channelId]
let url = `/webhooks/${webhook.id}/${webhook.token}?wait=true`
this.url = url
}
}
return end.call(this, ...arguments)
}
})
ensureExported(e => e.default && e.default.displayName === "Webhook")
.then(webhookComponent => {
const renderEdit = webhookComponent.default.prototype.renderEdit
webhookComponent.default.prototype.renderEdit = function(){
const webhook = this.props.webhook
let returnValue = renderEdit.call(this, ...arguments)
returnValue.props.children = [returnValue.props.children]
let message = usedWebhooks[webhook.channel_id] && usedWebhooks[webhook.channel_id].id === webhook.id ? "Stop talking with this webhook" : "Talk with this webhook"
returnValue.props.children.push(React.createElement(window.Lightcord.Api.Components.inputs.Button, {color: "green", wrapper: false, onClick(){
if(usedWebhooks[webhook.channel_id] && usedWebhooks[webhook.channel_id].id === webhook.id){
delete usedWebhooks[webhook.channel_id]
}else{
usedWebhooks[webhook.channel_id] = {
id: webhook.id,
token: webhook.token
}
}
webhookPanels.forEach(e => e())
}}, message))
return returnValue
}
})
let webhookPanels = []
let getComp = (comp) => {
class SettingsWebhooks extends React.PureComponent {
constructor(props){
super(props)
}
componentWillMount(){
this.id = uuid()
this.component = new comp(this.props)
let func = () => {
this.component.forceUpdate()
}
func.id = this.id
webhookPanels.push(func)
}
componentWillUnmount(){
this.component = null
webhookPanels = webhookPanels.filter(e => e.id !== this.id)
}
render(){
return this.component.render()
}
static displayName = "SettingsWebhooks"
}
return SettingsWebhooks
}
ensureExported(e => e.default && e.default.displayName === "FluxContainer(SettingsWebhooks)")
.then(webhooksComponents => {
let comp = webhooksComponents.default
webhooksComponents.default = getComp(comp)
ModuleLoader.get(e => e.default && e.default.displayName === "FluxContainer(FluxContainer(SettingsWebhooks))")
.forEach(mod => {
mod.default = getComp(mod.default)
})
})
Utils.monkeyPatch(await ensureExported(e => e.default && e.default.displayName == "AuthBox"), "default", {after: (data) => {
const children = Utils.getNestedProp(data.returnValue, "props.children.props.children.props.children")
children.push(React.createElement(require("./tokenLogin").default, {}))
@ -1347,24 +1259,13 @@ function isBlacklisted(id){
return false
}
const formatLogger = new Logger("RequireFormat")
formatLogger.log("The app is", isPackaged ? "packaged." : "not packaged.")
function formatMinified(path){
let result = path.replace("{min}", isPackaged ? ".min": "")
formatLogger.log(`Formatting ${path} into ${result}.`)
return result
}
window.ohgodohfuck = function(){

View File

@ -34,7 +34,7 @@ function getSanitizedModulePaths() {
const { mainAppDirname, browserModulePaths } = electron.ipcRenderer.sendSync(NATIVE_MODULES_GET_PATHS);
browserModulePaths.forEach(modulePath => {
if (!modulePath.includes('electron.asar')) {
if (!modulePath.includes('app.asar')) {
sanitizedModulePaths.push(modulePath);
}
});