From 9619c52720c97ef74842b15aa732dd0a8d6fb26a Mon Sep 17 00:00:00 2001
From: AAGaming <aa@mail.catvibers.me>
Date: Wed, 22 Jun 2022 23:22:27 -0400
Subject: add settings page with install from URL option

---
 frontend/src/components/store/Store.tsx | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

(limited to 'frontend/src/components/store/Store.tsx')

diff --git a/frontend/src/components/store/Store.tsx b/frontend/src/components/store/Store.tsx
index ebb2bb8e..0e99a3c2 100644
--- a/frontend/src/components/store/Store.tsx
+++ b/frontend/src/components/store/Store.tsx
@@ -13,6 +13,26 @@ export interface StorePlugin {
   tags: string[];
 }
 
+export async function installFromURL(url: string) {
+  const formData = new FormData();
+  formData.append('artifact', url);
+  await fetch('http://localhost:1337/browser/install_plugin', {
+    method: 'POST',
+    body: formData,
+  });
+}
+
+export async function requestPluginInstall(plugin: StorePlugin, selectedVer: string) {
+  const formData = new FormData();
+  formData.append('artifact', `https://github.com/${plugin.artifact}/archive/refs/tags/${selectedVer}.zip`);
+  formData.append('version', selectedVer);
+  formData.append('hash', plugin.versions[selectedVer]);
+  await fetch('http://localhost:1337/browser/install_plugin', {
+    method: 'POST',
+    body: formData,
+  });
+}
+
 const StorePage: FC<{}> = () => {
   const [data, setData] = useState<StorePlugin[] | null>(null);
 
-- 
cgit v1.2.3

