Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
FieryFlames committed Feb 6, 2023
0 parents commit 2689db7
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
pnpm-lock.yaml
yarn.lock
package-lock.json
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2023 Jack Matthews

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Discordo

Plays the Discordo easter egg when you open the app.

This is kinda meant to be an example of how to play custom sounds in Vendetta.
51 changes: 51 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { rollup } from "rollup";
import { readFile, writeFile, readdir } from "fs/promises";
import { createHash } from "crypto";
import esbuild from "rollup-plugin-esbuild";
import nodeResolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";

const manifest = JSON.parse(await readFile(`./manifest.json`));
const outPath = `./dist/index.js`;

try {
const bundle = await rollup({
input: `./${manifest.main}`,
onwarn: () => {},
plugins: [
nodeResolve(),
commonjs(),
esbuild({
target: "esnext",
minify: true,
}),
],
});

await bundle.write({
file: outPath,
globals(id) {
if (id.startsWith("@vendetta"))
return id.substring(1).replace(/\//g, ".");
const map = {
react: "window.React",
};

return map[id] || null;
},
format: "iife",
compact: true,
exports: "named",
});
await bundle.close();

const toHash = await readFile(outPath);
manifest.hash = createHash("sha256").update(toHash).digest("hex");
manifest.main = "index.js";
await writeFile(`./dist/manifest.json`, JSON.stringify(manifest));

console.log(`Successfully built ${manifest.name}!`);
} catch (e) {
console.error("Failed to build plugin...", e);
process.exit(1);
}
14 changes: 14 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Discordo",
"description": "Plays the Discordo easter egg when you open the app.",
"authors": [
{
"name": "Fiery",
"id": "890228870559698955"
}
],
"main": "src/index.tsx",
"vendetta": {
"icon": "ic_settings_boost_24px"
}
}
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"private": true,
"scripts": {
"build": "node build.mjs"
},
"devDependencies": {
"@react-native-clipboard/clipboard": "1.10.0",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@types/react": "18.0.27",
"@types/react-native": "0.70.6",
"@types/react-native-video": "^5.0.14",
"esbuild": "^0.16.14",
"rollup": "^3.9.1",
"rollup-plugin-esbuild": "^5.0.0",
"vendetta-types": "latest"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"react",
"react-native"
]
}
}
}
28 changes: 28 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { findByDisplayName, findByProps } from "@vendetta/metro";
import { after } from "@vendetta/patcher";

const ChatBanner = findByDisplayName("ChatBanner", false);

// The Video component with types
const Video = findByProps("DRMType", "FilterType").default as typeof import("react-native-video").default;

let unpatch;

export default {
onLoad: () => {
unpatch = after("default", ChatBanner, (_, res) => {
return (
<>
{res}
<Video
source={{ uri: "https://discord.com/assets/ae7d16bb2eea76b9b9977db0fad66658.mp3" }}
audioOnly
/>
</>
);
});
},
onUnload: () => {
unpatch();
}
}
14 changes: 14 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"outDir": "dist",
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"esModuleInterop": true,
"jsx": "react-native",
},
"include": [
"src",
"node_modules/vendetta-types"
]
}

0 comments on commit 2689db7

Please sign in to comment.