diff --git a/packages/napcat-onebot/network/plugin/types.ts b/packages/napcat-onebot/network/plugin/types.ts index 5469816d..448b276b 100644 --- a/packages/napcat-onebot/network/plugin/types.ts +++ b/packages/napcat-onebot/network/plugin/types.ts @@ -13,7 +13,6 @@ export interface PluginPackageJson { main?: string; description?: string; author?: string; - homepage?: string; } // ==================== 插件配置 Schema ==================== diff --git a/packages/napcat-webui-backend/src/api/Plugin.ts b/packages/napcat-webui-backend/src/api/Plugin.ts index d1ca0b98..0367ba2b 100644 --- a/packages/napcat-webui-backend/src/api/Plugin.ts +++ b/packages/napcat-webui-backend/src/api/Plugin.ts @@ -72,7 +72,6 @@ export const GetPluginListHandler: RequestHandler = async (_req, res) => { version: string; description: string; author: string; - homepage?: string; status: string; hasConfig: boolean; hasPages: boolean; @@ -110,7 +109,6 @@ export const GetPluginListHandler: RequestHandler = async (_req, res) => { version: p.version || '0.0.0', description: p.packageJson?.description || '', author: p.packageJson?.author || '', - homepage: p.packageJson?.homepage, status, hasConfig: !!(p.runtime.module?.plugin_config_schema || p.runtime.module?.plugin_config_ui), hasPages diff --git a/packages/napcat-webui-frontend/src/components/display_card/container.tsx b/packages/napcat-webui-frontend/src/components/display_card/container.tsx index 806bbe07..790d09b9 100644 --- a/packages/napcat-webui-frontend/src/components/display_card/container.tsx +++ b/packages/napcat-webui-frontend/src/components/display_card/container.tsx @@ -22,7 +22,6 @@ export interface DisplayCardProps { const DisplayCardContainer: React.FC = ({ title: _title, - tag, action, enableSwitch, children, @@ -46,8 +45,7 @@ const DisplayCardContainer: React.FC = ({ - {tag &&
{tag}
} - {enableSwitch &&
{enableSwitch}
} +
{enableSwitch}
{children} {action} diff --git a/packages/napcat-webui-frontend/src/components/display_card/plugin_card.tsx b/packages/napcat-webui-frontend/src/components/display_card/plugin_card.tsx index d884dc92..e79ab221 100644 --- a/packages/napcat-webui-frontend/src/components/display_card/plugin_card.tsx +++ b/packages/napcat-webui-frontend/src/components/display_card/plugin_card.tsx @@ -1,7 +1,6 @@ import { Button } from '@heroui/button'; import { Switch } from '@heroui/switch'; import { Chip } from '@heroui/chip'; -import { Tooltip } from '@heroui/tooltip'; import { useState } from 'react'; import { MdDeleteForever, MdSettings } from 'react-icons/md'; @@ -42,27 +41,28 @@ const PluginDisplayCard: React.FC = ({ - +
+
- +
{hasConfig && ( - - )} {installStatus === 'installed' && ( = ({ } > -
- {/* 作者和包名 */} -
- 作者: {author || '未知'} - · - - {id} - +
+
+ + 作者 + +
+ {author || '未知'} +
- - {/* 描述 */} -
-
+
+ + 版本 + +
+ v{version} +
+
+
+ + 描述 + +
{description || '暂无描述'}
- - {/* 标签 */} -
- {tags && tags.length > 0 ? ( - tags.slice(0, 3).map((tag, index) => ( - - {tag} - - )) - ) : ( - 暂无标签 - )} -
+ {id && ( +
+ + 包名 + +
+ {id || '包名'} +
+
+ )} + {tags && tags.length > 0 && ( +
+ + 标签 + +
+ {tags.slice(0, 2).join(' · ')} +
+
+ )}
); diff --git a/packages/napcat-webui-frontend/src/controllers/plugin_manager.ts b/packages/napcat-webui-frontend/src/controllers/plugin_manager.ts index d805ad3d..1e36a917 100644 --- a/packages/napcat-webui-frontend/src/controllers/plugin_manager.ts +++ b/packages/napcat-webui-frontend/src/controllers/plugin_manager.ts @@ -16,8 +16,6 @@ export interface PluginItem { description: string; /** 作者 */ author: string; - /** 主页链接 */ - homepage?: string; /** 状态: active-运行中, disabled-已禁用, stopped-已停止 */ status: PluginStatus; /** 是否有配置项 */ diff --git a/packages/napcat-webui-frontend/src/pages/dashboard/plugin.tsx b/packages/napcat-webui-frontend/src/pages/dashboard/plugin.tsx index 3857fecb..667ab4b6 100644 --- a/packages/napcat-webui-frontend/src/pages/dashboard/plugin.tsx +++ b/packages/napcat-webui-frontend/src/pages/dashboard/plugin.tsx @@ -1,5 +1,5 @@ import { Button } from '@heroui/button'; -import { useEffect, useState, useRef, useMemo } from 'react'; +import { useEffect, useState, useRef } from 'react'; import toast from 'react-hot-toast'; import { IoMdRefresh } from 'react-icons/io'; import { FiUpload } from 'react-icons/fi'; @@ -10,11 +10,9 @@ import PluginDisplayCard from '@/components/display_card/plugin_card'; import PluginManager, { PluginItem } from '@/controllers/plugin_manager'; import useDialog from '@/hooks/use-dialog'; import PluginConfigModal from '@/pages/dashboard/plugin_config_modal'; -import { PluginStoreItem } from '@/types/plugin-store'; export default function PluginPage () { const [plugins, setPlugins] = useState([]); - const [storePlugins, setStorePlugins] = useState([]); const [loading, setLoading] = useState(false); const [pluginManagerNotFound, setPluginManagerNotFound] = useState(false); const dialog = useDialog(); @@ -27,11 +25,7 @@ export default function PluginPage () { setLoading(true); setPluginManagerNotFound(false); try { - // 并行加载本地插件列表和商店插件列表 - const [listResult, storeResult] = await Promise.all([ - PluginManager.getPluginList(), - PluginManager.getPluginStoreList().catch(() => ({ plugins: [] })) - ]); + const listResult = await PluginManager.getPluginList(); if (listResult.pluginManagerNotFound) { setPluginManagerNotFound(true); @@ -39,7 +33,6 @@ export default function PluginPage () { } else { setPlugins(listResult.plugins); } - setStorePlugins(storeResult.plugins || []); } catch (e: any) { toast.error(e.message); } finally { @@ -47,25 +40,6 @@ export default function PluginPage () { } }; - // 创建一个 Map 用于快速查找商店插件的 homepage - const storeHomepageMap = useMemo(() => { - const map = new Map(); - for (const plugin of storePlugins) { - if (plugin.homepage) { - map.set(plugin.id, plugin.homepage); - } - } - return map; - }, [storePlugins]); - - // 合并本地插件和商店数据中的 homepage - const pluginsWithHomepage = useMemo(() => { - return plugins.map(plugin => ({ - ...plugin, - homepage: plugin.homepage || storeHomepageMap.get(plugin.id) - })); - }, [plugins, storeHomepageMap]); - useEffect(() => { loadPlugins(); }, []); @@ -198,7 +172,6 @@ export default function PluginPage () { isOpen={isOpen} onOpenChange={onOpenChange} pluginId={currentPluginId} - homepage={storeHomepageMap.get(currentPluginId)} />
@@ -238,11 +211,11 @@ export default function PluginPage () { 插件管理器未加载,请检查 plugins 目录是否存在

- ) : pluginsWithHomepage.length === 0 ? ( + ) : plugins.length === 0 ? (
暂时没有安装插件
) : (
- {pluginsWithHomepage.map(plugin => ( + {plugins.map(plugin => ( void; /** 插件包名 (id) */ pluginId: string; - /** 插件主页 URL */ - homepage?: string; } /** Schema 更新事件类型 */ @@ -29,7 +25,7 @@ interface SchemaUpdateEvent { afterKey?: string; } -export default function PluginConfigModal ({ isOpen, onOpenChange, pluginId, homepage }: Props) { +export default function PluginConfigModal ({ isOpen, onOpenChange, pluginId }: Props) { const [loading, setLoading] = useState(false); const [schema, setSchema] = useState([]); const [config, setConfig] = useState>({}); @@ -377,21 +373,6 @@ export default function PluginConfigModal ({ isOpen, onOpenChange, pluginId, hom )} - {homepage && ( - - - - )}