hfs 0.50.4 → 0.51.0-beta4
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 +2 -0
- package/admin/assets/index-101ecc9e.js +808 -0
- package/admin/assets/{index-bb75b3fc.css → index-65d16f45.css} +1 -1
- package/{frontend/assets/sha512-e82b909a.js → admin/assets/sha512-a1b6cce6.js} +1 -1
- package/admin/index.html +2 -2
- package/frontend/assets/index-a452a199.css +1 -0
- package/frontend/assets/index-dea364e7.js +95 -0
- package/{admin/assets/sha512-1694c0eb.js → frontend/assets/sha512-6365fe60.js} +1 -1
- package/frontend/fontello.css +4 -1
- package/frontend/fontello.woff2 +0 -0
- package/frontend/index.html +2 -2
- package/package.json +3 -2
- package/src/adminApis.js +3 -1
- package/src/api.auth.js +6 -1
- package/src/{api.file_list.js → api.get_file_list.js} +11 -7
- package/src/api.monitor.js +1 -34
- package/src/api.vfs.js +2 -5
- package/src/apiMiddleware.js +1 -1
- package/src/comments.js +1 -1
- package/src/const.js +5 -2
- package/src/cross-const.js +3 -4
- package/src/cross.js +56 -7
- package/src/debounceAsync.js +3 -3
- package/src/errorPages.js +1 -1
- package/src/frontEndApis.js +21 -2
- package/src/index.js +2 -0
- package/src/lang.js +10 -2
- package/src/langs/hfs-lang-it.json +10 -6
- package/src/listen.js +1 -2
- package/src/log.js +20 -5
- package/src/middlewares.js +12 -6
- package/src/misc.js +4 -14
- package/src/roots.js +47 -0
- package/src/serveFile.js +40 -4
- package/src/serveGuiFiles.js +2 -2
- package/src/update.js +7 -6
- package/src/upload.js +10 -5
- package/src/util-files.js +7 -6
- package/src/vfs.js +38 -28
- package/src/zip.js +2 -2
- package/admin/assets/index-a24642bd.js +0 -807
- package/frontend/assets/index-b90320b6.css +0 -1
- package/frontend/assets/index-e6ecc47c.js +0 -94
- package/plugins/vhosting/plugin.js +0 -62
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
exports.description = "If you want to have different home folders, based on domain"
|
|
2
|
-
exports.version = 3.2
|
|
3
|
-
exports.apiRequired = 2 // 2 is for the config 'array'
|
|
4
|
-
|
|
5
|
-
exports.config = {
|
|
6
|
-
hosts: {
|
|
7
|
-
label: '',
|
|
8
|
-
type: 'array',
|
|
9
|
-
fields: {
|
|
10
|
-
host: { label: "Domain", helperText: "Wildcards supported: domain.*|other.*" },
|
|
11
|
-
root: { helperText: "Root path in VFS" },
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
mandatory: {
|
|
15
|
-
label: "Block requests that are not using any of the domains above",
|
|
16
|
-
type: 'boolean',
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
exports.configDialog = {
|
|
21
|
-
sx: { maxWidth: '35em' },
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
exports.init = api => {
|
|
25
|
-
const { matches } = api.require('./misc')
|
|
26
|
-
return {
|
|
27
|
-
middleware(ctx) {
|
|
28
|
-
let params // undefined if we are not going to work on api parameters
|
|
29
|
-
if (ctx.path.startsWith(api.Const.SPECIAL_URI)) { // special uris should be excluded...
|
|
30
|
-
if (!ctx.path.startsWith(api.Const.API_URI)) return // ...unless it's an api
|
|
31
|
-
let { referer } = ctx.headers
|
|
32
|
-
referer &&= new URL(referer).pathname
|
|
33
|
-
if (referer?.startsWith(ctx.state.revProxyPath + api.Const.ADMIN_URI)) return // exclude apis for admin-panel
|
|
34
|
-
params = ctx.params || ctx.query // for api we'll translate params
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const hosts = api.getConfig('hosts')
|
|
38
|
-
if (!hosts?.length) return
|
|
39
|
-
const row = hosts?.find(x => matches(ctx.host, x.host))
|
|
40
|
-
if (!row) {
|
|
41
|
-
if (api.getConfig('mandatory')) {
|
|
42
|
-
ctx.socket.destroy()
|
|
43
|
-
return true
|
|
44
|
-
}
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
let { root='' } = row
|
|
48
|
-
if (!root || root === '/') return
|
|
49
|
-
if (params === undefined) {
|
|
50
|
-
ctx.path = join(root, ctx.path)
|
|
51
|
-
return
|
|
52
|
-
}
|
|
53
|
-
for (const [k,v] of Object.entries(params))
|
|
54
|
-
if (k.startsWith('uri'))
|
|
55
|
-
params[k] = Array.isArray(v) ? v.map(x => join(root, x)) : join(root, v)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function join(a, b) {
|
|
61
|
-
return a + (b && b[0] !== '/' ? '/' : '') + b
|
|
62
|
-
}
|