diff --git a/packages/napcat-plugin-builtin/vite.config.ts b/packages/napcat-plugin-builtin/vite.config.ts index 36ab2c48..41e90e9f 100644 --- a/packages/napcat-plugin-builtin/vite.config.ts +++ b/packages/napcat-plugin-builtin/vite.config.ts @@ -5,7 +5,8 @@ import { builtinModules } from 'module'; import fs from 'fs'; const nodeModules = [...builtinModules, builtinModules.map((m) => `node:${m}`)].flat(); - +// 依赖排除 +const external = []; // 构建后拷贝插件 function copyToShellPlugin () { return { @@ -68,7 +69,10 @@ export default defineConfig({ entry: 'index.ts', formats: ['es'], fileName: () => 'index.mjs', - } + }, + rollupOptions: { + external: [...nodeModules, ...external], + }, }, plugins: [nodeResolve(), copyToShellPlugin()], }); diff --git a/packages/napcat-webui-backend/src/types/PluginStore.ts b/packages/napcat-webui-backend/src/types/PluginStore.ts index f54f4b2a..4debee6b 100644 --- a/packages/napcat-webui-backend/src/types/PluginStore.ts +++ b/packages/napcat-webui-backend/src/types/PluginStore.ts @@ -7,17 +7,9 @@ export interface PluginStoreItem { description: string; // 插件描述 author: string; // 作者 homepage?: string; // 主页链接 - repository?: string; // 仓库地址 downloadUrl: string; // 下载地址 tags?: string[]; // 标签 - icon?: string; // 图标URL - screenshots?: string[]; // 截图 - minNapCatVersion?: string; // 最低NapCat版本要求 - dependencies?: Record; // 依赖 - downloads?: number; // 下载次数 - rating?: number; // 评分 - createdAt?: string; // 创建时间 - updatedAt?: string; // 更新时间 + minVersion?: string; // 最低版本要求 } export interface PluginStoreList { diff --git a/packages/napcat-webui-frontend/src/pages/dashboard/plugin_store.tsx b/packages/napcat-webui-frontend/src/pages/dashboard/plugin_store.tsx index 927ab9ff..3a21b20c 100644 --- a/packages/napcat-webui-frontend/src/pages/dashboard/plugin_store.tsx +++ b/packages/napcat-webui-frontend/src/pages/dashboard/plugin_store.tsx @@ -64,16 +64,13 @@ export default function PluginStorePage () { ); } - // 按下载量排序 - filtered.sort((a, b) => (b.downloads || 0) - (a.downloads || 0)); - // 定义主要分类 const categories: Record = { all: filtered, - popular: filtered.filter(p => (p.downloads || 0) > 5000), - tools: filtered.filter(p => p.tags?.some(t => ['工具', '管理', '群管理'].includes(t))), - entertainment: filtered.filter(p => p.tags?.some(t => ['娱乐', '音乐', '游戏'].includes(t))), - message: filtered.filter(p => p.tags?.some(t => ['消息处理', '自动回复', '欢迎'].includes(t))), + official: filtered.filter(p => p.tags?.includes('官方')), + tools: filtered.filter(p => p.tags?.includes('工具')), + entertainment: filtered.filter(p => p.tags?.includes('娱乐')), + other: filtered.filter(p => !p.tags?.some(t => ['官方', '工具', '娱乐'].includes(t))), }; return categories; @@ -82,10 +79,10 @@ export default function PluginStorePage () { const tabs = useMemo(() => { return [ { key: 'all', title: '全部', count: categorizedPlugins.all?.length || 0 }, - { key: 'popular', title: '热门推荐', count: categorizedPlugins.popular?.length || 0 }, - { key: 'tools', title: '工具管理', count: categorizedPlugins.tools?.length || 0 }, - { key: 'entertainment', title: '娱乐功能', count: categorizedPlugins.entertainment?.length || 0 }, - { key: 'message', title: '消息处理', count: categorizedPlugins.message?.length || 0 }, + { key: 'official', title: '官方', count: categorizedPlugins.official?.length || 0 }, + { key: 'tools', title: '工具', count: categorizedPlugins.tools?.length || 0 }, + { key: 'entertainment', title: '娱乐', count: categorizedPlugins.entertainment?.length || 0 }, + { key: 'other', title: '其它', count: categorizedPlugins.other?.length || 0 }, ]; }, [categorizedPlugins]); diff --git a/packages/napcat-webui-frontend/src/types/plugin-store.ts b/packages/napcat-webui-frontend/src/types/plugin-store.ts index f54f4b2a..4debee6b 100644 --- a/packages/napcat-webui-frontend/src/types/plugin-store.ts +++ b/packages/napcat-webui-frontend/src/types/plugin-store.ts @@ -7,17 +7,9 @@ export interface PluginStoreItem { description: string; // 插件描述 author: string; // 作者 homepage?: string; // 主页链接 - repository?: string; // 仓库地址 downloadUrl: string; // 下载地址 tags?: string[]; // 标签 - icon?: string; // 图标URL - screenshots?: string[]; // 截图 - minNapCatVersion?: string; // 最低NapCat版本要求 - dependencies?: Record; // 依赖 - downloads?: number; // 下载次数 - rating?: number; // 评分 - createdAt?: string; // 创建时间 - updatedAt?: string; // 更新时间 + minVersion?: string; // 最低版本要求 } export interface PluginStoreList {