# CS-Explorer-plugins **Repository Path**: jiqingzhe/cs-explorer-plugins ## Basic Information - **Project Name**: CS-Explorer-plugins - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-06 - **Last Updated**: 2025-09-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 插件开发指南 ## 在Gitee仓库中创建插件 ### 1. 仓库结构 在 `https://gitee.com/jiqingzhe/cs-explorer-plugins` 中创建以下结构: ``` cs-explorer-plugins/ ├── plugins/ │ ├── your-plugin-name/ # 插件文件夹 │ │ ├── manifest.json # 插件清单(必需) │ │ ├── index.js # 插件主文件(必需) │ │ └── README.md # 插件说明文档(推荐) │ └── another-plugin/ │ ├── manifest.json │ ├── index.js │ └── README.md └── README.md ``` ### 2. 插件清单 (manifest.json) 每个插件必须包含 `manifest.json` 文件: ```json { "id": "your-plugin-id", "name": "插件名称", "version": "1.0.0", "description": "插件描述", "author": "作者名称", "type": "feature", "category": "utility", "main": "index.js", "permissions": [ "files:read", "files:upload", "storage:read", "system:notify" ], "defaultConfig": { "enabled": true, "autoStart": false, "settings": {} }, "menu": { "path": "/your-plugin", "label": "插件菜单", "icon": "YourIcon" }, "tags": ["标签1", "标签2"], "downloads": 0, "views": 0, "rating": 0, "size": "1.2 MB", "license": "MIT", "homepage": "https://gitee.com/jiqingzhe/cs-explorer-plugins", "repository": "https://gitee.com/jiqingzhe/cs-explorer-plugins", "r2app": { "minVersion": "5.0.0", "maxVersion": "6.0.0" }, "updatedAt": "2024-01-06T00:00:00.000Z" } ``` ### 3. 插件主文件 (index.js) ```javascript /** * 插件主文件 */ class YourPlugin { constructor() { this.name = 'YourPlugin' this.version = '1.0.0' } /** * 插件初始化 */ async initialize() { console.log('插件初始化') return true } /** * 插件启用 */ async enable() { console.log('插件启用') return true } /** * 插件禁用 */ async disable() { console.log('插件禁用') return true } /** * 插件销毁 */ async destroy() { console.log('插件销毁') return true } } export default YourPlugin ``` ### 4. 插件类型 - **theme**: 主题插件 - **utility**: 工具插件 - **feature**: 功能插件 - **integration**: 集成插件 ### 5. 插件权限 - `files:read` - 读取文件 - `files:write` - 写入文件 - `files:upload` - 上传文件 - `files:delete` - 删除文件 - `storage:read` - 读取存储配置 - `storage:write` - 修改存储配置 - `system:notify` - 发送系统通知 - `system:config` - 修改系统配置 - `theme:read` - 读取主题配置 - `theme:modify` - 修改主题样式 ### 6. 菜单图标 插件可以直接使用任何 `lucide-react` 图标。有两种方式: **方式一:直接提供图标组件** ```javascript import { Image } from 'lucide-react' const pluginData = { // ... 其他配置 menu: { path: "/my-plugin", label: "我的插件", icon: Image // 直接提供图标组件 } } ``` **方式二:使用图标名称(仅限基础图标)** ```javascript const pluginData = { // ... 其他配置 menu: { path: "/my-plugin", label: "我的插件", icon: "Image" // 使用图标名称 } } ``` **推荐使用方式一**,因为可以自由使用任何 `lucide-react` 图标。 ### 7. 创建步骤 1. 在Gitee仓库中创建 `plugins/your-plugin-name/` 文件夹 2. 创建 `manifest.json` 文件 3. 创建 `index.js` 文件 4. 创建 `README.md` 文件(可选) 5. 提交到仓库 6. 在CS-Explorer中刷新插件商店 ### 8. 测试插件 1. 启动CS-Explorer应用 2. 打开插件商店 3. 应该能看到你的插件 4. 尝试安装和启用插件 ### 9. 注意事项 - 插件ID必须唯一 - 版本号格式为 x.y.z - 权限只申请必要的 - 确保代码没有语法错误 - 提供清晰的插件描述 ## 示例插件 参考仓库中的示例插件来了解完整的插件结构。