[meta] initial commit.

pull/1/head
Drake 2 years ago
commit ab7691313c

1
.gitignore vendored

@ -0,0 +1 @@
node_modules

@ -0,0 +1,11 @@
Copyright (c) 2022 Drake Allen
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

88
dist/build.js vendored

@ -0,0 +1,88 @@
(() => {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __reExport = (target, module, copyDefault, desc) => {
if (module && typeof module === "object" || typeof module === "function") {
for (let key of __getOwnPropNames(module))
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
}
return target;
};
var __toESM = (module, isNodeMode) => {
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", !isNodeMode && module && module.__esModule ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
};
// src/src/patcher.js
var require_patcher = __commonJS({
"src/src/patcher.js"(exports, module) {
function monkeyPatch(name, parentObj, patches) {
const injId = Symbol();
const before2 = patches["before"] === void 0 ? (...args) => args : patches["before"];
const instead2 = patches["instead"] === void 0 ? (res2, ...args) => res2(...args) : patches["instead"];
const after2 = patches["after"] === void 0 ? (args, res2) => res2 : patches["after"];
const handler = {
apply: (target, thisArg, [ctx, args]) => {
before2.apply(ctx, args);
res = instead2(target.bind(ctx), args);
return after2.apply(ctx, args.concat([res]));
}
};
const prox = new Proxy(parentObj[name], handler);
const orig = parentObj[name];
parentObj[name] = function() {
return prox(this, [arguments]);
};
const unpatch = () => {
parentObj[name] = orig;
};
parentObj[injId] = {
name,
orig,
unpatch
};
return unpatch;
}
function before(name, parentObj, func) {
return monkeyPatch(name, parentObj, { before: func });
}
function instead(name, parentObj, func) {
return monkeyPatch(name, parentObj, { instead: func });
}
function after(name, parentObj, func) {
return monkeyPatch(name, parentObj, { after: func });
}
module.exports = {
monkeyPatch,
before,
instead,
after
};
}
});
// src/init.js
var patcher = __toESM(require_patcher());
async function init(obj) {
obj.demon = {
patcher: {
patcher
}
};
}
var init_default = init;
// src/index.js
if (window.demon) {
delete window.demon;
}
init_default(window);
})();

@ -0,0 +1,14 @@
{
"name": "demoncord",
"version": "0.0.1-indev",
"description": "a devilesque client mod 😈",
"main": "src/index.js",
"scripts": {
"build": "esbuild src/index.js --bundle --outfile=dist/build.js"
},
"author": "Drake",
"license": "BSD-3-Clause",
"dependencies": {
"esbuild": "^0.14.10"
}
}

@ -0,0 +1,178 @@
lockfileVersion: 5.3
specifiers:
esbuild: ^0.14.10
dependencies:
esbuild: 0.14.10
packages:
/esbuild-android-arm64/0.14.10:
resolution: {integrity: sha512-vzkTafHKoiMX4uIN1kBnE/HXYLpNT95EgGanVk6DHGeYgDolU0NBxjO7yZpq4ZGFPOx8384eAdDrBYhO11TAlQ==}
cpu: [arm64]
os: [android]
requiresBuild: true
dev: false
optional: true
/esbuild-darwin-64/0.14.10:
resolution: {integrity: sha512-DJwzFVB95ZV7C3PQbf052WqaUuuMFXJeZJ0LKdnP1w+QOU0rlbKfX0tzuhoS//rOXUj1TFIwRuRsd0FX6skR7A==}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/esbuild-darwin-arm64/0.14.10:
resolution: {integrity: sha512-RNaaoZDg3nsqs5z56vYCjk/VJ76npf752W0rOaCl5lO5TsgV9zecfdYgt7dtUrIx8b7APhVaNYud+tGsDOVC9g==}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/esbuild-freebsd-64/0.14.10:
resolution: {integrity: sha512-10B3AzW894u6bGZZhWiJOHw1uEHb4AFbUuBdyml1Ht0vIqd+KqWW+iY/yMwQAzILr2WJZqEhbOXRkJtY8aRqOw==}
cpu: [x64]
os: [freebsd]
requiresBuild: true
dev: false
optional: true
/esbuild-freebsd-arm64/0.14.10:
resolution: {integrity: sha512-mSQrKB7UaWvuryBTCo9leOfY2uEUSimAvcKIaUWbk5Hth9Sg+Try+qNA/NibPgs/vHkX0KFo/Rce6RPea+P15g==}
cpu: [arm64]
os: [freebsd]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-32/0.14.10:
resolution: {integrity: sha512-lktF09JgJLZ63ANYHIPdYe339PDuVn19Q/FcGKkXWf+jSPkn5xkYzAabboNGZNUgNqSJ/vY7VrOn6UrBbJjgYA==}
cpu: [ia32]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-64/0.14.10:
resolution: {integrity: sha512-K+gCQz2oLIIBI8ZM77e9sYD5/DwEpeYCrOQ2SYXx+R4OU2CT9QjJDi4/OpE7ko4AcYMlMW7qrOCuLSgAlEj4Wg==}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-arm/0.14.10:
resolution: {integrity: sha512-BYa60dZ/KPmNKYxtHa3LSEdfKWHcm/RzP0MjB4AeBPhjS0D6/okhaBesZIY9kVIGDyeenKsJNOmnVt4+dhNnvQ==}
cpu: [arm]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-arm64/0.14.10:
resolution: {integrity: sha512-+qocQuQvcp5wo/V+OLXxqHPc+gxHttJEvbU/xrCGE03vIMqraL4wMua8JQx0SWEnJCWP+Nhf//v8OSwz1Xr5kA==}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-mips64le/0.14.10:
resolution: {integrity: sha512-nmUd2xoBXpGo4NJCEWoaBj+n4EtDoLEvEYc8Z3aSJrY0Oa6s04czD1flmhd0I/d6QEU8b7GQ9U0g/rtBfhtxBg==}
cpu: [mips64el]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-ppc64le/0.14.10:
resolution: {integrity: sha512-vsOWZjm0rZix7HSmqwPph9arRVCyPtUpcURdayQDuIhMG2/UxJxpbdRaa//w4zYqcJzAWwuyH2PAlyy0ZNuxqQ==}
cpu: [ppc64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-linux-s390x/0.14.10:
resolution: {integrity: sha512-knArKKZm0ypIYWOWyOT7+accVwbVV1LZnl2FWWy05u9Tyv5oqJ2F5+X2Vqe/gqd61enJXQWqoufXopvG3zULOg==}
cpu: [s390x]
os: [linux]
requiresBuild: true
dev: false
optional: true
/esbuild-netbsd-64/0.14.10:
resolution: {integrity: sha512-6Gg8neVcLeyq0yt9bZpReb8ntZ8LBEjthxrcYWVrBElcltnDjIy1hrzsujt0+sC2rL+TlSsE9dzgyuvlDdPp2w==}
cpu: [x64]
os: [netbsd]
requiresBuild: true
dev: false
optional: true
/esbuild-openbsd-64/0.14.10:
resolution: {integrity: sha512-9rkHZzp10zI90CfKbFrwmQjqZaeDmyQ6s9/hvCwRkbOCHuto6RvMYH9ghQpcr5cUxD5OQIA+sHXi0zokRNXjcg==}
cpu: [x64]
os: [openbsd]
requiresBuild: true
dev: false
optional: true
/esbuild-sunos-64/0.14.10:
resolution: {integrity: sha512-mEU+pqkhkhbwpJj5DiN3vL0GUFR/yrL3qj8ER1amIVyRibKbj02VM1QaIuk1sy5DRVIKiFXXgCaHvH3RNWCHIw==}
cpu: [x64]
os: [sunos]
requiresBuild: true
dev: false
optional: true
/esbuild-windows-32/0.14.10:
resolution: {integrity: sha512-Z5DieUL1N6s78dOSdL95KWf8Y89RtPGxIoMF+LEy8ChDsX+pZpz6uAVCn+YaWpqQXO+2TnrcbgBIoprq2Mco1g==}
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: false
optional: true
/esbuild-windows-64/0.14.10:
resolution: {integrity: sha512-LE5Mm62y0Bilu7RDryBhHIX8rK3at5VwJ6IGM3BsASidCfOBTzqcs7Yy0/Vkq39VKeTmy9/66BAfVoZRNznoDw==}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/esbuild-windows-arm64/0.14.10:
resolution: {integrity: sha512-OJOyxDtabvcUYTc+O4dR0JMzLBz6G9+gXIHA7Oc5d5Fv1xiYa0nUeo8+W5s2e6ZkPRdIwOseYoL70rZz80S5BA==}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/esbuild/0.14.10:
resolution: {integrity: sha512-ibZb+NwFqBwHHJlpnFMtg4aNmVK+LUtYMFC9CuKs6lDCBEvCHpqCFZFEirpqt1jOugwKGx8gALNGvX56lQyfew==}
hasBin: true
requiresBuild: true
optionalDependencies:
esbuild-android-arm64: 0.14.10
esbuild-darwin-64: 0.14.10
esbuild-darwin-arm64: 0.14.10
esbuild-freebsd-64: 0.14.10
esbuild-freebsd-arm64: 0.14.10
esbuild-linux-32: 0.14.10
esbuild-linux-64: 0.14.10
esbuild-linux-arm: 0.14.10
esbuild-linux-arm64: 0.14.10
esbuild-linux-mips64le: 0.14.10
esbuild-linux-ppc64le: 0.14.10
esbuild-linux-s390x: 0.14.10
esbuild-netbsd-64: 0.14.10
esbuild-openbsd-64: 0.14.10
esbuild-sunos-64: 0.14.10
esbuild-windows-32: 0.14.10
esbuild-windows-64: 0.14.10
esbuild-windows-arm64: 0.14.10
dev: false

@ -0,0 +1,7 @@
import init from "./init.js"
if (window.demon) {
delete window.demon; // this is a very good idea
}
init(window)

@ -0,0 +1,11 @@
import * as patcher from "./src/patcher.js"
async function init(obj) {
obj.demon = {
patcher: {
patcher
}
}
}
export default init;

@ -0,0 +1,46 @@
function monkeyPatch(name, parentObj, patches) {
const injId = Symbol()
const before = (patches["before"] === undefined) ? (...args)=>args : patches["before"];
const instead = (patches["instead"] === undefined) ? (res,...args)=>res(...args) : patches["instead"];
const after = (patches["after"] === undefined) ? (args, res)=>res : patches["after"];
const handler = {
apply: (target, thisArg, [ctx, args]) => {
before.apply(ctx, args);
res = instead(target.bind(ctx), args)
return after.apply(ctx, args.concat([res]));
}
};
const prox = new Proxy(parentObj[name], handler);
const orig = parentObj[name];
parentObj[name] = function() {
return prox(this, [arguments]);
};
const unpatch = () => {
parentObj[name] = orig;
}
parentObj[injId] = {
name: name,
orig: orig,
unpatch: unpatch
};
return unpatch;
}
function before(name, parentObj, func) {
return monkeyPatch(name, parentObj, {before: func})
}
function instead(name, parentObj, func) {
return monkeyPatch(name, parentObj, {instead: func})
}
function after(name, parentObj, func) {
return monkeyPatch(name, parentObj, {after: func})
}
module.exports = {
monkeyPatch,
before,
instead,
after
}
Loading…
Cancel
Save