From 39f64ca6667a0e8703a7a52d6e2bf0da57ee2cb6 Mon Sep 17 00:00:00 2001
From: marios8543 <marios8543@gmail.com>
Date: Tue, 17 Oct 2023 16:07:43 +0300
Subject: Drop support for legacy plugins

---
 frontend/src/plugin-loader.tsx | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

(limited to 'frontend/src/plugin-loader.tsx')

diff --git a/frontend/src/plugin-loader.tsx b/frontend/src/plugin-loader.tsx
index b27a19bb..e5f69f1f 100644
--- a/frontend/src/plugin-loader.tsx
+++ b/frontend/src/plugin-loader.tsx
@@ -13,7 +13,6 @@ import { FC, lazy } from 'react';
 import { FaExclamationCircle, FaPlug } from 'react-icons/fa';
 
 import { DeckyState, DeckyStateContextProvider, UserInfo, useDeckyState } from './components/DeckyState';
-import LegacyPlugin from './components/LegacyPlugin';
 import { File, FileSelectionType } from './components/modals/filepicker';
 import { deinitFilepickerPatches, initFilepickerPatches } from './components/modals/filepicker/patches';
 import MultiplePluginsInstallModal from './components/modals/MultiplePluginsInstallModal';
@@ -238,7 +237,7 @@ class PluginLoader extends Logger {
 
   public unloadPlugin(name: string) {
     console.log('Plugin List: ', this.plugins);
-    const plugin = this.plugins.find((plugin) => plugin.name === name || plugin.name === name.replace('$LEGACY_', ''));
+    const plugin = this.plugins.find((plugin) => plugin.name === name);
     plugin?.onDismount?.();
     this.plugins = this.plugins.filter((p) => p !== plugin);
     this.deckyState.setPlugins(this.plugins);
@@ -256,12 +255,7 @@ class PluginLoader extends Logger {
       this.log(`Trying to load ${name}`);
 
       this.unloadPlugin(name);
-
-      if (name.startsWith('$LEGACY_')) {
-        await this.importLegacyPlugin(name.replace('$LEGACY_', ''));
-      } else {
-        await this.importReactPlugin(name, version);
-      }
+      await this.importReactPlugin(name, version);
 
       this.deckyState.setPlugins(this.plugins);
       this.log(`Loaded ${name}`);
@@ -342,15 +336,6 @@ class PluginLoader extends Logger {
     } else throw new Error(`${name} frontend_bundle not OK`);
   }
 
-  private async importLegacyPlugin(name: string) {
-    const url = `http://127.0.0.1:1337/plugins/load_main/${name}`;
-    this.plugins.push({
-      name: name,
-      icon: <FaPlug />,
-      content: <LegacyPlugin url={url} />,
-    });
-  }
-
   async callServerMethod(methodName: string, args = {}) {
     const response = await fetch(`http://127.0.0.1:1337/methods/${methodName}`, {
       method: 'POST',
-- 
cgit v1.2.3

