Skip to content

Commit 926fb1f

Browse files
authored
feat: improvements (#204)
2 parents dce3fa3 + 5d44e13 commit 926fb1f

File tree

27 files changed

+478
-276
lines changed

27 files changed

+478
-276
lines changed

bun.lock

Lines changed: 16 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
},
4141
"dependencies": {
4242
"@gullerya/object-observer": "^6.1.4",
43+
"@revenge-mod/devtools-client": "^1.1.3",
44+
"@revenge-mod/devtools-shared": "^1.0.2",
4345
"@shopify/react-native-skia": "^1.12.4",
4446
"@tanstack/react-query": "^5.83.0",
4547
"@types/chroma-js": "~2.4.5",

scripts/adb.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function getPackageName() {
1010
export function isADBAvailableAndAppInstalled() {
1111
try {
1212
const out = execSync(`adb shell pm list packages ${packageName}`);
13-
return out.toString().trimEnd() === `package:${packageName}`;
13+
return out.toString().trim().split("\n").includes(`package:${packageName}`);
1414
} catch {
1515
return false;
1616
}

scripts/build.mjs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { execFileSync, execSync } from "child_process";
55
import crypto from "crypto";
66
import { build } from "esbuild";
77
import globalPlugin from "esbuild-plugin-globals";
8+
import { readFile } from "fs/promises";
89
import path from "path";
910
import { fileURLToPath } from "url";
1011
import yargs from "yargs-parser";
1112

1213
import { printBuildSuccess } from "./util.mjs";
13-
import { readFile } from "fs/promises";
1414

1515
/** @type string[] */
1616
const metroDeps = await (async () => {
@@ -34,7 +34,9 @@ const config = {
3434
outfile: "dist/revenge.js",
3535
format: "iife",
3636
splitting: false,
37-
external: [],
37+
external: [
38+
"node:*"
39+
],
3840
supported: {
3941
// Hermes does not actually support const and let, even though it syntactically
4042
// accepts it, but it's treated just like 'var' and causes issues
@@ -123,22 +125,22 @@ export async function buildBundle(overrideConfig = {}) {
123125
await build({ ...config, ...overrideConfig });
124126

125127
const paths = {
126-
win32: 'win64-bin/hermesc.exe',
127-
darwin: 'osx-bin/hermesc',
128-
linux: 'linux64-bin/hermesc',
129-
}
128+
win32: "win64-bin/hermesc.exe",
129+
darwin: "osx-bin/hermesc",
130+
linux: "linux64-bin/hermesc",
131+
};
130132

131133
if (!(process.platform in paths))
132-
throw new Error(`Unsupported platform: ${process.platform}`)
134+
throw new Error(`Unsupported platform: ${process.platform}`);
133135

134-
const sdksDir = './node_modules/react-native/sdks'
135-
const binPath = `${sdksDir}/hermesc/${paths[process.platform]}`
136+
const sdksDir = "./node_modules/react-native/sdks";
137+
const binPath = `${sdksDir}/hermesc/${paths[process.platform]}`;
136138

137139
const actualFile = overrideConfig.outfile ?? config.outfile;
138140

139-
execFileSync(binPath, ['-finline', '-strict', '-O', '-g1', '-reuse-prop-cache', '-optimized-eval', '-emit-binary', '-Wno-undefined-variable', '-out', actualFile], {
141+
execFileSync(binPath, ["-finline", "-strict", "-O", "-g1", "-reuse-prop-cache", "-optimized-eval", "-emit-binary", "-Wno-undefined-variable", "-out", actualFile], {
140142
input: await readFile(actualFile),
141-
stdio: 'pipe'
143+
stdio: "pipe"
142144
});
143145

144146
return {

src/core/i18n/default.json

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
"ARE_YOU_SURE_TO_DELETE_THEME": "Are you sure you wish to delete {name}?",
77
"ASSET_BROWSER": "Asset Browser",
88
"BRAND": "Brand",
9-
"BUNNY": "Revenge",
109
"BUNNY_URL": "Revenge URL",
10+
"BUNNY": "Revenge",
1111
"BYTECODE": "Bytecode",
1212
"CANCEL": "Cancel",
13-
"CLEAR": "Clear",
14-
"CLEAR_BUNDLE": "Clear JS Bundle",
1513
"CLEAR_BUNDLE_DESC": "Clear the cached bundle. This will force a re-download of the bundle next app launch.",
16-
"CLEAR_DATA": "Clear Data",
14+
"CLEAR_BUNDLE": "Clear JS Bundle",
1715
"CLEAR_DATA_FAILED": "Failed to clear data for {name}",
1816
"CLEAR_DATA_SUCCESSFUL": "Cleared data for {name}",
17+
"CLEAR_DATA": "Clear Data",
18+
"CLEAR": "Clear",
1919
"CODENAME": "Codename",
2020
"COMMAND_DEBUG_DESC": "Send debug information",
2121
"COMMAND_DEBUG_OPT_EPHEMERALLY": "Send the message ephemerally",
@@ -26,23 +26,29 @@
2626
"COMMAND_PLUGINS_OPT_EPHEMERALLY": "Send the message ephemerally",
2727
"COMPONENT": "Component",
2828
"CONFIRMATION_LINK_IS_A_TYPE": "This link is a **{urlType, select, plugin {Plugin} theme {Theme} other {Add-on}}**, would you like to install it?",
29-
"CONNECT_TO_DEBUG_WEBSOCKET": "Connect to debug WebSocket",
29+
"CONNECT_TO_DEBUG_WEBSOCKET": "Connect to DevTools",
3030
"CONNECT_TO_REACT_DEVTOOLS": "Connect to React DevTools",
31+
"CONNECTED_TO_DEBUGGER": "Connected to DevTools",
32+
"CONNECTED_TO_REACT_DEVTOOLS": "Connected to React DevTools",
3133
"CONTINUE": "Continue",
3234
"COPIED_TO_CLIPBOARD": "Copied to clipboard",
3335
"COPY_URL": "Copy URL",
3436
"DEBUG": "Debug",
37+
"DEBUGGER_AUTOCONNECT_DESC": "Automatically connect to the DevTools during startup",
38+
"DEBUGGER_AUTOCONNECT": "Auto-connect to DevTools",
3539
"DEBUGGER_URL": "Debugger URL",
3640
"DELETE": "Delete",
3741
"DESC_EXTRACT_FONTS_FROM_THEME": "Looks out for \"fonts\" field in your currently applied theme and install it.",
38-
"DEVELOPER": "Developer",
3942
"DEVELOPER_SETTINGS": "Developer Settings",
43+
"DEVELOPER": "Developer",
4044
"DISABLE_THEME": "Disable Theme",
4145
"DISABLE_UPDATES": "Disable Updates",
46+
"DISCONNECT_FROM_DEBUG_WEBSOCKET": "Disconnect from DevTools",
47+
"DISCONNECT_FROM_REACT_DEVTOOLS": "Disconnect from React DevTools",
4248
"DISCORD_SERVER": "Discord Server",
4349
"DONE": "Done",
44-
"ENABLE_EVAL_COMMAND": "Enable /eval command",
4550
"ENABLE_EVAL_COMMAND_DESC": "Evaluate JavaScript directly from a command. Be cautious when using this command as it may pose a security risk. Make sure to know what you are doing.",
51+
"ENABLE_EVAL_COMMAND": "Enable /eval command",
4652
"ENABLE_UPDATES": "Enable Updates",
4753
"ERROR_BOUNDARY_TOOLS_LABEL": "ErrorBoundary Tools",
4854
"EXTRACT": "Extract",
@@ -52,26 +58,26 @@
5258
"GITHUB": "GitHub",
5359
"HOLD_UP": "Hold Up",
5460
"INFO": "Info",
55-
"INSTALL": "Install",
5661
"INSTALL_ADDON": "Install an add-on",
5762
"INSTALL_FONT": "Install a font",
5863
"INSTALL_PLUGIN": "Install a plugin",
5964
"INSTALL_REACT_DEVTOOLS": "Install React DevTools",
6065
"INSTALL_THEME": "Install a theme",
66+
"INSTALL": "Install",
6167
"LABEL_EXTRACT_FONTS_FROM_THEME": "Extract font from theme",
6268
"LINKS": "Links",
63-
"LOAD_FROM_CUSTOM_URL": "Load from custom URL",
6469
"LOAD_FROM_CUSTOM_URL_DEC": "Load Revenge from a custom endpoint",
70+
"LOAD_FROM_CUSTOM_URL": "Load from custom URL",
6571
"LOAD_REACT_DEVTOOLS": "Load React DevTools",
6672
"LOADER": "Loader",
6773
"MACHINE_ID": "Machine ID",
6874
"MANUFACTURER": "Manufacturer",
6975
"MESSAGE": "Message",
7076
"MISCELLANEOUS": "Miscellaneous",
71-
"MODAL_RELOAD_REQUIRED": "Reload app?",
7277
"MODAL_RELOAD_REQUIRED_DESC": "A reload is required to see the changes. Do you want to reload now?",
73-
"MODAL_THEME_REFETCHED": "Theme refetched",
78+
"MODAL_RELOAD_REQUIRED": "Reload app?",
7479
"MODAL_THEME_REFETCHED_DESC": "A reload is required to see the changes. Do you want to reload now?",
80+
"MODAL_THEME_REFETCHED": "Theme refetched",
7581
"MODAL_UNPROXIED_PLUGIN_DESC": "The plugin you are trying to install has not been proxied/verified by staff. Are you sure you want to continue?",
7682
"MODAL_UNPROXIED_PLUGIN_HEADER": "Unproxied Plugin",
7783
"MODEL": "Model",
@@ -83,36 +89,36 @@
8389
"PLUGIN_REFETCH_SUCCESSFUL": "Successfully refetched plugin",
8490
"PLUGINS": "Plugins",
8591
"REFETCH": "Refetch",
86-
"RELOAD": "Reload",
8792
"RELOAD_DISCORD": "Reload Discord",
88-
"RELOAD_IN_NORMAL_MODE": "Reload in Normal Mode",
8993
"RELOAD_IN_NORMAL_MODE_DESC": "Safe mode currently enabled, tap to reload in normal mode",
90-
"RELOAD_IN_SAFE_MODE": "Reload in Safe Mode",
94+
"RELOAD_IN_NORMAL_MODE": "Reload in Normal Mode",
9195
"RELOAD_IN_SAFE_MODE_DESC": "Tap to reload Discord without loading addons",
96+
"RELOAD_IN_SAFE_MODE": "Reload in Safe Mode",
97+
"RELOAD": "Reload",
9298
"REMOVE": "Remove",
9399
"RESTART_REQUIRED_TO_TAKE_EFFECT": "Restart is required to take effect",
94-
"RETRY": "Retry",
95100
"RETRY_RENDER": "Retry Render",
96-
"SAFE_MODE": "Safe Mode",
101+
"RETRY": "Retry",
97102
"SAFE_MODE_NOTICE_FONTS": "You are in safe mode, meaning fonts have been temporarily disabled. {enabled, select, true {If a font appears to be causing the issue, you can press below to disable it persistently.} other {}}",
98103
"SAFE_MODE_NOTICE_PLUGINS": "You are in safe mode, so plugins cannot be loaded. Disable any misbehaving plugins, then return to Normal Mode from the General settings page.",
99104
"SAFE_MODE_NOTICE_THEMES": "You are in safe mode, meaning themes have been temporarily disabled. {enabled, select, true {If a theme appears to be causing the issue, you can press below to disable it persistently.} other {}}",
105+
"SAFE_MODE": "Safe Mode",
100106
"SEARCH": "Search",
101107
"SEPARATOR": ", ",
102-
"SETTINGS_ACTIVATE_DISCORD_EXPERIMENTS": "Activate Discord Experiments",
103108
"SETTINGS_ACTIVATE_DISCORD_EXPERIMENTS_DESC": "Warning: Messing with this feature may lead to account termination. We are not responsible for what you do with this feature.",
109+
"SETTINGS_ACTIVATE_DISCORD_EXPERIMENTS": "Activate Discord Experiments",
104110
"STACK_TRACE": "Stack Trace",
105111
"SUCCESSFULLY_INSTALLED": "Successfully installed",
106112
"THEME_EXTRACTOR_DESC": "This pack overrides the following: {fonts}",
107113
"THEME_REFETCH_FAILED": "Failed to refetch theme",
108114
"THEME_REFETCH_SUCCESSFUL": "Successfully refetched theme",
109-
"THEMES": "Themes",
110115
"THEMES_RELOAD_FOR_CHANGES": "Reload the app to fully apply changes",
116+
"THEMES": "Themes",
111117
"TOASTS_INSTALLED_PLUGIN": "Installed plugin",
112118
"TOASTS_PLUGIN_UPDATE": "{update, select, true {Enabled} other {Disabled}} updates for {name}",
113119
"UH_OH": "Uh Oh",
114-
"UNINSTALL": "Uninstall",
115120
"UNINSTALL_TITLE": "Uninstall {title}",
121+
"UNINSTALL": "Uninstall",
116122
"URL_PLACEHOLDER": "https://github.com/revenge-mod",
117123
"VERSION": "Version",
118124
"VERSIONS": "Versions"

src/core/plugins/quickinstall/forumPost.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function useInstaller(thread: any, firstMessage = null, actionSheet = false): [t
7777
try {
7878
await postMap[postType].installOrRemove(url);
7979
} catch (e: any) {
80-
showToast(e.message, findAssetId("Small"));
80+
showToast(e.message, findAssetId("XSmallIcon"));
8181
} finally {
8282
setIsInstalling(false);
8383
}
@@ -96,7 +96,7 @@ function useInstaller(thread: any, firstMessage = null, actionSheet = false): [t
9696

9797
// actions.unshift(<ActionsSection key="install">
9898
// <ActionSheetRow
99-
// icon={<ActionSheetRow.Icon source={getAssetIDByName(installed ? "ic_message_delete" : "DownloadIcon")} />}
99+
// icon={<ActionSheetRow.Icon source={getAssetIDByName(installed ? "TrashIcon" : "DownloadIcon")} />}
100100
// label={formatString(installed ? "UNINSTALL_TITLE" : "INSTALL_TITLE", { title: postType })}
101101
// disabled={loading}
102102
// onPress={installOrRemove}
@@ -119,7 +119,7 @@ const installButtonPatch = () => after("MostCommonForumPostReaction", forumReact
119119
variant={installed ? "secondary" : "primary"}
120120
text={installed ? Strings.UNINSTALL : Strings.INSTALL}
121121
onPress={installOrRemove}
122-
icon={findAssetId(installed ? "ic_message_delete" : "DownloadIcon")}
122+
icon={findAssetId(installed ? "TrashIcon" : "DownloadIcon")}
123123
style={{ marginLeft: 8 }}
124124
/>
125125
</ErrorBoundary>

src/core/plugins/quickinstall/url.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ function typeFromUrl(url: string) {
3030
function installWithToast(type: "plugin" | "theme", url: string) {
3131
(type === "plugin" ? VdPluginManager.installPlugin.bind(VdPluginManager) : installTheme)(url)
3232
.then(() => {
33-
showToast(Strings.SUCCESSFULLY_INSTALLED, findAssetId("Check"));
33+
showToast(Strings.SUCCESSFULLY_INSTALLED, findAssetId("DownloadIcon"));
3434
})
3535
.catch((e: Error) => {
36-
showToast(e.message, findAssetId("Small"));
36+
showToast(e.message, findAssetId("XSmallIcon"));
3737
});
3838
}
3939

src/core/ui/hooks/useFS.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ export function useFileExists(path: string, prefix?: string): [CheckState, typeo
2121
if (typeof val !== "function") return;
2222

2323
return (...args: any[]) => {
24-
const promise = (check(), val(...args));
24+
const promise = val(...args);
2525
if (promise?.constructor?.name === "Promise") {
2626
setState(CheckState.LOADING);
2727
promise.finally(check);
2828
}
29+
2930
return promise;
3031
};
3132
},

0 commit comments

Comments
 (0)