hfs 0.26.2 → 0.26.5
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 +111 -7
- package/admin/assets/{index.f056db34.js → index.3129dad1.js} +16 -16
- package/{frontend/assets/sha512.634b743e.js → admin/assets/sha512.e9b1ee42.js} +1 -1
- package/admin/index.html +1 -1
- package/frontend/assets/{index.55c710c2.js → index.1151988f.js} +16 -16
- package/frontend/assets/index.93366732.css +1 -0
- package/{admin/assets/sha512.3c0e384c.js → frontend/assets/sha512.bb881250.js} +1 -1
- package/frontend/index.html +2 -2
- package/package.json +1 -2
- package/plugins/vhosting/plugin.js +1 -3
- package/src/api.plugins.js +3 -1
- package/src/commands.js +22 -3
- package/src/config.js +1 -5
- package/src/const.js +1 -1
- package/src/listen.js +25 -16
- package/src/plugins.js +33 -28
- package/src/util-files.js +17 -10
- package/src/vfs.js +38 -28
- package/frontend/assets/index.ee805a6c.css +0 -1
package/README.md
CHANGED
|
@@ -49,12 +49,12 @@ You won't find all previous features here (yet), but still we got:
|
|
|
49
49
|
2. click on `Assets`
|
|
50
50
|
3. **download** the right version for your computer
|
|
51
51
|
4. launch `hfs` file
|
|
52
|
-
5. the browser should automatically open on `localhost` address, so you can configure the rest in the Admin
|
|
52
|
+
5. the browser should automatically open on `localhost` address, so you can configure the rest in the Admin-panel.
|
|
53
53
|
- if a browser cannot be opened on the computer where you are installing HFS,
|
|
54
54
|
you should enter this command in HFS console: `create-admin <PASSWORD>`
|
|
55
55
|
|
|
56
|
-
If you access *Admin
|
|
57
|
-
If you don't like this behavior, disable it in the Admin
|
|
56
|
+
If you access *Admin-panel* via localhost, by default HFS **won't** require you to login.
|
|
57
|
+
If you don't like this behavior, disable it in the Admin-panel or enter this console command `config localhost_admin false`.
|
|
58
58
|
|
|
59
59
|
### Other systems
|
|
60
60
|
|
|
@@ -95,10 +95,114 @@ But you may still want to stay with HFS 2.x (so far) for the following reasons
|
|
|
95
95
|
|
|
96
96
|
If you have access to HFS' console, you can enter commands. Start with `help` to have a full list.
|
|
97
97
|
|
|
98
|
-
##
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
## Configuration
|
|
99
|
+
|
|
100
|
+
Configuration can be done in several ways
|
|
101
|
+
- accessing the Admin-panel with your browser
|
|
102
|
+
- it will automatically open when you start HFS. Bookmark it. if your port is 8000 the address will be http://localhost:8000/~/admin
|
|
103
|
+
- after HFS has started you can enter console command in the form `config NAME VALUE`
|
|
104
|
+
- passing via command line at start in the form `--NAME VALUE`
|
|
105
|
+
- directly editing the `config.yaml` file. As soon as you save it is reloaded and changes are applied
|
|
106
|
+
|
|
107
|
+
`NAME` stands for the property name that you want to change. See the complete list below.
|
|
108
|
+
|
|
109
|
+
### Where is it stored
|
|
110
|
+
Configuration is stored in the file `config.yaml`, which is stored in the same folder of `hfs.exe` if you are using this
|
|
111
|
+
kind of distribution on Windows, or `USER_FOLDER/.hfs` on other systems.
|
|
112
|
+
|
|
113
|
+
You can decide a different file and location by passing `--config SOME_FILE` at command line, or inside
|
|
114
|
+
an *env* called `HFS_CONFIG`. Any relative path provided is relative to the *cwd*.
|
|
115
|
+
|
|
116
|
+
### Configuration properties
|
|
117
|
+
- `port` where to accept http connections. Default is 80.
|
|
118
|
+
- `vfs` the files and folders you want to expose. For details see the dedicated following section.
|
|
119
|
+
- `log` path of the log file. Default is `access.log`.
|
|
120
|
+
- `log_rotation` frequency of log rotation. Accepted values are `daily`, `weekly`, `monthly`, or empty string to disable. Default is `weekly`.
|
|
121
|
+
- `error_log` path of the log file for errors. Default is `error.log`.
|
|
122
|
+
- `errors_in_main_log` if you want to use a single file for both kind of entries. Default is false.
|
|
123
|
+
- `accounts` list of accounts. For details see the dedicated following section.
|
|
124
|
+
- `mime` command what mime-type to be returned with some files.
|
|
125
|
+
E.g.: `"*.jpg": image/jpeg`
|
|
126
|
+
You can specify multiple entries, or separate multiple file masks with a p|pe.
|
|
127
|
+
You can use the special value `auto` to attempt automatic detection.
|
|
128
|
+
- `max_kbps` throttle output speed. Default is Infinity.
|
|
129
|
+
- `max_kbps_per_ip` throttle output speed on a per-ip basis. Default is Infinity.
|
|
130
|
+
- `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.
|
|
131
|
+
- `open_browser_at_start` should HFS open browser on localhost on start? Default is true.
|
|
132
|
+
- `https_port` listen on a specific port. Default is 443.
|
|
133
|
+
- `cert` use this file for https certificate. Minimum to start https is to give a cert and a private_key. Default is none.
|
|
134
|
+
- `private_key` use this file for https private key. Default is none.
|
|
135
|
+
- `allowed_referer` you can decide what domains can link to your files. Wildcards supported. Default is any.
|
|
136
|
+
- `block` a list of rules that will block connections. E.g.:
|
|
137
|
+
```
|
|
138
|
+
block:
|
|
139
|
+
- ip: 192.168.0.90
|
|
140
|
+
```
|
|
141
|
+
Syntax supports, other than simple address, `*` as wildcard and CIDR format.
|
|
142
|
+
- `plugins_config` this is a generic place where you can find/put configuration for each plugin, at least those that need configuration.
|
|
143
|
+
- `enable_plugins` if a plugin is not present here, it won't run. Defaults is `[ antibrute ]`.
|
|
144
|
+
- `custom_header` provide HTML code to be put at the top of your Frontend. Default is none.
|
|
145
|
+
- `localhost_admin` should Admin be accessed without credentials when on localhost. Default is true.
|
|
146
|
+
- `proxies` number of proxies between server and clients to be trusted about providing clients' IP addresses. Default is 0.
|
|
147
|
+
|
|
148
|
+
#### Virtual File System (VFS)
|
|
149
|
+
|
|
150
|
+
The virtual file system is a tree of files and folders, collectively called *nodes*.
|
|
151
|
+
By default, a node is a folder, unless you provide for it a source that's a file.
|
|
152
|
+
Valid keys in a node are:
|
|
153
|
+
- `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.
|
|
154
|
+
- `source`: absolute or relative path of where to get the content
|
|
155
|
+
- `children`: just for folders, specify its virtual children.
|
|
156
|
+
Value is a list and its entries are nodes.
|
|
157
|
+
- `rename`: similar to name, but it's from the parent node point.
|
|
158
|
+
Use this to change the name of entries that are read from the source, not listed in the VFS.
|
|
159
|
+
Value is a dictionary, where the key is the original name.
|
|
160
|
+
- `mime`: specify what mime to use for this resource. Use "auto" for automatic detection.
|
|
161
|
+
- `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".
|
|
162
|
+
- `can_read`: specify who can download this entry. Value is a `WhoCan` descriptor, which is one of these values
|
|
163
|
+
- `true`: anyone can, even people who didn't log in. This is normally the default value.
|
|
164
|
+
- `false`: no one can.
|
|
165
|
+
- `"*"`: any account can, i.e. anyone who logged in.
|
|
166
|
+
- `[ frank, peter ]`: the list of accounts who can.
|
|
167
|
+
- `can_see`: specify who can see this entry. Even if a user can download you can still make the file not appear in the list.
|
|
168
|
+
Remember that to see in the list you must also be able to download, or else you won't see it anyway. Value is a `WhoCan` descriptor, refer above.
|
|
169
|
+
- `masks`: maps a file mask to a set of properties as the one documented in this section. E.g.
|
|
170
|
+
```
|
|
171
|
+
masks:
|
|
172
|
+
"**/*.mp3":
|
|
173
|
+
can_read: false
|
|
174
|
+
"*.jpg|*.png":
|
|
175
|
+
mime: auto
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Permissions set on an inner element will override inherited permissions. This means that you can restrict access to folder1,
|
|
179
|
+
and yet decide to give free access to folder1/subfolder2.
|
|
180
|
+
|
|
181
|
+
#### Accounts
|
|
182
|
+
|
|
183
|
+
All accounts go under `accounts:` property, as a dictionary where the key is the username.
|
|
184
|
+
E.g.
|
|
185
|
+
```
|
|
186
|
+
accounts:
|
|
187
|
+
admin:
|
|
188
|
+
password: hello123
|
|
189
|
+
belongs: group1
|
|
190
|
+
guest:
|
|
191
|
+
password: guest
|
|
192
|
+
group1:
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
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`.
|
|
196
|
+
|
|
197
|
+
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
|
|
198
|
+
gather multiple accounts and refer to them collectively as `group1`, so you can quickly share powers among several accounts.
|
|
199
|
+
|
|
200
|
+
For each account entries, this is the list of properties you can have:
|
|
201
|
+
|
|
202
|
+
- `ignore_limits` to ignore speed limits. Default is `false`.
|
|
203
|
+
- `redirect` provide a URL if you want the user to be redirected upon login. Default is none.
|
|
204
|
+
- `admin` set `true` if you want to let this account log in to the Admin interface. Default is `false`.
|
|
205
|
+
- `belongs` an array of usernames of other accounts from which to inherit their permissions. Default is none.
|
|
102
206
|
|
|
103
207
|
## License
|
|
104
208
|
|