hfs 0.40.1 → 0.41.0
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 +38 -99
- package/admin/assets/index-5c926903.js +510 -0
- package/admin/assets/{index-fe2c1463.css → index-ba8da62c.css} +1 -1
- package/{frontend/assets/sha512-962ae274.js → admin/assets/sha512-de1e5bd3.js} +1 -1
- package/admin/index.html +2 -2
- package/frontend/assets/{index-ffbcd4c9.css → index-25b49014.css} +1 -1
- package/frontend/assets/index-7ceb2f4c.js +94 -0
- package/{admin/assets/sha512-3a11d514.js → frontend/assets/sha512-09fdf0a5.js} +1 -1
- package/frontend/index.html +2 -2
- package/package.json +2 -1
- package/src/api.file_list.js +4 -4
- package/src/api.lang.js +1 -1
- package/src/api.vfs.js +4 -4
- package/src/const.js +1 -1
- package/src/frontEndApis.js +13 -11
- package/src/middlewares.js +12 -20
- package/src/misc.js +7 -3
- package/src/serveFile.js +1 -1
- package/src/serveGuiFiles.js +1 -1
- package/src/upload.js +3 -2
- package/src/util-files.js +6 -4
- package/src/vfs.js +61 -26
- package/src/zip.js +7 -3
- package/admin/assets/index-87c2ebd1.js +0 -510
- package/frontend/assets/index-9f5a7cc5.js +0 -94
package/README.md
CHANGED
|
@@ -61,9 +61,9 @@ If you don't like this behavior, disable it in the Admin-panel or enter this con
|
|
|
61
61
|
|
|
62
62
|
If your system is not Windows/Linux/Mac, you can try this alternative version:
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
1. [install node.js](https://nodejs.org)
|
|
65
|
+
2. execute: `sudo npm -g i hfs`
|
|
66
|
+
3. launch: `hfs`
|
|
67
67
|
|
|
68
68
|
Configuration and other files will be stored in `%HOME%/.vfs`
|
|
69
69
|
|
|
@@ -85,9 +85,10 @@ If you want to run HFS as a service
|
|
|
85
85
|
It is possible to show the Front-end in other languages.
|
|
86
86
|
In the Languages section of the Admin-panel you'll be able to install lang files.
|
|
87
87
|
You can find some of these files at https://github.com/rejetto/hfs/tree/main/langs
|
|
88
|
+
Files are named `hfs-lang-CODE.json`, where `CODE` is the ISO code for your language (e.g. pt-br for Brazilian).
|
|
88
89
|
To download a file: open it, right-click on the "Raw" button, Save.
|
|
89
90
|
|
|
90
|
-
|
|
91
|
+
If your language is missing, please consider [translating yourself](#translate-to-your-language).
|
|
91
92
|
|
|
92
93
|
Translation is applied automatically based on the configuration of the visitor's browser.
|
|
93
94
|
[Check the language configuration of your browser](https://gtranslate.io/detect-browser-language).
|
|
@@ -138,98 +139,7 @@ kind of distribution on Windows, or `USER_FOLDER/.hfs` on other systems.
|
|
|
138
139
|
You can decide a different file and location by passing `--config SOME_FILE` at command line, or inside
|
|
139
140
|
an *env* called `HFS_CONFIG`. Any relative path provided is relative to the *cwd*.
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
- `port` where to accept http connections. Default is 80.
|
|
143
|
-
- `vfs` the files and folders you want to expose. For details see the dedicated following section.
|
|
144
|
-
- `log` path of the log file. Default is `access.log`.
|
|
145
|
-
- `log_rotation` frequency of log rotation. Accepted values are `daily`, `weekly`, `monthly`, or empty string to disable. Default is `weekly`.
|
|
146
|
-
- `error_log` path of the log file for errors. Default is `error.log`.
|
|
147
|
-
- `errors_in_main_log` if you want to use a single file for both kind of entries. Default is false.
|
|
148
|
-
- `accounts` list of accounts. For details see the dedicated following section.
|
|
149
|
-
- `mime` command what mime-type to be returned with some files.
|
|
150
|
-
E.g.: `"*.jpg": image/jpeg`
|
|
151
|
-
You can specify multiple entries, or separate multiple file masks with a p|pe.
|
|
152
|
-
You can use the special value `auto` to attempt automatic detection.
|
|
153
|
-
- `max_kbps` throttle output speed. Default is Infinity.
|
|
154
|
-
- `max_kbps_per_ip` throttle output speed on a per-ip basis. Default is Infinity.
|
|
155
|
-
- `zip_calculate_size_for_seconds` how long should we wait before the zip archive starts streaming, trying to understand its finale size. Default is 1.
|
|
156
|
-
- `open_browser_at_start` should HFS open browser on localhost on start? Default is true.
|
|
157
|
-
- `https_port` listen on a specific port. Default is 443.
|
|
158
|
-
- `cert` use this file for https certificate. Minimum to start https is to give a cert and a private_key. Default is none.
|
|
159
|
-
- `private_key` use this file for https private key. Default is none.
|
|
160
|
-
- `allowed_referer` you can decide what domains can link to your files. Wildcards supported. Default is empty, meaning any.
|
|
161
|
-
- `block` a list of rules that will block connections. E.g.:
|
|
162
|
-
```
|
|
163
|
-
block:
|
|
164
|
-
- ip: 192.168.0.90
|
|
165
|
-
```
|
|
166
|
-
Syntax supports, other than simple address, `*` as wildcard and CIDR format.
|
|
167
|
-
- `plugins_config` this is a generic place where you can find/put configuration for each plugin, at least those that need configuration.
|
|
168
|
-
- `enable_plugins` if a plugin is not present here, it won't run. Defaults is `[ antibrute ]`.
|
|
169
|
-
- `localhost_admin` should Admin be accessed without credentials when on localhost. Default is true.
|
|
170
|
-
- `proxies` number of proxies between server and clients to be trusted about providing clients' IP addresses. Default is 0.
|
|
171
|
-
- `keep_unfinished_uploads` should unfinished uploads be deleted immediately when interrupted. Default is true.
|
|
172
|
-
- `favicon` path to file to be used as favicon. Default is none.
|
|
173
|
-
|
|
174
|
-
#### Virtual File System (VFS)
|
|
175
|
-
|
|
176
|
-
The virtual file system is a tree of files and folders, collectively called *nodes*.
|
|
177
|
-
By default, a node is a folder, unless you provide for it a source that's a file.
|
|
178
|
-
Valid keys in a node are:
|
|
179
|
-
- `name`: this is the name we'll use to display this file/folder. If not provided, HFS will infer it from the source. At least `name` or `source` must be provided.
|
|
180
|
-
- `source`: absolute or relative path of where to get the content
|
|
181
|
-
- `children`: just for folders, specify its virtual children.
|
|
182
|
-
Value is a list and its entries are nodes.
|
|
183
|
-
- `rename`: similar to name, but it's from the parent node point.
|
|
184
|
-
Use this to change the name of entries that are read from the source, not listed in the VFS.
|
|
185
|
-
Value is a dictionary, where the key is the original name.
|
|
186
|
-
- `mime`: specify what mime to use for this resource. Use "auto" for automatic detection.
|
|
187
|
-
- `default`: to be used with a folder where you want to serve a default html. E.g.: "index.html". Using this will make `mime` default to "auto".
|
|
188
|
-
- `can_read`: specify who can download this entry. Value is a `WhoCan` descriptor, which is one of these values
|
|
189
|
-
- `true`: anyone can, even people who didn't log in. This is normally the default value.
|
|
190
|
-
- `false`: no one can.
|
|
191
|
-
- `"*"`: any account can, i.e. anyone who logged in.
|
|
192
|
-
- `[ frank, peter ]`: the list of accounts who can.
|
|
193
|
-
- `can_see`: specify who can see this element. Even if a user can download you can still make the file not appear in the list.
|
|
194
|
-
Value is a `WhoCan` descriptor, refer above.
|
|
195
|
-
- `can_upload` specify who can upload. Applies to folders with a source. Default is none.
|
|
196
|
-
- `can_delete` specify who can delete. Applies to folders with a source. Default is none.
|
|
197
|
-
- `masks`: maps a file mask to a set of properties as the one documented in this section. E.g.
|
|
198
|
-
```
|
|
199
|
-
"**/*.mp3":
|
|
200
|
-
can_read: false
|
|
201
|
-
"*.jpg|*.png":
|
|
202
|
-
mime: auto
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
Permissions set on an inner element will override inherited permissions. This means that you can restrict access to folder1,
|
|
206
|
-
and yet decide to give free access to folder1/subfolder2.
|
|
207
|
-
|
|
208
|
-
#### Accounts
|
|
209
|
-
|
|
210
|
-
All accounts go under `accounts:` property, as a dictionary where the key is the username.
|
|
211
|
-
E.g.
|
|
212
|
-
```
|
|
213
|
-
accounts:
|
|
214
|
-
admin:
|
|
215
|
-
password: hello123
|
|
216
|
-
belongs: group1
|
|
217
|
-
guest:
|
|
218
|
-
password: guest
|
|
219
|
-
group1:
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
As soon as the config is read HFS will encrypt passwords (if necessary) in a non-reversible way. It means that `password` property is replaced with an encrypted property: `srp`.
|
|
223
|
-
|
|
224
|
-
As you can see in the example, `group1` has no password. This implies that you cannot log in as `group1`, but still `group1` exists and its purpose is to
|
|
225
|
-
gather multiple accounts and refer to them collectively as `group1`, so you can quickly share powers among several accounts.
|
|
226
|
-
|
|
227
|
-
For each account entries, this is the list of properties you can have:
|
|
228
|
-
|
|
229
|
-
- `ignore_limits` to ignore speed limits. Default is `false`.
|
|
230
|
-
- `redirect` provide a URL if you want the user to be redirected upon login. Default is none.
|
|
231
|
-
- `admin` set `true` if you want to let this account log in to the Admin-panel. Default is `false`.
|
|
232
|
-
- `belongs` an array of usernames of other accounts from which to inherit their permissions. Default is none.
|
|
142
|
+
[Check details about config file format](https://github.com/rejetto/hfs/blob/main/config.md).
|
|
233
143
|
|
|
234
144
|
## Reverse proxy
|
|
235
145
|
|
|
@@ -254,7 +164,36 @@ This is enough, but you may want to configure generated links accordingly:
|
|
|
254
164
|
- go to Admin-panel > Shared files > Home > Link
|
|
255
165
|
- click the change button (right side of the field)
|
|
256
166
|
- enter the final URL of your proxy including the location
|
|
257
|
-
|
|
258
|
-
## License
|
|
259
167
|
|
|
260
|
-
|
|
168
|
+
## Contribute
|
|
169
|
+
|
|
170
|
+
There are several ways to contribute
|
|
171
|
+
|
|
172
|
+
- [Report bugs](https://github.com/rejetto/hfs/issues/new?labels=bug&template=bug_report.md)
|
|
173
|
+
|
|
174
|
+
It's very important to report bugs, and if you are not so sure about it, don't worry, we'll discuss it.
|
|
175
|
+
If you find important security problems, please [contact us privately](mailto:a@rejetto.com) so that we can publish a fix before
|
|
176
|
+
the problem is disclosed, for the safety of other users.
|
|
177
|
+
|
|
178
|
+
- [Translate to your language](https://github.com/rejetto/hfs/wiki/Translation).
|
|
179
|
+
|
|
180
|
+
- [Suggest ideas](https://github.com/rejetto/hfs/discussions)
|
|
181
|
+
|
|
182
|
+
While the project should not become too complex, yours may be an idea for a plugin.
|
|
183
|
+
|
|
184
|
+
- Submit your code
|
|
185
|
+
|
|
186
|
+
If you'd like to make a change yourself in the code, please first open an "issue" or "discussion" about it,
|
|
187
|
+
so we'll try to cooperate and understand what's the best path for it.
|
|
188
|
+
|
|
189
|
+
- [Make a plugin](https://github.com/rejetto/hfs/blob/main/dev-plugins.md)
|
|
190
|
+
|
|
191
|
+
A plugin can change the look (a theme), and/or introduce a new functionality.
|
|
192
|
+
|
|
193
|
+
## More
|
|
194
|
+
|
|
195
|
+
- [Build yourself](https://github.com/rejetto/hfs/blob/main/dev.md)
|
|
196
|
+
|
|
197
|
+
- [License](https://github.com/rejetto/hfs/blob/master/LICENSE.txt)
|
|
198
|
+
|
|
199
|
+
- [To-do list](https://github.com/rejetto/hfs/blob/main/todo.md)
|