Skip to content

Commit

Permalink
stuff?
Browse files Browse the repository at this point in the history
  • Loading branch information
byeoon committed Oct 24, 2024
1 parent 385346b commit 07504c5
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/core-plugins/NoTracking.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Thanks aliucord
// I swear im not trying to steal the directory.
import { FluxDispatcher, moment } from "@metro/common";
import { findByProps } from "@metro/filters";
import { insteadDoNothing } from "@/lib/patcher";

Expand Down
17 changes: 17 additions & 0 deletions src/lib/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,23 @@ export async function evalPlugin(plugin: Plugin) {
return ret?.default ?? ret ?? {};
}

export async function evalCorePlugins(plugin: Plugin) {
const vendettaForPlugins = {
...window.vendetta,
plugin: {
id: plugin.id,
// Wrapping this with wrapSync is NOT an option.
storage: await createStorage<Record<string, any>>(createMMKVBackend(plugin.id)),
},
logger: new logModule(`Opti Core Plugin » ${plugin.id}`),
};
const pluginString = `vendetta=>{return ${plugin.js}}\n//# sourceURL=${plugin.id}`;

const raw = (0, eval)(pluginString)(vendettaForPlugins);
const ret = typeof raw == "function" ? raw() : raw;
return ret?.default ?? ret ?? {};
}

export async function startPlugin(id: string) {
if (!id.endsWith("/")) id += "/";
const plugin = plugins[id];
Expand Down
6 changes: 5 additions & 1 deletion src/lib/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export async function initThemes() {
//! Native code is required here!
// Awaiting the sync wrapper is too slow, to the point where semanticColors are not correctly overwritten.
// We need a workaround, and it will unfortunately have to be done on the native side.
// await awaitSyncWrapper(themes);
await awaitSyncWrapper(themes);

const selectedTheme = getCurrentTheme();
if (!selectedTheme) return;
Expand Down Expand Up @@ -233,4 +233,8 @@ function extractInfo(themeMode: string, colorObj: any): [name: string, colorDef:
const colorDef = color.SemanticColor[propName];

return [propName, colorDef[themeMode.toLowerCase()]];
}

function getThemes() {
// TODO: finish
}
1 change: 0 additions & 1 deletion src/ui/settings/components/AddonPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default function AddonPage<T>({ items, safeModeMessage, safeModeExtras, c

return (
<ErrorBoundary>
{/* TODO: Implement better searching than just by ID */}
<RN.FlatList
ListHeaderComponent={<>
{settings.safeMode?.enabled && <RN.View style={{ marginBottom: 10 }}>
Expand Down
1 change: 0 additions & 1 deletion src/ui/settings/components/PluginCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default function PluginCard({ item: plugin, index }: CardWrapper<Plugin>)
return (
<Card
index={index}
// TODO: Actually make use of user IDs
headerLabel={`${plugin.manifest.name}`}
headerIcon={plugin.manifest.vendetta?.icon || "ic_application_command_24px"}
toggleType="switch"
Expand Down
2 changes: 1 addition & 1 deletion src/ui/settings/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const getScreens = (youKeys = false): Screen[] => [
if (!input.startsWith(PROXY_PREFIX) && !settings.developerSettings)
setImmediate(() => showConfirmationAlert({
title: "Unproxied Plugin",
content: "The plugin you are trying to install has not been proxied/verified by Vendetta staff. Are you sure you want to continue?",
content: "The plugin you are trying to install has not been verified by Opti staff. Are you sure you want to continue?",
confirmText: "Install",
onConfirm: () =>
installPlugin(input)
Expand Down

0 comments on commit 07504c5

Please sign in to comment.