From 6522ebf0cad1723a278144b6c5d8557cd47e52d6 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Sat, 30 Dec 2023 00:46:59 -0500 Subject: Implement legacy & modern plugin method calls over WS This version builds fine and runs all of the 14 plugins I have installed perfectly, so we're really close to having this done. --- frontend/src/components/settings/pages/plugin_list/index.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'frontend/src/components') diff --git a/frontend/src/components/settings/pages/plugin_list/index.tsx b/frontend/src/components/settings/pages/plugin_list/index.tsx index 09d06d48..6475b40a 100644 --- a/frontend/src/components/settings/pages/plugin_list/index.tsx +++ b/frontend/src/components/settings/pages/plugin_list/index.tsx @@ -35,6 +35,8 @@ async function reinstallPlugin(pluginName: string, currentVersion?: string) { type PluginTableData = PluginData & { name: string; hidden: boolean; onHide(): void; onShow(): void }; +const reloadPluginBackend = window.DeckyBackend.callable<[pluginName: string], void>('loader/reload_plugin'); + function PluginInteractables(props: { entry: ReorderableEntry }) { const { t } = useTranslation(); @@ -49,15 +51,9 @@ function PluginInteractables(props: { entry: ReorderableEntry } showContextMenu( { + onSelected={async () => { try { - fetch(`http://127.0.0.1:1337/plugins/${name}/reload`, { - method: 'POST', - credentials: 'include', - headers: { - Authentication: window.deckyAuthToken, - }, - }); + await reloadPluginBackend(name); } catch (err) { console.error('Error Reloading Plugin Backend', err); } -- cgit v1.2.3