@koishi-ce/plugin-explorer 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -0
- package/dist/index.js +3 -3
- package/dist/{index.css → style.css} +1 -1
- package/lib/assets/{zh-CN-ZoUUQH0N.yml → zh-CN-X-yi2Y2F.yml} +4 -0
- package/lib/index.mjs +1 -1
- package/locales/de-DE.yml +4 -0
- package/locales/en-US.yml +4 -0
- package/locales/fr-FR.yml +4 -0
- package/locales/ja-JP.yml +4 -0
- package/locales/ru-RU.yml +4 -0
- package/locales/zh-CN.yml +4 -0
- package/locales/zh-TW.yml +4 -0
- package/package.json +10 -8
- package/src/index.test.ts +203 -0
- package/src/index.ts +57 -28
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# @koishi-ce/plugin-explorer
|
|
2
|
+
|
|
3
|
+
**简体中文** | [English](#english)
|
|
4
|
+
|
|
5
|
+
网页文件管理器插件,移植自上游 [koishijs/webui](https://github.com/koishijs/webui) 的 `plugins/explorer`。它把服务器上的文件以树形视图展示在控制台中,内置 monaco 编辑器,支持在线查看与编辑文本文件、上传与下载。依赖 console 服务。
|
|
6
|
+
|
|
7
|
+
## 功能与页面
|
|
8
|
+
|
|
9
|
+
- 「资源管理器」页面:路由 `/files/:name*`(order 600)。左侧为文件树(目录、文件、符号链接三类节点),右侧为 monaco 编辑器;文件树右键菜单支持新建文件 / 文件夹、上传、下载、重命名与删除。
|
|
10
|
+
- 上传:支持拖拽与粘贴,经全局上传对话框写入服务器。
|
|
11
|
+
- 页面菜单:提供保存与刷新动作(对应 Ctrl+S / Ctrl+R 快捷键)。
|
|
12
|
+
- 路径选择控件:为 schema `role: "path"` 的字符串字段注册 FilePicker,其他插件的配置表单中路径字段会渲染为弹窗式路径选择器。
|
|
13
|
+
- 状态栏:右侧显示当前编辑文件的语言。
|
|
14
|
+
- RPC 接口(供浏览器执行实际文件操作,均要求权限 4):
|
|
15
|
+
|
|
16
|
+
| RPC | 说明 |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `explorer/read` | 读取文件,返回 base64 内容及探测出的 MIME 类型与文本编码 |
|
|
19
|
+
| `explorer/write` | 写入文件(文本或 base64 二进制) |
|
|
20
|
+
| `explorer/mkdir` | 创建目录 |
|
|
21
|
+
| `explorer/remove` | 删除文件或目录(递归) |
|
|
22
|
+
| `explorer/rename` | 重命名 / 移动 |
|
|
23
|
+
| `explorer/refresh` | 重新遍历并下发文件树 |
|
|
24
|
+
|
|
25
|
+
- 提供 `explorer` 数据服务,向控制台推送根目录的完整文件树。
|
|
26
|
+
|
|
27
|
+
## 配置项
|
|
28
|
+
|
|
29
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
30
|
+
| --- | --- | --- | --- |
|
|
31
|
+
| `root` | string | `""` | 资源管理器的根目录,相对 `ctx.baseDir` 解析,默认为当前工作路径 |
|
|
32
|
+
| `ignored` | string[] | `["**/node_modules", "**/.*", "cache"]` | 要忽略的文件或目录,支持 Glob 语法 |
|
|
33
|
+
|
|
34
|
+
## 用法
|
|
35
|
+
|
|
36
|
+
需要先启用 `console`(@koishi-ce/plugin-console)。安装:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
bun add @koishi-ce/plugin-explorer
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
也可以在控制台的插件市场中直接安装。随后在配置文件中启用:
|
|
43
|
+
|
|
44
|
+
```yaml
|
|
45
|
+
plugins:
|
|
46
|
+
explorer: {}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 备注
|
|
50
|
+
|
|
51
|
+
- 所有文件操作 RPC 的路径参数均为相对 `root` 的路径,写操作完成后自动刷新文件树。
|
|
52
|
+
- 文件树排序:目录在最前,其余按名称字母序;被 `ignored` 规则命中的路径不展示。
|
|
53
|
+
- 符号链接作为独立节点展示,并附其指向的目标路径。
|
|
54
|
+
- 二进制文件按 base64 传输。
|
|
55
|
+
- 文本文件的编码由 chardet 探测,MIME 类型由文件头字节探测。
|
|
56
|
+
- 无指令、无数据表。
|
|
57
|
+
|
|
58
|
+
## 许可证
|
|
59
|
+
|
|
60
|
+
[AGPL-3.0](https://github.com/Koishi-CE/koishi/blob/main/LICENSES/AGPL-3.0.txt)。版权归 Shigma 及 Koishijs 贡献者(上游)与 Koishi-CE 贡献者,见 [NOTICE](https://github.com/Koishi-CE/koishi/blob/main/NOTICE)。上游仓库:[koishijs/webui](https://github.com/koishijs/webui) 的 `plugins/explorer`。
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## English
|
|
65
|
+
|
|
66
|
+
Web-based file manager plugin, ported from `plugins/explorer` of the upstream [koishijs/webui](https://github.com/koishijs/webui) repository. It presents server files as a tree in the console with a built-in monaco editor, supporting online viewing and editing, upload, and download. Depends on the console service.
|
|
67
|
+
|
|
68
|
+
## Features and Pages
|
|
69
|
+
|
|
70
|
+
- "Explorer" page: route `/files/:name*` (order 600). File tree on the left (files, directories, symlinks), monaco editor on the right; the tree context menu supports create file / directory, upload, download, rename, and delete.
|
|
71
|
+
- Upload via drag-and-drop or paste, handled by a global upload dialog; page menus provide save and refresh actions (Ctrl+S / Ctrl+R).
|
|
72
|
+
- Registers a FilePicker component for schema string fields with `role: "path"`, so path fields in other plugins' config forms render as a dialog-based picker.
|
|
73
|
+
- Status bar shows the language of the file being edited.
|
|
74
|
+
- RPC endpoints (all authority 4): `explorer/read` (returns base64 content with detected MIME type and encoding), `explorer/write`, `explorer/mkdir`, `explorer/remove` (recursive), `explorer/rename`, `explorer/refresh`.
|
|
75
|
+
- Provides the `explorer` data service that pushes the full file tree of the root directory.
|
|
76
|
+
|
|
77
|
+
## Configuration
|
|
78
|
+
|
|
79
|
+
| Option | Type | Default | Description |
|
|
80
|
+
| --- | --- | --- | --- |
|
|
81
|
+
| `root` | string | `""` | Root directory, resolved against `ctx.baseDir` |
|
|
82
|
+
| `ignored` | string[] | `["**/node_modules", "**/.*", "cache"]` | Glob patterns of files and directories to ignore |
|
|
83
|
+
|
|
84
|
+
## Usage
|
|
85
|
+
|
|
86
|
+
Requires `console` (@koishi-ce/plugin-console) to be enabled first.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
bun add @koishi-ce/plugin-explorer
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The plugin can also be installed from the console plugin market, then enabled in the config file:
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
plugins:
|
|
96
|
+
explorer: {}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Notes
|
|
100
|
+
|
|
101
|
+
- All RPC paths are relative to `root`; the tree refreshes automatically after writes.
|
|
102
|
+
- Directories sort first, then alphabetical order; ignored paths are hidden.
|
|
103
|
+
- Symlinks appear as distinct nodes with their target paths.
|
|
104
|
+
- No commands, no tables.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
[AGPL-3.0](https://github.com/Koishi-CE/koishi/blob/main/LICENSES/AGPL-3.0.txt). Copyright belongs to Shigma and Koishijs contributors (upstream) and Koishi-CE contributors; see [NOTICE](https://github.com/Koishi-CE/koishi/blob/main/NOTICE). Upstream: [koishijs/webui](https://github.com/koishijs/webui), `plugins/explorer`.
|