From d543317bca58df9d63ed1713ea5665f15cce5798 Mon Sep 17 00:00:00 2001 From: amsyarasyiq <82711525+amsyarasyiq@users.noreply.github.com> Date: Fri, 9 Feb 2024 10:37:36 +0800 Subject: [PATCH] Rebrand to "Bunny" --- README.md | 45 +++++++++---------- build.mjs | 18 +++++--- package.json | 8 ++-- src/entry.ts | 2 +- src/index.ts | 3 +- src/lib/plugins.ts | 2 +- .../settings/components/SettingsSection.tsx | 2 +- src/ui/settings/data.tsx | 4 +- src/ui/settings/pages/Developer.tsx | 6 +-- src/ui/settings/pages/General.tsx | 2 +- src/ui/settings/patches/you.tsx | 6 +-- 11 files changed, 53 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 320d827..f690cb1 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,28 @@ > [!NOTE] -> "Pyondetta" is not the final name of the mod.\ -> This fork has been slowly progressing **since Dec 2023**, and [a set of new features](https://github.com/pyoncord/Pyondetta/issues/1) have been implemented. +> This fork has been slowly progressing **since Dec 2023**, and [a set of new features](https://github.com/pyoncord/Bunny/issues/1) have been implemented.\ > See [FAQs](#faqs) -# Pyondetta -A mod for Discord's mobile apps, fork of Vendetta, *with an actual progess.* +# Bunny +A mod for Discord's mobile apps, fork of Vendetta—from its contributor, *with an actual progess.* + +## FAQs + +### Why Bunny? +Bunny is a fork from a contributor of the good Vendetta, and is still passionate to work with Discord mods. Since Vendetta has reached EOL, Bunny was created to publish what I have been working behind the scenes. + +### Bunny vs Pyoncord +Pyoncord and Bunny is a completely different mod. [Pyoncord](https://github.com/pyoncord/pyoncord) is my very own mod, and is currently in a very WIP but usable state. + +### Discord server? +I'm not so much of an active Discord user myself. Since I'm ~~*a loner*~~ alone, managing a Discord server would be tough. Though, I still have created [a server for Pyoncord](https://discord.gg/97QVKX4z) for the sake of support (using GitHub issues is much preferable). ## Installing -Pyondetta's codebase is platform-agnostic, but you need a platform-specific loader. +Bunny's codebase is platform-agnostic, but you need a platform-specific loader. > [!NOTE] -> - As of now, Pyoncord/Pyondetta does not have a proper independent loader. -> - However, you may use Vendetta's loader (VendettaXposed, VendettaTweak) and override loader url to [Pyondetta](https://raw.githubusercontent.com/pyoncord/detta-builds/main/pyondetta.js) (read [#Contributing > 7](#contributing)) -> - Once our own independent loader is ready, support for Vendetta loader will cease +> - As of now, Pyoncord/Bunny does not have a proper independent loader. +> - However, you may use Vendetta's loader (VendettaXposed, VendettaTweak) and override loader url to [Bunny](https://raw.githubusercontent.com/pyoncord/detta-builds/main/bunny.js) (read [#Contributing > 7](#contributing)) +> - Once our own independent loader is ready, support for Vendetta loader will be ceased ### Android * Root - [VendettaXposed](https://github.com/vendetta-mod/VendettaXposed/releases/latest) @@ -26,25 +36,14 @@ Pyondetta's codebase is platform-agnostic, but you need a platform-specific load * Jailed - You can get IPAs from [the thread](https://discord.com/channels/1015931589865246730/1087295482667208766) in our [Discord server](https://discord.gg/n9QQ4XhhJP) or from our [host](https://discord.k6.tf/ios/). - These IPAs do *not* work with AltStore! You should use [Sideloadly](https://sideloadly.io). -## FAQs - -### Why Pyondetta? -Pyondetta is a fork from a maintainer of the good Vendetta, and is still passionate to work with Discord mods. Since Vendetta has reached EOL, Pyondetta was created to publish what I have been working behind the scenes. - -### Pyondetta vs Pyoncord -Pyoncord and Pyondetta is a completely different mod. Pyoncord is my very own mod, and is in a very WIP project - -### Discord server? -I'm not so much of an active Discord user myself. Since I'm ~~*a loner*~~ alone, managing a Discord server would be tough. Though, I still have created [a server for Pyoncord](https://discord.gg/97QVKX4z) for the sake of support (using GitHub issues is much preferable). - ## Contributing -1. Install a Pyondetta loader with loader config support (any mentioned in the [Installing](#installing) section). +1. Install a Bunny loader with loader config support (any mentioned in the [Installing](#installing) section). 2. Go to Settings > General and enable Developer Settings. 3. Clone the repo: ``` - git clone https://github.com/pyoncord/pyondetta + git clone https://github.com/pyoncord/bunny ``` 4. Install dependencies: @@ -53,7 +52,7 @@ I'm not so much of an active Discord user myself. Since I'm ~~*a loner*~~ alone, ``` `npm` or `yarn` should also work. -5. Build Pyondetta's code: +5. Build Bunny's code: ``` pnpm build ``` @@ -63,6 +62,6 @@ I'm not so much of an active Discord user myself. Since I'm ~~*a loner*~~ alone, 7. Go to Settings > Developer enabled earlier). Enable `Load from custom url` and input the IP address and port of the server (e.g. e.g. `http://192.168.1.236:4040`) in the new input box labelled `VENDETTA URL`. -8. Restart Discord. Upon reload, you should notice that your device will download Pyondetta's bundled code from your server, rather than GitHub. +8. Restart Discord. Upon reload, you should notice that your device will download Bunny's bundled code from your server, rather than GitHub. 9. Make your changes, rebuild, reload, go wild! diff --git a/build.mjs b/build.mjs index dd3bd9c..785ef32 100644 --- a/build.mjs +++ b/build.mjs @@ -2,8 +2,10 @@ import swc from "@swc/core"; import { execSync } from "child_process"; import esbuild from "esbuild"; -import { readFile } from "fs/promises"; +import { copyFile, copyFileSync } from "fs"; +import { readFile, writeFile } from "fs/promises"; import { createServer } from "http"; +import path from "path"; import { argv } from "process"; const isFlag = (s, l) => argv.slice(2).some(c => c === `-${s}` || c === `--${l}`); @@ -28,14 +30,14 @@ try { // accepts it, but it's treated just like 'var' and causes issues "const-and-let": false }, - outfile: "dist/pyondetta.js", + outfile: "dist/bunny.js", keepNames: true, define: { __vendettaIsDev: `${!isRelease}`, __vendettaVersion: `"${isRelease ? commitHash : timeHash}"`, }, footer: { - js: "//# sourceURL=pyondetta" + js: "//# sourceURL=bunny" }, loader: { ".png": "dataurl" }, legalComments: "none", @@ -70,7 +72,11 @@ try { name: "buildLog", setup: async build => { build.onStart(() => console.log(`Building with commit hash "${commitHash}", isRelease="${isRelease}", timeHash="${timeHash}"`)); - build.onEnd(result => console.log(`Built with ${result.errors?.length} errors!`)); + build.onEnd(result => { + const { outfile } = build.initialOptions; + copyFileSync(outfile, path.resolve(outfile, "..", "pyondetta.js")) + console.log(`Built with ${result.errors?.length} errors!`); + }); } } ] @@ -86,10 +92,10 @@ try { const server = createServer(async (req, res) => { try { - if (req.url === "/vendetta.js" || req.url === "/pyoncord.js" || req.url === "/pyondetta.js") { + if (req.url === "/vendetta.js" || req.url === "/pyoncord.js" || req.url === "/bunny.js") { await ctx.rebuild(); res.writeHead(200); - res.end(await readFile("./dist/pyondetta.js"), "utf-8"); + res.end(await readFile("./dist/bunny.js"), "utf-8"); } else { res.writeHead(404); res.end(); diff --git a/package.json b/package.json index 7fd27bf..23c2b29 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "pyondetta", + "name": "bunny", "version": "1.0.0", - "description": "A mod for Discord's mobile apps.", + "description": "A mod for Discord's mobile apps, fork of Vendetta.", "scripts": { "dev": "node build.mjs", "build": "node build.mjs --release", @@ -12,7 +12,9 @@ "discord", "android", "ios", - "react native" + "react native", + "vendetta", + "bunny" ], "author": "pylixonly, Team Vendetta", "license": "BSD-3-Clause", diff --git a/src/entry.ts b/src/entry.ts index e25b792..f6102fa 100644 --- a/src/entry.ts +++ b/src/entry.ts @@ -1,7 +1,7 @@ import { ClientInfoManager } from "@lib/native"; // This logs in the native logging implementation, e.g. logcat -console.log("Hello from Pyondetta!"); +console.log("Hello from Bunny! Pyon!"); // Make 'freeze' and 'seal' do nothing Object.freeze = Object; diff --git a/src/index.ts b/src/index.ts index d32c177..23100bf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import { patchLogHook } from "@lib/debug"; import { patchCommands } from "@lib/commands"; import { initPlugins } from "@lib/plugins"; -import { patchChatBackground } from "@lib/themes"; +import { initThemes, patchChatBackground } from "@lib/themes"; import { patchAssets } from "@ui/assets"; import initQuickInstall from "@ui/quickInstall"; import initSafeMode from "@ui/safeMode"; @@ -10,6 +10,7 @@ import initFixes from "@lib/fixes"; import logger from "@lib/logger"; import windowObject from "@lib/windowObject"; +initThemes() export default async () => { // Load everything in parallel const unloads = await Promise.all([ diff --git a/src/lib/plugins.ts b/src/lib/plugins.ts index d4dc167..9d0b346 100644 --- a/src/lib/plugins.ts +++ b/src/lib/plugins.ts @@ -62,7 +62,7 @@ export async function evalPlugin(plugin: Plugin) { // Wrapping this with wrapSync is NOT an option. storage: await createStorage>(createMMKVBackend(plugin.id)), }, - logger: new logModule(`Pyondetta » ${plugin.manifest.name}`), + logger: new logModule(`Bunny » ${plugin.manifest.name}`), }; const pluginString = `vendetta=>{return ${plugin.js}}\n//# sourceURL=${plugin.id}`; diff --git a/src/ui/settings/components/SettingsSection.tsx b/src/ui/settings/components/SettingsSection.tsx index e743846..9f0b646 100644 --- a/src/ui/settings/components/SettingsSection.tsx +++ b/src/ui/settings/components/SettingsSection.tsx @@ -15,7 +15,7 @@ export default function SettingsSection() { return ( - + {screens.map((s, i) => ( <> { return { getLayout: () => ({ - title: "Pyondetta", - label: "Pyondetta", + title: "Bunny", + label: "Bunny", // We can't use our keyMap function here since `settings` is an array not an object settings: getRenderableScreens(true).map(s => s.key) }), diff --git a/src/ui/settings/pages/Developer.tsx b/src/ui/settings/pages/Developer.tsx index 62f8adb..1d36852 100644 --- a/src/ui/settings/pages/Developer.tsx +++ b/src/ui/settings/pages/Developer.tsx @@ -61,7 +61,7 @@ export default function Developer() { } value={loaderConfig.customLoadUrl.enabled} onValueChange={(v: boolean) => { @@ -73,7 +73,7 @@ export default function Developer() { size="md" onChange={(v: string) => loaderConfig.customLoadUrl.url = v} placeholder="http://localhost:4040/vendetta.js" - label="Pyondetta URL" + label="Bunny URL" />} />} {window.__vendetta_loader.features.devtools && navigation.push("VendettaCustomPage", { render: () => }) }, + { label: "Bunny", onPress: () => navigation.push("VendettaCustomPage", { render: () => }) }, { label: "Discord", isDestructive: true, onPress: () => navigation.push("VendettaCustomPage", { noErrorBoundary: true }) }, ], })} diff --git a/src/ui/settings/pages/General.tsx b/src/ui/settings/pages/General.tsx index 5996526..e1ba331 100644 --- a/src/ui/settings/pages/General.tsx +++ b/src/ui/settings/pages/General.tsx @@ -24,7 +24,7 @@ export default function General() { const versions = [ { - label: "Pyondetta", + label: "Bunny", version: debugInfo.vendetta.version, icon: "ic_progress_wrench_24px", }, diff --git a/src/ui/settings/patches/you.tsx b/src/ui/settings/patches/you.tsx index 6624150..453e6c3 100644 --- a/src/ui/settings/patches/you.tsx +++ b/src/ui/settings/patches/you.tsx @@ -44,7 +44,7 @@ function oldYouPatch(patches: Function[]) { ancestorRendererData: data.rendererConfigs[s.key], setting: s.key, title: data.titleConfig[s.key], - breadcrumbs: ["Pyondetta"], + breadcrumbs: ["Bunny"], icon: data.rendererConfigs[s.key].icon, })), // .filter can be removed when dropping support for 189.3 and below (unless Discord changes things again) @@ -78,7 +78,7 @@ function newYouPatch(patches: Function[]) { patches.push(before("type", settingsListComponents.SearchableSettingsList, ([{ sections }]) => manipulateSections(sections, data.getLayout()))); patches.push(after("getSettingListSearchResultItems", gettersModule, (_, ret) => { - ret.forEach((s: any) => screens.some(b => b.key === s.setting) && (s.breadcrumbs = ["Pyondetta"])) + ret.forEach((s: any) => screens.some(b => b.key === s.setting) && (s.breadcrumbs = ["Bunny"])) })); const oldRendererConfig = settingConstantsModule.SETTING_RENDERER_CONFIG; @@ -94,7 +94,7 @@ function newYouPatch(patches: Function[]) { const isLabel = (i: any, name: string) => i?.label === name || i?.title === name; function manipulateSections(sections: any[], layout: any) { - if (!Array.isArray(sections) || sections.find((i: any) => isLabel(i, "Pyondetta"))) return; + if (!Array.isArray(sections) || sections.find((i: any) => isLabel(i, "Bunny"))) return; // Add our settings const accountSettingsIndex = sections.findIndex((i: any) => isLabel(i, i18n.Messages.ACCOUNT_SETTINGS));