From ad2c3573ed0b0899df307e9adcd06ef48559fb00 Mon Sep 17 00:00:00 2001 From: Beef Date: Sun, 8 Jan 2023 23:24:00 +0000 Subject: [PATCH] [API] Cleanup --- src/def.d.ts | 8 ++++++++ src/index.ts | 13 ++++++++++--- src/ui/assets.ts | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/def.d.ts b/src/def.d.ts index 2f0725e..fcb767f 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -112,6 +112,14 @@ interface VendettaObject { getAssetIDByName: (name: string) => number; }; }; + plugins: { + plugins: Indexable; + fetchPlugin: (id: string) => void; + evalPlugin: (id: string) => void; + stopPlugin: (id: string) => void; + removePlugin: (id: string) => void; + getSettings: (id: string) => JSX.Element; + } logger: Logger; } diff --git a/src/index.ts b/src/index.ts index fb3a417..521415d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,11 +8,10 @@ import * as metro from "@metro/filters"; import * as common from "@metro/common"; import * as components from "@ui/components"; import * as toasts from "@ui/toasts"; -import { all, find, getAssetByID, getAssetByName, getAssetIDByName } from "@ui/assets"; -import patchAssets from "@ui/assets"; +import { patchAssets, all, find, getAssetByID, getAssetByName, getAssetIDByName } from "@ui/assets"; import initSettings from "@ui/settings"; import { connectToDebugger, patchLogHook } from "@lib/debug"; -import { initPlugins } from "@lib/plugins"; +import { initPlugins, plugins, fetchPlugin, evalPlugin, stopPlugin, removePlugin, getSettings } from "@lib/plugins"; console.log("Hello from Vendetta!"); @@ -43,6 +42,14 @@ async function init() { getAssetIDByName: getAssetIDByName, }, }, + plugins: { + plugins: plugins, + fetchPlugin: fetchPlugin, + evalPlugin: evalPlugin, + stopPlugin: stopPlugin, + removePlugin: removePlugin, + getSettings: getSettings + }, logger: logger, }; diff --git a/src/ui/assets.ts b/src/ui/assets.ts index 28ce9b6..e8f6eec 100644 --- a/src/ui/assets.ts +++ b/src/ui/assets.ts @@ -4,7 +4,7 @@ import { assets } from "@metro/common"; export const all: Indexable = {}; -export default function patchAssets() { +export function patchAssets() { try { after("registerAsset", assets, (args: Asset[], id: number) => { const asset = args[0];