run prettier lol

pull/1/head
Drake 2 years ago
parent b47d669133
commit b334860933

@ -0,0 +1,2 @@
dist/
node_modules/

@ -1,24 +1,40 @@
# Demoncord
A discord client mod by satanists for satanists (if your definition of satanist is a member of the Hazbin Hotel fandom)
# Install
Don't.
### But what if I really want to
Please do not
### I will take away your Robo Fizz plushie if you don't tell me how to install your god-forsaken client mod
Jesus christ, fine.
1. Go to the `dist/` folder
2. Copy the contents of `build.js` into your clipboard
3. Paste this into your Discord client's devtools
4. Repeat everytime you start your client
Are you happy now?
# Why
Why not?
# Q&A
### Who are you
I'm everyone and no-one, all at once.
### Why were you incessant on me not using this
Because it's
- Not really finished
- Doesn't have any plugins
- Will break at the slightest poke or prod (related to the first one)
- Not really finished
- Doesn't have any plugins
- Will break at the slightest poke or prod (related to the first one)

2266
dist/build.js vendored

File diff suppressed because one or more lines are too long

@ -1,24 +1,25 @@
{
"name": "demoncord-rewrite",
"version": "0.0.1",
"description": "A client mod for sinners.",
"main": "src/index.js",
"scripts": {
"build": "rollup --config rollup.config.js",
"watch": "rollup --config rollup.config.js --watch"
},
"author": "Drake",
"license": "BSD-3-Clause",
"dependencies": {
"@rollup/plugin-alias": "^3.1.9",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-sucrase": "^4.0.4",
"idb-keyval": "^6.1.0",
"nests": "^2.3.1",
"rollup": "^2.73.0",
"rollup-plugin-swc": "^0.2.1",
"rollup-plugin-uglify": "^6.0.4",
"spitroast": "^1.4.2",
"uglify-js": "^3.15.5"
}
"name": "demoncord-rewrite",
"version": "0.0.1",
"description": "A client mod for sinners.",
"main": "src/index.js",
"scripts": {
"build": "rollup --config rollup.config.js",
"watch": "rollup --config rollup.config.js --watch"
},
"author": "Drake",
"license": "BSD-3-Clause",
"dependencies": {
"@rollup/plugin-alias": "^3.1.9",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-sucrase": "^4.0.4",
"idb-keyval": "^6.1.0",
"nests": "^2.3.1",
"prettier": "^2.7.1",
"rollup": "^2.73.0",
"rollup-plugin-swc": "^0.2.1",
"rollup-plugin-uglify": "^6.0.4",
"spitroast": "^1.4.2",
"uglify-js": "^3.15.5"
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,16 @@
module.exports = {
tabWidth: 4, //todo: is this necessary if we're still using tabs
useTabs: true,
singleQuote: false,
semi: true,
bracketSpacing: true,
trailingComma: "none",
overrides: [
{
files: "*.js",
options: {
parser: "babel"
}
}
]
};

@ -4,30 +4,41 @@ import { uglify } from "rollup-plugin-uglify";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import sucrase from "@rollup/plugin-sucrase";
import alias from "@rollup/plugin-alias";
import { resolve as resolvePath } from "path";
import { resolve as resolvePath } from "path";
const projectRootDir = resolvePath(__dirname);
export default defineConfig({
input: pkjs.main,
output: {
file: "dist/build.js",
format: "iife",
globals: {
}
},
external: ["React"],
plugins: [
alias({
entries: [
{ find: "nests", replacement: resolvePath(projectRootDir, "node_modules/nests/esm/") },
{ find: "react", replacement: resolvePath(projectRootDir, "src/shim_react.js") }
],
}),
nodeResolve(),
sucrase({
exclude: ["node_modules/**"],
transforms: ["jsx"],
}),
uglify(),
],
input: pkjs.main,
output: {
file: "dist/build.js",
format: "iife",
globals: {}
},
external: ["React"],
plugins: [
alias({
entries: [
{
find: "nests",
replacement: resolvePath(
projectRootDir,
"node_modules/nests/esm/"
)
},
{
find: "react",
replacement: resolvePath(
projectRootDir,
"src/shim_react.js"
)
}
]
}),
nodeResolve(),
sucrase({
exclude: ["node_modules/**"],
transforms: ["jsx"]
}),
uglify()
]
});

@ -1,22 +1,18 @@
import webpack from "./webpack"
import * as idb from "idb-keyval"
import * as nests from "nests"
import * as nestsReact from "nests/react"
import webpack from "./webpack";
import * as idb from "idb-keyval";
import * as nests from "nests";
import * as nestsReact from "nests/react";
const { findByProps } = webpack
const { findByProps } = webpack;
const React = findByProps(
"createElement"
)
const React = findByProps("createElement");
export default {
React,
ReactDOM: findByProps(
"hydrate"
),
ReactDOM: findByProps("hydrate"),
dispatch: findByProps("dirtyDispatch").__proto__,
idb,
nests
}
};
export { idb, nests, nestsReact, React }
export { idb, nests, nestsReact, React };

@ -1,16 +1,18 @@
function injectCSS(str) {
const style = document.createElement('style')
style.className = "demon-element-css"
style.innerHTML = str
document.head.appendChild(style)
const style = document.createElement("style");
style.className = "demon-element-css";
style.innerHTML = str;
document.head.appendChild(style);
}
function createClass(name, style) {
const stylestr = Object.entries(style).map(([k, v]) => `${k}:${v}`).join(';')
injectCSS(`.${name} {${stylestr}}`)
const stylestr = Object.entries(style)
.map(([k, v]) => `${k}:${v}`)
.join(";");
injectCSS(`.${name} {${stylestr}}`);
}
export default {
injectCSS,
createClass
}
injectCSS,
createClass
};

@ -1,5 +1,5 @@
//NOTE: this isn't even a wrapper around spitroast, it's more a convienence for importing patcher internally
import * as spitroast from "spitroast"
import * as spitroast from "spitroast";
export * from "spitroast"
export default spitroast
export * from "spitroast";
export default spitroast;

@ -1,102 +1,93 @@
import { idb, nests } from "./common"
import { idb, nests } from "./common";
const nest = nests.make()
const nest = nests.make();
async function init() {
const extNest = demon.summon("internal/nest")
if (!window.__demon) { // this *shouldn't* be required but if we magically run into a race condition it's better to be safe
window.__demon = {}
}
if (!(await idb.get("demon"))) {
await idb.set("demon", {
status: {
},
plugins: {
}
})
}
const currdemon = await idb.get("demon")
currdemon.status = {}
Object.keys(currdemon.plugins).forEach(key => {
const plug = currdemon.plugins[key]
const exports = (0, eval)(plug.initialize)
const ret = exports.onStart()
nest.store[plug.meta.name].ctx = ret
currdemon.status[plug.meta.name] = {
running: true
}
})
extNest.store.pluginsList = currdemon.plugins
extNest.store.pluginsStatus = currdemon.status
await idb.set("demon", currdemon)
const extNest = demon.summon("internal/nest");
if (!window.__demon) {
// this *shouldn't* be required but if we magically run into a race condition it's better to be safe
window.__demon = {};
}
if (!(await idb.get("demon"))) {
await idb.set("demon", {
status: {},
plugins: {}
});
}
const currdemon = await idb.get("demon");
currdemon.status = {};
Object.keys(currdemon.plugins).forEach((key) => {
const plug = currdemon.plugins[key];
const exports = (0, eval)(plug.initialize);
const ret = exports.onStart();
nest.store[plug.meta.name].ctx = ret;
currdemon.status[plug.meta.name] = {
running: true
};
});
extNest.store.pluginsList = currdemon.plugins;
extNest.store.pluginsStatus = currdemon.status;
await idb.set("demon", currdemon);
}
async function add(iife, meta) {
const extNest = demon.summon("internal/nest")
const currdemon = await idb.get("demon")
const exports = (0, eval)(iife)
if (!!exports.meta) {
meta = exports.meta
}
currdemon.plugins[meta.name] = {
initialize: iife,
meta: meta
}
extNest.store.pluginsList = currdemon.plugins
extNest.store.pluginsStatus = currdemon.status
await idb.set("demon", currdemon)
const extNest = demon.summon("internal/nest");
const currdemon = await idb.get("demon");
const exports = (0, eval)(iife);
if (!!exports.meta) {
meta = exports.meta;
}
currdemon.plugins[meta.name] = {
initialize: iife,
meta: meta
};
extNest.store.pluginsList = currdemon.plugins;
extNest.store.pluginsStatus = currdemon.status;
await idb.set("demon", currdemon);
}
async function del(name) {
const extNest = demon.summon("internal/nest")
const currdemon = await idb.get("demon")
if (!!currdemon.plugins[name])
if (currdemon.status[name].running) {
const ctx = nest.store[name].ctx;
(0, eval)(currdemon.plugins[name].initialize).onStop(ctx)
}
delete currdemon.status[name]
delete currdemon.plugins[name]
extNest.store.pluginsList = currdemon.plugins
extNest.store.pluginsStatus = currdemon.status
await idb.set("demon", currdemon)
const extNest = demon.summon("internal/nest");
const currdemon = await idb.get("demon");
if (!!currdemon.plugins[name])
if (currdemon.status[name].running) {
const ctx = nest.store[name].ctx;
(0, eval)(currdemon.plugins[name].initialize).onStop(ctx);
}
delete currdemon.status[name];
delete currdemon.plugins[name];
extNest.store.pluginsList = currdemon.plugins;
extNest.store.pluginsStatus = currdemon.status;
await idb.set("demon", currdemon);
}
async function toggle(name) {
const extNest = demon.summon("internal/nest")
const currdemon = await idb.get("demon")
if (!!currdemon.plugins[name]) {
if (currdemon.status[name]?.running) {
console.log(currdemon.status[name].ctx)
const ctx = nest.store[name].ctx;
(0, eval)(currdemon.plugins[name].initialize).onStop(ctx)
currdemon.status[name].running = false
}
else {
const ret = (0, eval)(currdemon.plugins[name].initialize).onStart()
nest.store[name].ctx = ret
currdemon.status[name] = {
running: true
}
}
}
extNest.store.pluginsList = currdemon.plugins
extNest.store.pluginsStatus = currdemon.status
await idb.set("demon", currdemon)
const extNest = demon.summon("internal/nest");
const currdemon = await idb.get("demon");
if (!!currdemon.plugins[name]) {
if (currdemon.status[name]?.running) {
console.log(currdemon.status[name].ctx);
const ctx = nest.store[name].ctx;
(0, eval)(currdemon.plugins[name].initialize).onStop(ctx);
currdemon.status[name].running = false;
} else {
const ret = (0, eval)(currdemon.plugins[name].initialize).onStart();
nest.store[name].ctx = ret;
currdemon.status[name] = {
running: true
};
}
}
extNest.store.pluginsList = currdemon.plugins;
extNest.store.pluginsStatus = currdemon.status;
await idb.set("demon", currdemon);
}
export {
init,
add,
del,
toggle
}
export { init, add, del, toggle };
export default {
init,
add,
del,
toggle
}
init,
add,
del,
toggle
};

@ -1,42 +1,56 @@
import { React, nests, nestsReact } from "../../common"
import { toggle } from "../../plugin"
import webpack from "../../webpack"
import { React, nests, nestsReact } from "../../common";
import { toggle } from "../../plugin";
import webpack from "../../webpack";
const Checkbox = webpack.findByDisplayName("Checkbox")
const Checkbox = webpack.findByDisplayName("Checkbox");
export default class HummusUI extends React.Component {
constructor(props) {
super(props)
this.state = {
tg: 0
}
}
constructor(props) {
super(props);
this.state = {
tg: 0
};
}
render() {
const extNest = demon.summon("internal/nest")
return (<div className="control-group demon-settings-card-header">
<label className="demon-settings-header-size30 ">Plugins</label>
{Object.keys(extNest.ghost.pluginsList).map((k) => {
return (<div className="demon-settings-card-base"><span>
<Checkbox
className={`demon-stub-plugin-checkbox-${k}`}
checked={extNest.ghost.pluginsStatus[k].running}
onChange={async () => {
toggle(k)
const ele = document.getElementsByClassName(`demon-stub-plugin-checkbox-${k}`)[0]
//ele.value = extNest.ghost.pluginsStatus[k].running
if (!extNest.ghost.pluginsStatus[k].running) {
ele.value = "on"
} else {
ele.value = "off"
}
this.setState({tg: !this.state.tg})
}}
>
{k}
</Checkbox>
</span></div>)
})}
</div>)
}
}
render() {
const extNest = demon.summon("internal/nest");
return (
<div className="control-group demon-settings-card-header">
<label className="demon-settings-header-size30 ">Plugins</label>
{Object.keys(extNest.ghost.pluginsList).map((k) => {
return (
<div className="demon-settings-card-base">
<span>
<Checkbox
className={`demon-stub-plugin-checkbox-${k}`}
checked={
extNest.ghost.pluginsStatus[k].running
}
onChange={async () => {
toggle(k);
const ele =
document.getElementsByClassName(
`demon-stub-plugin-checkbox-${k}`
)[0];
//ele.value = extNest.ghost.pluginsStatus[k].running
if (
!extNest.ghost.pluginsStatus[k]
.running
) {
ele.value = "on";
} else {
ele.value = "off";
}
this.setState({ tg: !this.state.tg });
}}
>
{k}
</Checkbox>
</span>
</div>
);
})}
</div>
);
}
}

@ -1,46 +1,62 @@
import { React, nestsReact } from "../../common"
import webpack from "../../webpack"
import { toggle, del } from "../../plugin"
import { React, nestsReact } from "../../common";
import webpack from "../../webpack";
import { toggle, del } from "../../plugin";
const Header = webpack.findByProps("Sizes", "Tags")
const Header = webpack.findByProps("Sizes", "Tags");
const Card = webpack.findByDisplayName("Card");
const Flex = webpack.findByDisplayName("Flex");
const FormText = webpack.findByDisplayName("FormText");
const Button = webpack.findByProps("BorderColors", "Colors");
const FormDivider = webpack.findByDisplayName("FormDivider");
const Switch = webpack.findByDisplayName("Switch")
const Switch = webpack.findByDisplayName("Switch");
export default (props) => {
nestsReact.useNest(props.nest)
if (!props.nest.ghost.pluginsList[props.name] || !props.nest.ghost.pluginsStatus[props.name]) {
return null //you wouldn't think i'd have to do this but
}
return (<>
<Card type="cardPrimary" className="demon-settings-card-base" outline={false} editable={false}>
<Header className="demon-settings-card-header" size={Header.Sizes.SIZE_20}>
{props.name}
</Header>
<hr className="demon-settings-card-divider" />
<FormText className="demon-settings-card-desc">
{props.nest.ghost.pluginsList[props.name].meta.desc}
</FormText>
<svg
position="top"
onClick = {async () => {
del(props.name)
}}
className="demon-settings-card-delete"
viewBox="0 0 24 24"
>
<path fill="var(--text-muted)" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12 1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4z" />
</svg>
<Switch
className="demon-settings-card-switch"
checked = {props.nest.ghost.pluginsStatus[props.name].running}
onChange = {async () => {
toggle(props.name)
}}
/>
</Card>
</>)
}
nestsReact.useNest(props.nest);
if (
!props.nest.ghost.pluginsList[props.name] ||
!props.nest.ghost.pluginsStatus[props.name]
) {
return null; //you wouldn't think i'd have to do this but
}
return (
<>
<Card
type="cardPrimary"
className="demon-settings-card-base"
outline={false}
editable={false}
>
<Header
className="demon-settings-card-header"
size={Header.Sizes.SIZE_20}
>
{props.name}
</Header>
<hr className="demon-settings-card-divider" />
<FormText className="demon-settings-card-desc">
{props.nest.ghost.pluginsList[props.name].meta.desc}
</FormText>
<svg
position="top"
onClick={async () => {
del(props.name);
}}
className="demon-settings-card-delete"
viewBox="0 0 24 24"
>
<path
fill="var(--text-muted)"
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12 1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"
/>
</svg>
<Switch
className="demon-settings-card-switch"
checked={props.nest.ghost.pluginsStatus[props.name].running}
onChange={async () => {
toggle(props.name);
}}
/>
</Card>
</>
);
};

@ -1,22 +1,26 @@
import { React, nests, nestsReact } from "../../common"
import webpack from "../../webpack"
import PlugCard from "./plugincard.jsx"
import { React, nests, nestsReact } from "../../common";
import webpack from "../../webpack";
import PlugCard from "./plugincard.jsx";
const Header = webpack.findByProps("Sizes", "Tags")
const FormTitle = webpack.findByDisplayName("FormTitle")
const Header = webpack.findByProps("Sizes", "Tags");
const FormTitle = webpack.findByDisplayName("FormTitle");
const FormSection = webpack.findByDisplayName("FormSection");
const FormDivider = webpack.findByDisplayName("FormDivider");
export default () => {
const extNest = demon.summon("internal/nest")
nestsReact.useNest(extNest)
return (<>
<Header size="demon-settings-header-size30">Plugins</Header>
<FormDivider className="demon-settings-divider" />
{Object.keys(extNest.ghost.pluginsList).map((k) => {
return (<>
<PlugCard name={k} nest={extNest}></PlugCard>
</>)
})}
</>)
}
const extNest = demon.summon("internal/nest");
nestsReact.useNest(extNest);
return (
<>
<Header size="demon-settings-header-size30">Plugins</Header>
<FormDivider className="demon-settings-divider" />
{Object.keys(extNest.ghost.pluginsList).map((k) => {
return (
<>
<PlugCard name={k} nest={extNest}></PlugCard>
</>
);
})}
</>
);
};

@ -1,86 +1,103 @@
import webpack from "../../webpack"
import { after } from "../../patcher"
import plugins from "./plugins.jsx"
import hummus from "./hummus.jsx"
import css from "../../css"
import { React } from "../../common"
import webpack from "../../webpack";
import { after } from "../../patcher";
import plugins from "./plugins.jsx";
import hummus from "./hummus.jsx";
import css from "../../css";
import { React } from "../../common";
const SettingsView = webpack.findByDisplayName("SettingsView")
const SettingsView = webpack.findByDisplayName("SettingsView");
function init() {
css.createClass("demon-settings-divider", {
"margin-top": "10px",
"margin-bottom": "10px",
"height": "1px"
})
css.createClass("demon-settings-card-divider", {
"margin-top": "5px",
"margin-bottom": "5px",
"margin-left": "10px",
"margin-right": "10px",
"height": "1px",
"border": "thin solid var(--background-modifier-accent)"
})
css.createClass("demon-settings-card-base", {
"margin-bottom": "10px"
})
css.createClass("demon-settings-card-header", {
"margin-left": "10px",
"margin-top": "10px"
})
css.createClass("demon-settings-card-desc", {
"color": "var(--header-secondary)",
"display": "inline-block",
"font-size": "15px",
"line-height": "15px",
"margin-left": "10px",
"margin-top": "5px",
"margin-bottom": "10px"
})
css.createClass("demon-settings-card-switch", {
"margin-right": "10px",
"margin-top": "0px",
"margin-bottom": "10px",
"float": "right"
})
css.createClass("demon-settings-card-delete", {
"margin-right": "5px",
"float": "right",
"width": "24px",
"cursor": "pointer"
})
css.createClass("demon-settings-header-size30", {
"font-size": "30px",
"line-height": "34px"
})
if (!!window.webpackChunkdiscord_app) {
after("getPredicateSections", SettingsView.prototype, (args, sections) => {
sections.unshift(
{
section: "HEADER",
label: "Demoncord"
},
{
section: "demoncord",
label: "Plugins",
element: plugins
},
{
section: "DIVIDER"
})
return sections;
})
} else {
//I AM SO SORRY
const UserSettingsModal = webpack.findByProps("getUserSettingsModalSections");
const TabBar = webpack.findByProps("TabBarItem");
after("render", UserSettingsModal.default.prototype, (args, ret) => {
ret.props.children[0].props.children.props.children[1].push(React.createElement(TabBar.TabBarItem, { key: "demoncord" }, "Plugins"))
if (ret.props.children[0].props.children.props.selectedItem === "demoncord") {
ret.props.children[1].props.children[0].props.children = React.createElement(hummus, {}, "")
}
})
}
css.createClass("demon-settings-divider", {
"margin-top": "10px",
"margin-bottom": "10px",
height: "1px"
});
css.createClass("demon-settings-card-divider", {
"margin-top": "5px",
"margin-bottom": "5px",
"margin-left": "10px",
"margin-right": "10px",
height: "1px",
border: "thin solid var(--background-modifier-accent)"
});
css.createClass("demon-settings-card-base", {
"margin-bottom": "10px"
});
css.createClass("demon-settings-card-header", {
"margin-left": "10px",
"margin-top": "10px"
});
css.createClass("demon-settings-card-desc", {
color: "var(--header-secondary)",
display: "inline-block",
"font-size": "15px",
"line-height": "15px",
"margin-left": "10px",
"margin-top": "5px",
"margin-bottom": "10px"
});
css.createClass("demon-settings-card-switch", {
"margin-right": "10px",
"margin-top": "0px",
"margin-bottom": "10px",
float: "right"
});
css.createClass("demon-settings-card-delete", {
"margin-right": "5px",
float: "right",
width: "24px",
cursor: "pointer"
});
css.createClass("demon-settings-header-size30", {
"font-size": "30px",
"line-height": "34px"
});
if (!!window.webpackChunkdiscord_app) {
after(
"getPredicateSections",
SettingsView.prototype,
(args, sections) => {
sections.unshift(
{
section: "HEADER",
label: "Demoncord"
},
{
section: "demoncord",
label: "Plugins",
element: plugins
},
{
section: "DIVIDER"
}
);
return sections;
}
);
} else {
//I AM SO SORRY
const UserSettingsModal = webpack.findByProps(
"getUserSettingsModalSections"
);
const TabBar = webpack.findByProps("TabBarItem");
after("render", UserSettingsModal.default.prototype, (args, ret) => {
ret.props.children[0].props.children.props.children[1].push(
React.createElement(
TabBar.TabBarItem,
{ key: "demoncord" },
"Plugins"
)
);
if (
ret.props.children[0].props.children.props.selectedItem ===
"demoncord"
) {
ret.props.children[1].props.children[0].props.children =
React.createElement(hummus, {}, "");
}
});
}
}
export default { init }
export default { init };

@ -1,5 +1,5 @@
import logger from "./logger"
import logger from "./logger";
export default {
logger
}
};

@ -23,35 +23,38 @@ font-size: 0.9em;
//TODO: make setting to save logs in idb, for debugging and troubleshooting purposes
function makeLogger(print, noDemoncord = false) {
return function (locs, ...message) {
message = message.join("")
return function (locs, ...message) {
message = message.join("");
if (locs === undefined) {
locs = ["Default"]
makeLogger("warn")("Requested hierarchy has not been passed to logger function, defaulting to default string", ["Logger"])
locs = ["Default"];
makeLogger("warn")(
"Requested hierarchy has not been passed to logger function, defaulting to default string",
["Logger"]
);
}
if (typeof(locs) === "string") {
message = locs
locs = ["Default"]
}
let rawParts = ["Demoncord", ...locs, message];
let styleParts = [];
let content = "";
if (typeof locs === "string") {
message = locs;
locs = ["Default"];
}
let rawParts = ["Demoncord", ...locs, message];
let styleParts = [];
let content = "";
if (noDemoncord) rawParts.splice(0, 1);
if (noDemoncord) rawParts.splice(0, 1);
for (let i = 0; i < rawParts.length; i++) {
if (i === rawParts.length - 1) {
// last item
content += "%c" + rawParts[i];
styleParts.push(styleTxt);
} else {
content += "%c" + rawParts[i] + "%c ";
styleParts.push(styleBg, "");
}
}
for (let i = 0; i < rawParts.length; i++) {
if (i === rawParts.length - 1) {
// last item
content += "%c" + rawParts[i];
styleParts.push(styleTxt);
} else {
content += "%c" + rawParts[i] + "%c ";
styleParts.push(styleBg, "");
}
}
print(content, ...styleParts);
};
print(content, ...styleParts);
};
}
const log = makeLogger(console.log);
@ -76,9 +79,9 @@ const trace = makeLogger(console.trace);
};*/
export default {
log,
warn,
error,
trace,
makeLogger
log,
warn,
error,
trace,
makeLogger
};

@ -1,63 +1,71 @@
function getModules() {
let modules = {};
let modules = {};
if (!window.webpackChunkdiscord_app) {
//funny hummus compat (maybe)
modules = webpackJsonp([ ], [ (mod, _exports, req) => { mod.exports = req; } ]);
} else {
window.webpackChunkdiscord_app.push([
[Math.random().toString(36)],
{},
(e) => {
modules = e;
}
]);
}
if (!window.webpackChunkdiscord_app) {
//funny hummus compat (maybe)
modules = webpackJsonp(
[],
[
(mod, _exports, req) => {
mod.exports = req;
}
]
);
} else {
window.webpackChunkdiscord_app.push([
[Math.random().toString(36)],
{},
(e) => {
modules = e;
}
]);
}
return modules.c;
return modules.c;
}
function filter(filter, moduleList) {
let modules = [];
for (const mod in moduleList) {
const module = moduleList[mod].exports;
if (module) {
if (module.default && module.__esModule && filter(module.default)) {
modules.push(module.default);
} else if (filter(module)) {
modules.push(module);
}
}
}
return modules;
let modules = [];
for (const mod in moduleList) {
const module = moduleList[mod].exports;
if (module) {
if (module.default && module.__esModule && filter(module.default)) {
modules.push(module.default);
} else if (filter(module)) {
modules.push(module);
}
}
}
return modules;
}
let webpack = {
modules: getModules(),
filter: filter,
find: (filter) => webpack.filter(filter, webpack.modules)[0],
findAll: (filter) => webpack.filter(filter, webpack.modules),
findByProps: (...props) => {
return webpack.find((module) => {
return props.every((prop) => module[prop] !== undefined);
});
},
findByPropsAll: (...props) => {
return webpack.findAll((module) =>
props.every((prop) => module[prop] !== undefined)
);
},
findByDisplayName: (prop) => {
return webpack.find((m) => m?.displayName === prop);
},
modules: getModules(),
filter: filter,
find: (filter) => webpack.filter(filter, webpack.modules)[0],
findAll: (filter) => webpack.filter(filter, webpack.modules),
findByProps: (...props) => {
return webpack.find((module) => {
return props.every((prop) => module[prop] !== undefined);
});
},
findByPropsAll: (...props) => {
return webpack.findAll((module) =>
props.every((prop) => module[prop] !== undefined)
);
},
findByDisplayName: (prop) => {
return webpack.find((m) => m?.displayName === prop);
},
findByStrings: (...props) => {
return webpack.find((module) =>
props.every((prop) => module.toString().contains(prop)))
return webpack.find((module) =>
props.every((prop) => module.toString().contains(prop))
);
},
reloadModules: () => {
//NOTE: i have no idea why this could even feasibly need to be used, but i'm adding it anyways
webpack.modules = getModules();
}
reloadModules: () => {
//NOTE: i have no idea why this could even feasibly need to be used, but i'm adding it anyways
webpack.modules = getModules();
}
};
export default webpack;

@ -1 +1 @@
//TODO: funny websocket control api
//TODO: funny websocket control api

@ -1,13 +1,13 @@
import webpack from "./api/webpack.js"
import common from "./api/common.js"
import utils from "./api/utils/index.js"
import plugins from "./api/plugin.js"
import settings from "./api/ui/settings/settings.js"
import css from "./api/css.js"
import patcher from "./api/patcher"
import webpack from "./api/webpack.js";
import common from "./api/common.js";
import utils from "./api/utils/index.js";
import plugins from "./api/plugin.js";
import settings from "./api/ui/settings/settings.js";
import css from "./api/css.js";
import patcher from "./api/patcher";
if (!window.DiscordNative) {
//throw new Error("Sorry, Demoncord cannot be used on web!")
//throw new Error("Sorry, Demoncord cannot be used on web!")
}
const demon = {
@ -16,46 +16,46 @@ const demon = {
common
},
utils,
plugins,
internal: {
nest: common.nests.make()
},
css,
patcher,
stolas: {
monologue: () => {
return _.sample([
"When I'm lonely, I become hungry. And when I become hungry, I want to choke on that red **** of yours... **** your ***** and lick all of your *****, before taking out your *****, and **** with more teeth until you're screaming ********** like a FUCKING baby--!",
"Ohhh, Blitzo! I'm so excited! I cannot wait to feel your slimy c**k inside of my ****. To ***** the— ...**** use while you and I and **** and jelly sandwiches all night...!"
])
}
}
}
plugins,
internal: {
nest: common.nests.make()
},
css,
patcher,
stolas: {
monologue: () => {
return _.sample([
"When I'm lonely, I become hungry. And when I become hungry, I want to choke on that red **** of yours... **** your ***** and lick all of your *****, before taking out your *****, and **** with more teeth until you're screaming ********** like a FUCKING baby--!",
"Ohhh, Blitzo! I'm so excited! I cannot wait to feel your slimy c**k inside of my ****. To ***** the— ...**** use while you and I and **** and jelly sandwiches all night...!"
]);
}
}
};
function isAllowed(mod) {
//TODO: actually implement permissions
return true
return true;
}
function summon(mod) {
if (!isAllowed(mod)) {
throw new Error("Not allowed!"); //TODO: make this not irrepairably error out
}
const mods = mod.split("/");
let res = demon;
mods.forEach((m) => {
if (m in res) {
res = res[m];
} else {
throw new Error("Module does not exist!");
}
});
return res;
if (!isAllowed(mod)) {
throw new Error("Not allowed!"); //TODO: make this not irrepairably error out
}
const mods = mod.split("/");
let res = demon;
mods.forEach((m) => {
if (m in res) {
res = res[m];
} else {
throw new Error("Module does not exist!");
}
});
return res;
}
window.demon = {
summon
}
};
plugins.init()
settings.init()
plugins.init();
settings.init();

@ -1,16 +1,10 @@
//super omega jank to make nests/react work
import webpack from "./api/webpack"
import webpack from "./api/webpack";
const React = webpack.findByProps(
"createElement"
)
const React = webpack.findByProps("createElement");
const { useRef, useReducer, useEffect } = React
const { useRef, useReducer, useEffect } = React;
export default React
export {
useRef,
useReducer,
useEffect
}
export default React;
export { useRef, useReducer, useEffect };

Loading…
Cancel
Save