hfs 0.38.3 → 0.40.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/README.md +27 -2
- package/admin/assets/index-87c2ebd1.js +510 -0
- package/{frontend/assets/sha512-f5c4dbc2.js → admin/assets/sha512-3a11d514.js} +1 -1
- package/admin/index.html +1 -1
- package/frontend/assets/index-9f5a7cc5.js +94 -0
- package/frontend/assets/index-ffbcd4c9.css +1 -0
- package/{admin/assets/sha512-1d3d9f84.js → frontend/assets/sha512-962ae274.js} +1 -1
- package/frontend/fontello.css +10 -12
- package/frontend/fontello.woff2 +0 -0
- package/frontend/index.html +2 -2
- package/package.json +1 -1
- package/plugins/download-counter/plugin.js +1 -1
- package/plugins/download-counter/public/main.js +1 -1
- package/plugins/download-counter/public/style.css +1 -0
- package/plugins/vhosting/plugin.js +1 -1
- package/src/api.auth.js +1 -1
- package/src/api.file_list.js +3 -1
- package/src/api.plugins.js +4 -1
- package/src/api.vfs.js +7 -2
- package/src/apiMiddleware.js +4 -2
- package/src/const.js +1 -1
- package/src/events.js +1 -1
- package/src/frontEndApis.js +13 -13
- package/src/log.js +1 -1
- package/src/middlewares.js +7 -6
- package/src/misc.js +5 -1
- package/src/plugins.js +17 -8
- package/src/serveFile.js +47 -49
- package/src/serveGuiFiles.js +14 -12
- package/src/vfs.js +8 -7
- package/admin/assets/index-33978702.js +0 -510
- package/frontend/assets/index-6d4e81f7.css +0 -1
- package/frontend/assets/index-869b7be6.js +0 -94
package/src/vfs.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.cantReadStatusCode = exports.walkNode = exports.hasPermission = exports.nodeIsDirectory = exports.getNodeName = exports.saveVfs = exports.vfs = exports.urlToNode = exports.MIME_AUTO = exports.defaultPerms = void 0;
|
|
7
|
+
exports.cantReadStatusCode = exports.walkNode = exports.hasPermission = exports.nodeIsDirectory = exports.getNodeName = exports.saveVfs = exports.vfs = exports.urlToNode = exports.isSameFilenameAs = exports.MIME_AUTO = exports.defaultPerms = void 0;
|
|
8
8
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
9
|
const path_1 = require("path");
|
|
10
10
|
const micromatch_1 = require("micromatch");
|
|
@@ -14,7 +14,6 @@ const config_1 = require("./config");
|
|
|
14
14
|
const const_1 = require("./const");
|
|
15
15
|
const events_1 = __importDefault(require("./events"));
|
|
16
16
|
const perm_1 = require("./perm");
|
|
17
|
-
const misc_2 = require("./misc");
|
|
18
17
|
const WHO_ANYONE = true;
|
|
19
18
|
const WHO_NO_ONE = false;
|
|
20
19
|
const WHO_ANY_ACCOUNT = '*';
|
|
@@ -38,6 +37,11 @@ function inheritFromParent(parent, child) {
|
|
|
38
37
|
child.mime || (child.mime = parent.mime);
|
|
39
38
|
return child;
|
|
40
39
|
}
|
|
40
|
+
function isSameFilenameAs(name) {
|
|
41
|
+
const lc = name.toLowerCase();
|
|
42
|
+
return (other) => lc === (typeof other === 'string' ? other : getNodeName(other)).toLowerCase();
|
|
43
|
+
}
|
|
44
|
+
exports.isSameFilenameAs = isSameFilenameAs;
|
|
41
45
|
async function urlToNode(url, ctx, parent = exports.vfs, getRest) {
|
|
42
46
|
var _a;
|
|
43
47
|
let initialSlashes = 0;
|
|
@@ -54,9 +58,7 @@ async function urlToNode(url, ctx, parent = exports.vfs, getRest) {
|
|
|
54
58
|
return;
|
|
55
59
|
}
|
|
56
60
|
// does the tree node have a child that goes by this name?
|
|
57
|
-
const
|
|
58
|
-
: (0, misc_2.with_)(name.toLowerCase(), lc => (x) => x.toLowerCase() === lc);
|
|
59
|
-
const child = (_a = parent.children) === null || _a === void 0 ? void 0 : _a.find(x => sameName(getNodeName(x)));
|
|
61
|
+
const child = (_a = parent.children) === null || _a === void 0 ? void 0 : _a.find(isSameFilenameAs(name));
|
|
60
62
|
const ret = {
|
|
61
63
|
...child,
|
|
62
64
|
original: child,
|
|
@@ -124,8 +126,7 @@ exports.nodeIsDirectory = nodeIsDirectory;
|
|
|
124
126
|
function hasPermission(node, perm, ctx) {
|
|
125
127
|
var _a;
|
|
126
128
|
return (node.source || perm !== 'can_upload') // Upload possible only if we know where to store. First check node.source because is supposedly faster.
|
|
127
|
-
&& matchWho((_a = node[perm]) !== null && _a !== void 0 ? _a : exports.defaultPerms[perm], ctx)
|
|
128
|
-
&& (perm !== 'can_see' || hasPermission(node, 'can_read', ctx)); // can_see is used to hide something you nonetheless can_read, so you MUST also can_read
|
|
129
|
+
&& matchWho((_a = node[perm]) !== null && _a !== void 0 ? _a : exports.defaultPerms[perm], ctx);
|
|
129
130
|
}
|
|
130
131
|
exports.hasPermission = hasPermission;
|
|
131
132
|
async function* walkNode(parent, ctx, depth = 0, prefixPath = '') {
|