Skip to content

Commit

Permalink
added proxy support (vendetta and opti proxy)
Browse files Browse the repository at this point in the history
  • Loading branch information
byeoon committed May 16, 2024
1 parent 17b625b commit 81bdb68
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
16 changes: 8 additions & 8 deletions dist/vendetta.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/def.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ interface Plugin {
js: string;
}

interface Tweak {
id: string;
name: string;
enabled: boolean;
}

interface ThemeData {
name: string;
description?: string;
Expand Down
3 changes: 2 additions & 1 deletion src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export const PLUGINS_CHANNEL_ID = "1228464451846672465";
export const THEMES_CHANNEL_ID = "1228464459295756358";
export const GITHUB = "https://github.com/opti-mod";
export const BADGES = 'https://raw.githubusercontent.com/opti-mod/badges/main/';
export const PROXY_PREFIX = "https://vd-plugins.github.io/proxy"; // wip
export const PROXY_PREFIX = "https://opti-mod.github.io/proxy/";
export const VENDETTA_PROXY = "https://vd-plugins.github.io/proxy/";

export const HTTP_REGEX = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/;
export const HTTP_REGEX_MULTI = /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g;
4 changes: 2 additions & 2 deletions src/ui/quickInstall/url.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { findByProps, find } from "@metro/filters";
import { ReactNative as RN, channels, url } from "@metro/common";
import { PROXY_PREFIX, THEMES_CHANNEL_ID } from "@lib/constants";
import { PROXY_PREFIX, THEMES_CHANNEL_ID, VENDETTA_PROXY } from "@lib/constants";
import { after, instead } from "@lib/patcher";
import { installPlugin } from "@lib/plugins";
import { installTheme } from "@lib/themes";
Expand All @@ -17,7 +17,7 @@ const { getChannel } = findByProps("getChannel");
const { TextStyleSheet } = findByProps("TextStyleSheet");

function typeFromUrl(url: string) {
if (url.startsWith(PROXY_PREFIX)) {
if (url.startsWith(PROXY_PREFIX) || url.startsWith(VENDETTA_PROXY)) {
return "Plugin";
} else if (url.endsWith(".json") && window.__vendetta_loader?.features.themes) {
return "Theme";
Expand Down
4 changes: 2 additions & 2 deletions src/ui/settings/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import InstallButton from "@ui/settings/components/InstallButton";
import General from "@ui/settings/pages/General";
import Plugins from "@ui/settings/pages/Plugins";
import Themes from "@ui/settings/pages/Themes";
import { PROXY_PREFIX } from "@/lib/constants";
import { PROXY_PREFIX, VENDETTA_PROXY } from "@/lib/constants";
import TweakManager from "@ui/settings/pages/TweakManager";
import { Forms } from "@ui/components";
import Addons from "@ui/settings/pages/Addons"
Expand Down Expand Up @@ -63,7 +63,7 @@ export const getScreens = (youKeys = false): Screen[] => [
if(input.endsWith(".json")) {
return await installTheme(input);
}
if (!input.startsWith(PROXY_PREFIX))
if (!input.startsWith(PROXY_PREFIX) || !input.startsWith(VENDETTA_PROXY))
setImmediate(() => showConfirmationAlert({
title: "Unproxied Plugin",
content: "The plugin you are trying to install has not been proxied. Want to download it anyways?",
Expand Down
2 changes: 1 addition & 1 deletion src/ui/settings/pages/Addons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function Addons() {
{
id: 'tweaks',
title: 'Tweaks',
page: () => <AddonPage<Tweaks> items={themes} card={ThemeCard} />
page: () => <AddonPage<Theme> items={themes} card={ThemeCard} />
}

];
Expand Down

0 comments on commit 81bdb68

Please sign in to comment.