@maxbill/dsh-file-explorer 0.0.0-stage → 1.0.1
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/LICENSE +201 -0
- package/README.en.md +248 -0
- package/README.md +249 -2
- package/assets/icon-180.png +0 -0
- package/assets/icons/archive.svg +5 -0
- package/assets/icons/audio.svg +5 -0
- package/assets/icons/excel.svg +5 -0
- package/assets/icons/file-outline.svg +4 -0
- package/assets/icons/folder.svg +4 -0
- package/assets/icons/image.svg +6 -0
- package/assets/icons/other.svg +5 -0
- package/assets/icons/pdf.svg +5 -0
- package/assets/icons/ppt.svg +5 -0
- package/assets/icons/text.svg +3 -0
- package/assets/icons/video.svg +5 -0
- package/assets/icons/word.svg +5 -0
- package/cordis.patch.yml +7 -0
- package/docs/drag-session.png +0 -0
- package/docs/editor.png +0 -0
- package/docs/grouped.png +0 -0
- package/docs/icon-view.png +0 -0
- package/docs/panel.png +0 -0
- package/docs/session-menu.png +0 -0
- package/docs/workspace-menu.png +0 -0
- package/docs/workspace-switch.png +0 -0
- package/icon.svg +5 -0
- package/lib/client.js +4492 -0
- package/lib/index.js +1676 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +65 -4
- package/screenshots.json +10 -0
- package/scripts/export-icons.mjs +85 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 MaxBill
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# File Explorer · dsh-file-explorer
|
|
2
|
+
|
|
3
|
+
[简体中文](README.md) | **English**
|
|
4
|
+
|
|
5
|
+
A **file manager** for DeepSeek Harness: one entry in the left sidebar, one panel in the main column — three views, previews by type (including XLSX and DOCX), in-panel text editing, one-click workspace switching, and a way to hand a file straight to the current conversation.
|
|
6
|
+
|
|
7
|
+
> Most file plugins stop at "you can look at files". This one takes the next step: **finish looking and keep working** — right-click a folder to make it a DSH workspace, or drop a document into the current conversation, without opening Finder or copying paths.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Five things it does together with DSH
|
|
14
|
+
|
|
15
|
+
### ① Add as workspace — on a folder
|
|
16
|
+
|
|
17
|
+
Right-click any folder → **添加为工作区** → confirm. A new entry appears under 工作区 in the sidebar; start a session there and the agent's reads, writes, terminal and search all land inside it.
|
|
18
|
+
|
|
19
|
+
What it saves: going back to DSH, finding "add workspace", then clicking down from your home directory to the target folder.
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
### ② Add to conversation — on a document
|
|
24
|
+
|
|
25
|
+
Right-click an image, text, PDF, Word, Excel or PowerPoint file → **添加到会话**. The panel switches back to the conversation with the attachment card already in the composer — the same result as dropping the file on the input, without leaving the file manager to find it.
|
|
26
|
+
|
|
27
|
+
Then just ask: "which months overspent in this spreadsheet?"
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
### ③ Mention in the composer — without spending context
|
|
32
|
+
|
|
33
|
+
The same menu's **引用到输入框** only inserts `@/absolute/path`; the bytes stay out of the context and the agent reads the file when it needs to. Best for code, logs, large files and anything still being edited.
|
|
34
|
+
|
|
35
|
+
The difference in one line: **添加到会话** sends the content, **引用到输入框** sends the location.
|
|
36
|
+
|
|
37
|
+
### ④ Drag into the conversation
|
|
38
|
+
|
|
39
|
+
Select a file (or a whole multi-selection) and drag it out of the list: a strip rises at the bottom — "松手加入当前会话". Let go and files attach, folders become `@path` mentions. Same destination as 添加到会话, without moving your hand off the mouse.
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
### ⑤ Switch workspace in one click — left of the toolbar
|
|
44
|
+
|
|
45
|
+
The leftmost toolbar button names the workspace holding the current folder (or just "工作区"). Open it for every workspace on this machine — path tail shown, the current one ticked — and pick one to jump straight there. The last row registers the current folder as a workspace. It reads the live `ctx.workspaces` snapshot.
|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## What the panel does
|
|
52
|
+
|
|
53
|
+
### Three views
|
|
54
|
+
|
|
55
|
+
- **Icons** (default): a 104px grid; names get two lines and then a `…` at a width budget (CJK counts double), with the two-line height always reserved so tiles line up; hover shows the full name.
|
|
56
|
+
- **List**: name / type / size / modified at a glance, drag a column divider to resize it, double-click the divider to reset.
|
|
57
|
+
- **Grouped**: sections by type (folders, text, images, documents, audio, video, archives, other) with a colour overview strip on top, each section accented with its own colour, count and total size; click a heading to fold it.
|
|
58
|
+
|
|
59
|
+
Switch with the icons at the far right of the toolbar (`⌘1` icons, `⌘2` list, `Ctrl` on Windows); the choice is remembered.
|
|
60
|
+
|
|
61
|
+

|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
### Preview and edit
|
|
66
|
+
|
|
67
|
+
The right pane routes by extension, matching the ground DSH's own document preview covers:
|
|
68
|
+
|
|
69
|
+
| Type | Extensions | Renderer |
|
|
70
|
+
|:--|:--|:--|
|
|
71
|
+
| Images | png / jpg / jpeg / gif / webp / bmp / ico / svg | `<img>` straight from `/raw`, no base64 |
|
|
72
|
+
| PDF | pdf | The browser's reader, with paging and zoom, plus "open in a new window" |
|
|
73
|
+
| Markdown | md / markdown | Lightweight renderer: headings, bold/italic, inline code, links, lists, quotes, fenced code |
|
|
74
|
+
| Tables | csv / tsv | Parsed into a table (first row is the header, quoted commas supported), up to 200 rows |
|
|
75
|
+
| Excel | xlsx / xlsm | **Parsed by the host itself** (zip + XML, no third-party library), a tab per worksheet, first row as header, up to 500 × 60 |
|
|
76
|
+
| Word | docx / docm | Also host-parsed: headings, body text, bullets and **tables** in document order, text only |
|
|
77
|
+
| HTML | html / htm | Sandboxed iframe, scripts do not run |
|
|
78
|
+
| Audio / video | mp3 / wav / m4a / flac / ogg / opus / aiff; mp4 / mov / webm / ogv | Native players (DSH does not preview these two itself) |
|
|
79
|
+
| Text / code | the rest of the text kinds | Monospace, read-only, ≤ 512 KB |
|
|
80
|
+
| Other | binaries, Office files | Metadata plus "open with the default app" |
|
|
81
|
+
|
|
82
|
+
Press **编辑** on a text, Markdown or CSV preview to edit in place: `⌘S` saves, a dirty dot warns about unsaved work, an out-of-date file asks before being overwritten, and the save button is the primary one with a line count on the left. Binary extensions (zip, images, audio/video…) get no edit entry, so bytes that cannot round-trip are never written back.
|
|
83
|
+
|
|
84
|
+

|
|
85
|
+
|
|
86
|
+
The right pane also has a **详情** mode: name, type, size, location, created, modified and permissions, plus the item count for folders. The pane starts collapsed; open it with the preview icon at the far right of the toolbar.
|
|
87
|
+
|
|
88
|
+
### Organising and transferring
|
|
89
|
+
|
|
90
|
+
- **New** folder / file, **rename** (`F2`, with the name preselected up to the extension), **duplicate**, **cut / copy / paste** through the panel's own clipboard, across folders.
|
|
91
|
+
- **Multi-select** with `⌘`-click and `⇧`-click; cut, copy and delete act on the whole selection.
|
|
92
|
+
- **Undo** for delete, rename, move and create (20 steps).
|
|
93
|
+
- **Move to Trash** asks first and goes to the system Trash, so it stays recoverable; nothing overwrites an existing item — name clashes become `名称 2` / `名称 副本`.
|
|
94
|
+
- **Download / zip / unzip**: 下载 saves the file; 压缩为 ZIP writes a sibling archive; on a `.zip`, 解压到此处 extracts it and refuses any entry that would escape the target folder. The host builds archives with `zlib` itself.
|
|
95
|
+
- **Upload** (remote only): streams onto the host's disk without buffering, with a progress bar, 512 MB per file. In the host's own browser the row is hidden — that file already sits on the same disk, so Finder or 新建 / 粘贴 is the direct route.
|
|
96
|
+
- **Git badges**: inside a repository, modified / untracked / staged / deleted / conflicted entries get a coloured dot with a hover explanation; it only reads `git status --porcelain` with `GIT_OPTIONAL_LOCKS=0`.
|
|
97
|
+
- **Address bar**: double-click the breadcrumbs (or `⌘L`) for an editable path — absolute, relative, `~` and `..`; `Esc` cancels, and anything outside the browse root is refused.
|
|
98
|
+
- **Filter and sort**: live name filter; click the name / type / size / modified headers, folders always first.
|
|
99
|
+
- **Status bar**: item count, selection size and clipboard on the left, current view and sort on the right.
|
|
100
|
+
- **Remembered**: hidden files, view, group style, pane mode, language, animation, column widths and the last folder all live in the browser.
|
|
101
|
+
|
|
102
|
+
### Look and settings
|
|
103
|
+
|
|
104
|
+
- **Transition**: 滑动 by default, plus 淡入, 缩放, 上浮 and 回弹; in-place refreshes only fade. `prefers-reduced-motion` turns it off.
|
|
105
|
+
- **Two languages**: 中文 and English, switched in 选项 → 语言 (「自动」 follows the system by default).
|
|
106
|
+
- **Options window**: 更多 → 选项 gathers display, view, group style, right pane, animation and language; it stays in sync with the toolbar icons.
|
|
107
|
+
- **About**: version, author, build date and licence, read straight from `package.json`.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Context menu
|
|
112
|
+
|
|
113
|
+
| Where | Entries |
|
|
114
|
+
|:--|:--|
|
|
115
|
+
| File / folder | preview (open, for folders), details, open with the default app, reveal in Finder, rename…, duplicate, copy, cut, copy path, copy relative path, copy name, download (files only), compress to ZIP, extract here (.zip only), move to Trash |
|
|
116
|
+
| Files also get | **添加到会话** (images, text, PDF, Word, Excel, PowerPoint), **引用到输入框** |
|
|
117
|
+
| Folders also get | **添加为工作区** |
|
|
118
|
+
| Empty area | new folder…, new file…, paste, reveal this folder, refresh |
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Platform support
|
|
123
|
+
|
|
124
|
+
| Capability | macOS | Windows | Linux |
|
|
125
|
+
|:--|:--|:--|:--|
|
|
126
|
+
| Browse / preview (XLSX · DOCX included) / edit / upload / download / zip | ✅ tested | ⚠️ untested | ⚠️ untested |
|
|
127
|
+
| Open with the default app | ✅ `open` | ✅ `cmd /c start` | ✅ `xdg-open` |
|
|
128
|
+
| Reveal in the file manager | ✅ `open -R` | ✅ `explorer /select,` | ✅ FileManager1 (falls back to opening the folder) |
|
|
129
|
+
| Move to Trash | ✅ `~/.Trash` | ✅ Recycle Bin via PowerShell, falling back to `~/.Trash` | ✅ freedesktop Trash with `.trashinfo` |
|
|
130
|
+
| Typing a path | ✅ POSIX | ✅ drive letters `C:\dir` and UNC `\\server\share` | ✅ POSIX |
|
|
131
|
+
| Upload a whole folder | ✅ | ✅ | ✅ `webkitdirectory`: Chrome / Edge / Firefox, not Safari (falls back to picking files) |
|
|
132
|
+
|
|
133
|
+
> ⚠️ **Windows and Linux have not been verified on real machines.** Both branches follow the platform's own conventions (Explorer's `/select,`, the Recycle Bin's `SendToRecycleBin`, the freedesktop `files`+`info` layout) and `npm test` simulates all three systems in "platform plan" cases, but nobody has clicked through it on those systems yet. If something breaks, please open an [issue](https://github.com/MaxBill/dsh-file-explorer/issues) with your OS version, the DSH log line and the steps.
|
|
134
|
+
|
|
135
|
+
### What changes over a remote connection
|
|
136
|
+
|
|
137
|
+
When the page is reached over the LAN or a tunnel, the actions that **run on the host and need a desktop session** are hidden, and the status bar says 远程访问 · 本机操作已隐藏:
|
|
138
|
+
|
|
139
|
+
- Reveal in Finder / Explorer (including the empty-area entry and the preview pane's button)
|
|
140
|
+
- Open with the default application
|
|
141
|
+
- Move to Trash (with the toolbar's delete button and the `Delete` shortcut)
|
|
142
|
+
|
|
143
|
+
**Upload** is the mirror image: it appears only remotely, because that is the way to put your machine's files onto the host, and it carries a "从本机上传" hint. Browsing, previewing, editing, downloading, zipping, git badges, attaching, mentioning and adding a workspace all stay.
|
|
144
|
+
|
|
145
|
+
Detection: the host answers `/env`; a loopback Host counts as local, and a browser whose OS differs from the host's (a common SSH-forward case) is treated as remote.
|
|
146
|
+
|
|
147
|
+
## Safety
|
|
148
|
+
|
|
149
|
+
Every path goes through `realpath()` before checking, so `..` and symlinks cannot leave the browse root (the current user's home); anything else gets `403`. Preview limits: 512 KB of text, 8 MB of image, 2000 entries per directory (the footer says when a listing is truncated).
|
|
150
|
+
|
|
151
|
+
All 23 host routes are registered on DSH's `connection` service (`ctx.connection.fetch.register`), so authentication, the Host / Origin fence and the browser session are enforced by DSH itself.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Install
|
|
156
|
+
|
|
157
|
+
The package is **`@maxbill/dsh-file-explorer`** (the unscoped `dsh-file-explorer` name was taken on npm, hence the scope). Pick any of three routes:
|
|
158
|
+
|
|
159
|
+
**① From GitHub (no npm)**
|
|
160
|
+
|
|
161
|
+
```sh
|
|
162
|
+
git clone https://github.com/MaxBill/dsh-file-explorer.git ~/.dsh/plugins/dsh-file-explorer
|
|
163
|
+
dsh plugin --profile desktop add link:$HOME/.dsh/plugins/dsh-file-explorer
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**② From npm** (not published yet — works once the package is on the registry)
|
|
167
|
+
|
|
168
|
+
```sh
|
|
169
|
+
dsh plugin --profile desktop add @maxbill/dsh-file-explorer
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**③ Hand-write the profile**
|
|
173
|
+
|
|
174
|
+
```jsonc
|
|
175
|
+
// ~/.dsh/profiles/<profile>/package.json
|
|
176
|
+
{
|
|
177
|
+
"dependencies": { "@maxbill/dsh-file-explorer": "link:../../plugins/dsh-file-explorer" },
|
|
178
|
+
"dsh": { "profile": { "bundles": [ "@maxbill/dsh-file-explorer" ] } }
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Then run `pnpm install` in that profile directory and restart DSH. A 文件管理器 entry appears in the left sidebar.
|
|
183
|
+
|
|
184
|
+
> The **Loader entry id is still `dsh-file-explorer`** (the `id:` in `cordis.patch.yml`); only the module name became scoped.
|
|
185
|
+
|
|
186
|
+
## Uninstall
|
|
187
|
+
|
|
188
|
+
Remove `@maxbill/dsh-file-explorer` from `dsh.profile.bundles` and `dependencies`, then run `pnpm install` again.
|
|
189
|
+
|
|
190
|
+
## Development
|
|
191
|
+
|
|
192
|
+
```sh
|
|
193
|
+
npm test # host HTTP tests, run in a temporary directory under $HOME and cleaned up
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
There is no build step: `lib/index.js` is plain ESM and `lib/client.js` is a hand-written `window.__ModuleLoader__` factory module.
|
|
197
|
+
|
|
198
|
+
**Publish to npm** (maintainers)
|
|
199
|
+
|
|
200
|
+
On a machine whose default registry is the **CNPM mirror** (`registry.npmmirror.com`), `npm login` fails with "Public registration is not allowed": a mirror only caches packages, so it cannot register, log in or publish. Log in to the official registry once instead:
|
|
201
|
+
|
|
202
|
+
```sh
|
|
203
|
+
npm login --registry=https://registry.npmjs.org/ # an account that owns the @maxbill scope (create the org on npmjs.com if not)
|
|
204
|
+
npm publish # publishConfig.registry already points at npmjs
|
|
205
|
+
npm view @maxbill/dsh-file-explorer version --registry=https://registry.npmjs.org/
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
`package.json` declares both `access: "public"` (scoped packages are private by default) and that `registry`, so the mirror setting can never be picked up by accident, and the token it writes to `~/.npmrc` is scoped to npmjs, leaving the mirror in place for ordinary installs. Accounts with two-factor auth pass `--otp=123456` at publish time.
|
|
209
|
+
|
|
210
|
+
Keep the version in `package.json` equal to the GitHub Release tag.
|
|
211
|
+
|
|
212
|
+
| File | Purpose |
|
|
213
|
+
|:--|:--|
|
|
214
|
+
| `lib/index.js` | Host side: registers the 23 `/api/file-explorer` routes on DSH's `connection` service, every path `realpath`ed inside `$HOME` |
|
|
215
|
+
| `lib/client.js` | Browser side: the sidebar icon and the `main` panel, zero dependencies beyond `react` |
|
|
216
|
+
| `cordis.patch.yml` | Bundle patch that inserts the `dsh-file-explorer` Loader entry |
|
|
217
|
+
| `assets/icons/` | 12 reusable two-tone SVGs (`node scripts/export-icons.mjs` exports them from `SHAPES`) |
|
|
218
|
+
|
|
219
|
+
## Branch model
|
|
220
|
+
|
|
221
|
+
- `main`: stable; only reaches it through a PR from `develop`, with branch protection on (admins included, no force-push, no deletion).
|
|
222
|
+
- `develop`: day-to-day work; merge after the tests pass.
|
|
223
|
+
|
|
224
|
+
```sh
|
|
225
|
+
git switch develop
|
|
226
|
+
# ...code, commit, test...
|
|
227
|
+
git push origin develop
|
|
228
|
+
gh pr create --base main --head develop
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Merges are rebased to keep the history linear, then develop is realigned:
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
git switch develop && git fetch origin && git reset --hard origin/main
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Developer
|
|
238
|
+
|
|
239
|
+
| | |
|
|
240
|
+
|:--|:--|
|
|
241
|
+
| Developer | **MaxBill** |
|
|
242
|
+
| Profile | <https://github.com/MaxBill> |
|
|
243
|
+
| Repository | <https://github.com/MaxBill/dsh-file-explorer> |
|
|
244
|
+
| Issues | <https://github.com/MaxBill/dsh-file-explorer/issues> |
|
|
245
|
+
|
|
246
|
+
## License
|
|
247
|
+
|
|
248
|
+
[Apache License 2.0](LICENSE) © 2026 MaxBill
|