hfs 0.52.0-beta4 → 0.52.0-beta6
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 -3
- package/admin/assets/index-4CQRk-yB.css +1 -0
- package/admin/assets/index-sqjqhfQh.js +810 -0
- package/admin/assets/{sha512-3tDoWWX4.js → sha512-t1dU12Dj.js} +1 -1
- package/admin/index.html +2 -2
- package/frontend/assets/index-fqsRmx7w.css +1 -0
- package/frontend/assets/index-w_Bu3TcZ.js +101 -0
- package/frontend/assets/{sha512-I2H28VIm.js → sha512-U8GKU-vd.js} +1 -1
- package/frontend/index.html +2 -3
- package/package.json +3 -3
- package/src/acme.js +29 -12
- package/src/adminApis.js +3 -3
- package/src/api.get_file_list.js +2 -1
- package/src/api.monitor.js +3 -1
- package/src/api.net.js +3 -1
- package/src/api.vfs.js +6 -1
- package/src/apiMiddleware.js +1 -1
- package/src/block.js +1 -1
- package/src/connections.js +3 -1
- package/src/const.js +2 -2
- package/src/cross.js +16 -4
- package/src/geo.js +1 -1
- package/src/index.js +1 -1
- package/src/langs/hfs-lang-fi.json +37 -5
- package/src/langs/hfs-lang-it.json +6 -2
- package/src/langs/hfs-lang-nl.json +20 -3
- package/src/langs/hfs-lang-ru.json +21 -3
- package/src/langs/hfs-lang-vi.json +68 -22
- package/src/langs/hfs-lang-zh.json +13 -5
- package/src/listen.js +4 -3
- package/src/log.js +11 -2
- package/src/middlewares.js +2 -2
- package/src/misc.js +2 -1
- package/src/roots.js +1 -1
- package/src/selfCheck.js +4 -5
- package/src/serveGuiAndSharedFiles.js +6 -6
- package/src/serveGuiFiles.js +56 -43
- package/src/update.js +5 -4
- package/src/upload.js +5 -4
- package/src/util-files.js +1 -1
- package/src/util-os.js +53 -15
- package/src/vfs.js +9 -5
- package/admin/assets/index-gtPWo_px.js +0 -809
- package/admin/assets/index-oSvCg3xb.css +0 -1
- package/frontend/assets/index-Kys6yJtN.css +0 -1
- package/frontend/assets/index-SY22o0dA.js +0 -101
- package/plugins/download-counter/storage/counters.yaml +0 -663
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as OF,c as UF}from"./index-
|
|
1
|
+
import{g as OF,c as UF}from"./index-w_Bu3TcZ.js";function gF(sF,hF){for(var eF=0;eF<hF.length;eF++){const tF=hF[eF];if(typeof tF!="string"&&!Array.isArray(tF)){for(const w in tF)if(w!=="default"&&!(w in sF)){const lF=Object.getOwnPropertyDescriptor(tF,w);lF&&Object.defineProperty(sF,w,lF.get?lF:{enumerable:!0,get:()=>tF[w]})}}}return Object.freeze(Object.defineProperty(sF,Symbol.toStringTag,{value:"Module"}))}var dF={exports:{}};/*
|
|
2
2
|
* [js-sha512]{@link https://github.com/emn178/js-sha512}
|
|
3
3
|
*
|
|
4
4
|
* @version 0.8.0
|
package/frontend/index.html
CHANGED
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0" />
|
|
6
6
|
<link href="/fontello.css" rel="stylesheet" />
|
|
7
|
-
<script src="
|
|
8
|
-
<
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-Kys6yJtN.css">
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-w_Bu3TcZ.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-fqsRmx7w.css">
|
|
10
9
|
</head>
|
|
11
10
|
<body>
|
|
12
11
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hfs",
|
|
3
|
-
"version": "0.52.0-
|
|
3
|
+
"version": "0.52.0-beta6",
|
|
4
4
|
"description": "HTTP File Server",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"file server",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"watch-server-proxied": "cross-env FRONTEND_PROXY=3005 ADMIN_PROXY=3006 npm run watch-server",
|
|
16
16
|
"start-frontend": "npm run start --workspace=frontend",
|
|
17
17
|
"start-admin": "npm run start --workspace=admin",
|
|
18
|
-
"build-all": "npm audit --omit=dev --audit-level=moderate && rm -rf dist && npm i && npm run build-server
|
|
19
|
-
"build-server": "rm -rf dist/src dist/plugins && tsc --target es2018 && touch package.json && cp -v -r package.json central.json README* LICENSE* plugins dist && find dist -name .DS_Store -delete && node afterbuild.js",
|
|
18
|
+
"build-all": "npm audit --omit=dev --audit-level=moderate && rm -rf dist && npm i && npm run build-server && npm run build-frontend && npm run build-admin && echo COMPLETED",
|
|
19
|
+
"build-server": "rm -rf dist/src dist/plugins && tsc --target es2018 && touch package.json && cp -v -r package.json central.json README* LICENSE* plugins dist && find dist \\( -name .DS_Store -o -name storage \\) -delete && node afterbuild.js",
|
|
20
20
|
"build-frontend": "npm run build --workspace=frontend",
|
|
21
21
|
"build-admin": "npm run build --workspace=admin",
|
|
22
22
|
"server-for-test": "node dist/src --cwd . --config tests && rm custom.html",
|
package/src/acme.js
CHANGED
|
@@ -21,7 +21,7 @@ const acmeListener = (req, res) => {
|
|
|
21
21
|
var _a;
|
|
22
22
|
const BASE = '/.well-known/acme-challenge/';
|
|
23
23
|
if (!((_a = req.url) === null || _a === void 0 ? void 0 : _a.startsWith(BASE)))
|
|
24
|
-
return
|
|
24
|
+
return;
|
|
25
25
|
const token = req.url.slice(BASE.length);
|
|
26
26
|
console.debug("got http challenge", token);
|
|
27
27
|
res.statusCode = cross_1.HTTP_OK;
|
|
@@ -33,6 +33,18 @@ const acmeMiddleware = (ctx, next) => {
|
|
|
33
33
|
return next();
|
|
34
34
|
};
|
|
35
35
|
exports.acmeMiddleware = acmeMiddleware;
|
|
36
|
+
const TEMP_MAP = { private: 80, public: { host: '', port: 80 }, description: 'hfs temporary', ttl: 5000 }; // from my tests (zyxel VMG8825), lower values won't make a working mapping
|
|
37
|
+
(0, cross_1.repeat)(cross_1.MINUTE, async (stop) => {
|
|
38
|
+
await nat_1.upnpClient.getGateway(); // without this, the next call will break upnp support
|
|
39
|
+
const res = await nat_1.upnpClient.getMappings();
|
|
40
|
+
const leftover = res.find(x => x.description === TEMP_MAP.description); // in case the process is interrupted
|
|
41
|
+
if (!leftover)
|
|
42
|
+
return void (stop()); // we are good
|
|
43
|
+
if (acmeMiddlewareEnabled)
|
|
44
|
+
return; // it doesn't count, as we are in the middle of something. Retry later
|
|
45
|
+
stop();
|
|
46
|
+
return nat_1.upnpClient.removeMapping(TEMP_MAP);
|
|
47
|
+
});
|
|
36
48
|
async function generateSSLCert(domain, email, altNames) {
|
|
37
49
|
// will answer challenge through our koa app (if on port 80) or must we spawn a dedicated server?
|
|
38
50
|
const nat = await (0, nat_1.getNatInfo)();
|
|
@@ -44,18 +56,18 @@ async function generateSSLCert(domain, email, altNames) {
|
|
|
44
56
|
resolve(); // go on anyway
|
|
45
57
|
}));
|
|
46
58
|
acmeMiddlewareEnabled = true;
|
|
47
|
-
console.debug(
|
|
59
|
+
console.debug("acme challenge server ready");
|
|
48
60
|
let tempMap;
|
|
49
61
|
try {
|
|
50
|
-
const checkUrl = `http://${domain}`;
|
|
62
|
+
const checkUrl = `http://${domain.split(',')[0]}`;
|
|
51
63
|
let check = await (0, selfCheck_1.selfCheck)(checkUrl); // some check services may not consider the domain, but we already verified that
|
|
52
|
-
if (check
|
|
64
|
+
if ((check === null || check === void 0 ? void 0 : check.success) === false && nat.upnp && !nat.mapped80) {
|
|
53
65
|
console.debug("setting temporary port forward");
|
|
54
|
-
tempMap = await nat_1.upnpClient.createMapping(
|
|
66
|
+
tempMap = await (0, cross_1.haveTimeout)(10000, nat_1.upnpClient.createMapping(TEMP_MAP).catch(() => { })).catch(() => { });
|
|
55
67
|
check = await (0, selfCheck_1.selfCheck)(checkUrl); // repeat test
|
|
56
68
|
}
|
|
57
69
|
//if (!check) throw new ApiError(HTTP_FAILED_DEPENDENCY, "couldn't test port 80")
|
|
58
|
-
if (
|
|
70
|
+
if ((check === null || check === void 0 ? void 0 : check.success) === false)
|
|
59
71
|
throw new apiMiddleware_1.ApiError(cross_1.HTTP_FAILED_DEPENDENCY, "port 80 is not working on the specified domain");
|
|
60
72
|
const acmeClient = new acme_client_1.default.Client({
|
|
61
73
|
accountKey: await acme_client_1.default.crypto.createPrivateKey(),
|
|
@@ -72,12 +84,13 @@ async function generateSSLCert(domain, email, altNames) {
|
|
|
72
84
|
async challengeCreateFn(_, c, ka) { acmeTokens[c.token] = ka; },
|
|
73
85
|
async challengeRemoveFn(_, c) { delete acmeTokens[c.token]; },
|
|
74
86
|
});
|
|
87
|
+
console.log("acme certificate generated");
|
|
75
88
|
return { key, cert };
|
|
76
89
|
}
|
|
77
90
|
finally {
|
|
78
91
|
if (tempMap) {
|
|
79
92
|
console.debug("removing temporary port forward");
|
|
80
|
-
nat_1.upnpClient.removeMapping(
|
|
93
|
+
nat_1.upnpClient.removeMapping(TEMP_MAP).catch(() => { }); // clean after ourselves
|
|
81
94
|
}
|
|
82
95
|
acmeMiddlewareEnabled = false;
|
|
83
96
|
if (tempSrv)
|
|
@@ -88,8 +101,12 @@ async function generateSSLCert(domain, email, altNames) {
|
|
|
88
101
|
exports.makeCert = (0, debounceAsync_1.debounceAsync)(async (domain, email, altNames) => {
|
|
89
102
|
if (!domain)
|
|
90
103
|
return new apiMiddleware_1.ApiError(cross_1.HTTP_BAD_REQUEST, 'bad params');
|
|
91
|
-
const res = await generateSSLCert(domain, email, altNames)
|
|
92
|
-
|
|
104
|
+
const res = await generateSSLCert(domain, email, altNames).catch(e => {
|
|
105
|
+
var _a;
|
|
106
|
+
throw !((_a = e.message) === null || _a === void 0 ? void 0 : _a.includes('not match this challenge')) ? e // another acme server?
|
|
107
|
+
: Error("a different server is responding on port 80 of your domain(s)");
|
|
108
|
+
});
|
|
109
|
+
const CERT_FILE = 'acme.cer';
|
|
93
110
|
const KEY_FILE = 'acme.key';
|
|
94
111
|
await promises_1.default.writeFile(CERT_FILE, res.cert);
|
|
95
112
|
await promises_1.default.writeFile(KEY_FILE, res.key);
|
|
@@ -102,7 +119,7 @@ const acmeRenew = (0, config_1.defineConfig)('acme_renew', false); // handle con
|
|
|
102
119
|
events_1.default.once('https ready', () => (0, cross_1.repeat)(cross_1.HOUR, renewCert));
|
|
103
120
|
// checks if the cert is near expiration date, and if so renews it
|
|
104
121
|
const renewCert = (0, debounceAsync_1.debounceAsync)(async () => {
|
|
105
|
-
const domain = acmeDomain.get();
|
|
122
|
+
const [domain, ...altNames] = acmeDomain.get().split(',');
|
|
106
123
|
if (!acmeRenew.get() || !domain)
|
|
107
124
|
return;
|
|
108
125
|
const cert = (0, listen_1.getCertObject)();
|
|
@@ -113,6 +130,6 @@ const renewCert = (0, debounceAsync_1.debounceAsync)(async () => {
|
|
|
113
130
|
// not expiring in a month
|
|
114
131
|
if (now > new Date(cert.validFrom) && now < validTo && validTo.getTime() - now.getTime() >= 30 * cross_1.DAY)
|
|
115
132
|
return console.log("certificate still good");
|
|
116
|
-
await (0, exports.makeCert)(domain, acmeEmail.get())
|
|
117
|
-
.catch(e => console.log("error renewing certificate: ", String(e)));
|
|
133
|
+
await (0, exports.makeCert)(domain, acmeEmail.get(), altNames)
|
|
134
|
+
.catch(e => console.log("error renewing certificate: ", String(e.message || e)));
|
|
118
135
|
}, 0, { retain: cross_1.DAY, retainFailure: cross_1.HOUR });
|
package/src/adminApis.js
CHANGED
|
@@ -64,7 +64,7 @@ exports.adminApis = {
|
|
|
64
64
|
};
|
|
65
65
|
},
|
|
66
66
|
set_config_text: ({ text }) => config_1.configFile.save(text, { reparse: true }),
|
|
67
|
-
update: ({ tag }) => (0, update_1.update)(tag),
|
|
67
|
+
update: ({ tag }) => (0, update_1.update)(tag).catch(e => { var _a, _b; return ((_a = e.cause) === null || _a === void 0 ? void 0 : _a.statusCode) ? new apiMiddleware_1.ApiError((_b = e.cause) === null || _b === void 0 ? void 0 : _b.statusCode) : e; }),
|
|
68
68
|
async check_update() {
|
|
69
69
|
return { options: await (0, update_1.getUpdates)() };
|
|
70
70
|
},
|
|
@@ -103,7 +103,7 @@ exports.adminApis = {
|
|
|
103
103
|
ips: await (0, listen_1.getIps)(false),
|
|
104
104
|
baseUrl: (0, listen_1.getBaseUrlOrDefault)(),
|
|
105
105
|
roots: roots_1.roots.get(),
|
|
106
|
-
updatePossible: !(0, update_1.updateSupported)() ? false : await (0, update_1.localUpdateAvailable)() ? 'local' : true,
|
|
106
|
+
updatePossible: !await (0, update_1.updateSupported)() ? false : (await (0, update_1.localUpdateAvailable)()) ? 'local' : true,
|
|
107
107
|
proxyDetected: (0, middlewares_1.getProxyDetected)(),
|
|
108
108
|
frpDetected: exports.localhostAdmin.get() && !(0, middlewares_1.getProxyDetected)()
|
|
109
109
|
&& (0, connections_1.getConnections)().every(misc_1.isLocalHost)
|
|
@@ -113,7 +113,7 @@ exports.adminApis = {
|
|
|
113
113
|
async save_pem({ cert, private_key, name = 'self' }) {
|
|
114
114
|
if (!cert || !private_key)
|
|
115
115
|
return new apiMiddleware_1.ApiError(const_1.HTTP_BAD_REQUEST);
|
|
116
|
-
const files = { cert: name + '.
|
|
116
|
+
const files = { cert: name + '.cer', private_key: name + '.key' };
|
|
117
117
|
await (0, promises_1.writeFile)(files.private_key, private_key);
|
|
118
118
|
await (0, promises_1.writeFile)(files.cert, cert);
|
|
119
119
|
return files;
|
package/src/api.get_file_list.js
CHANGED
|
@@ -37,7 +37,8 @@ const get_file_list = async ({ uri = '/', offset, limit, search, c, onlyFolders,
|
|
|
37
37
|
const can_archive = admin || (0, vfs_1.hasPermission)(node, 'can_archive', ctx);
|
|
38
38
|
const can_comment = can_upload && (0, comments_1.areCommentsEnabled)();
|
|
39
39
|
const can_overwrite = can_upload && (can_delete || !upload_1.dontOverwriteUploading.get());
|
|
40
|
-
const
|
|
40
|
+
const comment = await (0, comments_1.getCommentFor)(node.source);
|
|
41
|
+
const props = { can_archive, can_upload, can_delete, can_overwrite, can_comment, comment, accept: node.accept };
|
|
41
42
|
ctx.state.browsing = uri.replace(/\/{2,}/g, '/');
|
|
42
43
|
(0, connections_1.updateConnectionForCtx)(ctx);
|
|
43
44
|
if (!list)
|
package/src/api.monitor.js
CHANGED
|
@@ -81,12 +81,14 @@ exports.default = {
|
|
|
81
81
|
},
|
|
82
82
|
async *get_connection_stats() {
|
|
83
83
|
while (1) {
|
|
84
|
+
const filtered = (0, connections_1.getConnections)().filter(x => !ignore(x));
|
|
84
85
|
yield {
|
|
85
86
|
outSpeed: throttler_1.totalOutSpeed,
|
|
86
87
|
inSpeed: throttler_1.totalInSpeed,
|
|
87
88
|
got: throttler_1.totalGot,
|
|
88
89
|
sent: throttler_1.totalSent,
|
|
89
|
-
connections:
|
|
90
|
+
connections: filtered.length,
|
|
91
|
+
ips: lodash_1.default.uniqBy(filtered, x => x.ip).length,
|
|
90
92
|
};
|
|
91
93
|
await (0, misc_1.wait)(1000);
|
|
92
94
|
}
|
package/src/api.net.js
CHANGED
|
@@ -75,7 +75,9 @@ const apis = {
|
|
|
75
75
|
return results.length ? results : new apiMiddleware_1.ApiError(const_1.HTTP_SERVICE_UNAVAILABLE);
|
|
76
76
|
},
|
|
77
77
|
async make_cert({ domain, email, altNames }) {
|
|
78
|
-
await (0, acme_1.makeCert)(domain, email, altNames)
|
|
78
|
+
await (0, acme_1.makeCert)(domain, email, altNames).catch(e => {
|
|
79
|
+
throw new apiMiddleware_1.ApiError(const_1.HTTP_SERVER_ERROR, e.message || String(e));
|
|
80
|
+
});
|
|
79
81
|
return {};
|
|
80
82
|
},
|
|
81
83
|
get_cert() {
|
package/src/api.vfs.js
CHANGED
|
@@ -170,6 +170,7 @@ const apis = {
|
|
|
170
170
|
await (0, promises_1.mkdir)(path, { recursive: true });
|
|
171
171
|
return {};
|
|
172
172
|
},
|
|
173
|
+
get_disk_spaces: util_os_1.getDiskSpaces,
|
|
173
174
|
get_ls({ path, files = true, fileMask }, ctx) {
|
|
174
175
|
return new SendList_1.SendListReadable({
|
|
175
176
|
async doAtStart(list) {
|
|
@@ -183,6 +184,10 @@ const apis = {
|
|
|
183
184
|
}
|
|
184
185
|
return;
|
|
185
186
|
}
|
|
187
|
+
try {
|
|
188
|
+
list.props((0, util_os_1.getDiskSpaceSync)(path));
|
|
189
|
+
}
|
|
190
|
+
catch (_a) { } // continue anyway
|
|
186
191
|
try {
|
|
187
192
|
const matching = (0, misc_1.makeMatcher)(fileMask);
|
|
188
193
|
path = (0, misc_1.isWindowsDrive)(path) ? path + '\\' : (0, path_1.resolve)(path || '/');
|
|
@@ -202,7 +207,7 @@ const apis = {
|
|
|
202
207
|
k: isDir ? 'd' : undefined,
|
|
203
208
|
});
|
|
204
209
|
}
|
|
205
|
-
catch (
|
|
210
|
+
catch (_b) { } // just ignore entries we can't stat
|
|
206
211
|
}
|
|
207
212
|
list.close();
|
|
208
213
|
}
|
package/src/apiMiddleware.js
CHANGED
package/src/block.js
CHANGED
|
@@ -19,7 +19,7 @@ const block = (0, config_1.defineConfig)('block', [], rules => {
|
|
|
19
19
|
});
|
|
20
20
|
function applyBlock(socket, ip = (0, connections_1.normalizeIp)(socket.remoteAddress || '')) {
|
|
21
21
|
if (ip && block.compiled().find(rule => rule(ip)))
|
|
22
|
-
return (0, connections_1.disconnect)(socket);
|
|
22
|
+
return (0, connections_1.disconnect)(socket, 'block-ip');
|
|
23
23
|
}
|
|
24
24
|
exports.applyBlock = applyBlock;
|
|
25
25
|
setInterval(() => {
|
package/src/connections.js
CHANGED
|
@@ -68,9 +68,11 @@ function updateConnection(conn, change, changeState) {
|
|
|
68
68
|
events_1.default.emit('connectionUpdated', conn, change);
|
|
69
69
|
}
|
|
70
70
|
exports.updateConnection = updateConnection;
|
|
71
|
-
function disconnect(what) {
|
|
71
|
+
function disconnect(what, debugLog = '') {
|
|
72
72
|
if ('socket' in what)
|
|
73
73
|
what = what.socket;
|
|
74
|
+
if (debugLog)
|
|
75
|
+
console.debug("disconnection:", debugLog, what.remoteAddress);
|
|
74
76
|
return what.destroy();
|
|
75
77
|
}
|
|
76
78
|
exports.disconnect = disconnect;
|
package/src/const.js
CHANGED
|
@@ -37,7 +37,7 @@ const os_1 = require("os");
|
|
|
37
37
|
const fs_1 = require("fs");
|
|
38
38
|
const path_1 = require("path");
|
|
39
39
|
__exportStar(require("./cross-const"), exports);
|
|
40
|
-
exports.API_VERSION = 8.
|
|
40
|
+
exports.API_VERSION = 8.71;
|
|
41
41
|
exports.COMPATIBLE_API_VERSION = 1; // while changes in the api are not breaking, this number stays the same, otherwise it is made equal to API_VERSION
|
|
42
42
|
exports.HFS_REPO = 'rejetto/hfs';
|
|
43
43
|
exports.argv = (0, minimist_1.default)(process.argv.slice(2));
|
|
@@ -45,7 +45,7 @@ exports.DEV = process.env.DEV || exports.argv.dev ? 'DEV' : '';
|
|
|
45
45
|
exports.ORIGINAL_CWD = process.cwd();
|
|
46
46
|
exports.HFS_STARTED = new Date();
|
|
47
47
|
const PKG_PATH = (0, path_1.join)(__dirname, '..', 'package.json');
|
|
48
|
-
exports.BUILD_TIMESTAMP = "2024-
|
|
48
|
+
exports.BUILD_TIMESTAMP = "2024-03-24T16:21:00.359Z";
|
|
49
49
|
const pkg = JSON.parse(fs.readFileSync(PKG_PATH, 'utf8'));
|
|
50
50
|
exports.VERSION = pkg.version;
|
|
51
51
|
exports.RUNNING_BETA = exports.VERSION.includes('-');
|
package/src/cross.js
CHANGED
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.typedEntries = exports.typedKeys = exports.objRenameKey = exports.randomId = exports.getOrSet = exports.waitFor = exports.newObj = exports.findDefined = exports.isOrderedEqual = exports.swap = exports.tryJson = exports.dirname = exports.basename = exports.pendingPromise = exports._dbg = exports._log = exports.wantArray = exports.formatPerc = exports.with_ = exports.try_ = exports.setHidden = exports.onlyTruthy = exports.truthy = exports.splitAt = exports.strinsert = exports.removeStarting = exports.enforceFinal = exports.objSameKeys = exports.haveTimeout = exports.wait = exports.prefix = exports.formatSpeed = exports.formatBytes = exports.isWhoObject = exports.PERM_KEYS = exports.defaultPerms = exports.WHO_ANY_ACCOUNT = exports.WHO_NO_ONE = exports.WHO_ANYONE = exports.LIST = exports.CFG = exports.THEME_OPTIONS = exports.SORT_BY_OPTIONS = exports.FRONTEND_OPTIONS = exports.MAX_TILE_SIZE = exports.DAY = exports.HOUR = exports.MINUTE = exports.WIKI_URL = exports.REPO_URL = void 0;
|
|
21
|
-
exports.shortenAgent = exports.inCommon = exports.replace = exports.matches = exports.makeMatcher = exports.runAt = exports.pathEncode = exports.promiseBestEffort = exports.escapeHTML = exports.ipForUrl = exports.isIpLan = exports.isIpLocalHost = exports.xlate = exports.isEqualLax = exports.isWindowsDrive = exports.isIP = exports.isPrimitive = exports.formatTimestamp = exports.repeat = exports.asyncGeneratorToArray = exports.filterMapGenerator = exports.throw_ = exports.hasProp = void 0;
|
|
21
|
+
exports.shortenAgent = exports.mapFilter = exports.inCommon = exports.replace = exports.matches = exports.makeMatcher = exports.runAt = exports.pathEncode = exports.promiseBestEffort = exports.escapeHTML = exports.ipForUrl = exports.isIpLan = exports.isIpLocalHost = exports.xlate = exports.isEqualLax = exports.isWindowsDrive = exports.isIP = exports.isPrimitive = exports.formatTimestamp = exports.repeat = exports.asyncGeneratorToArray = exports.filterMapGenerator = exports.throw_ = exports.hasProp = void 0;
|
|
22
22
|
// This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
|
|
23
23
|
// all content here is shared between client and server
|
|
24
24
|
const lodash_1 = __importDefault(require("lodash"));
|
|
@@ -82,7 +82,7 @@ function formatSpeed(n, options = {}) {
|
|
|
82
82
|
}
|
|
83
83
|
exports.formatSpeed = formatSpeed;
|
|
84
84
|
function prefix(pre, v, post = '') {
|
|
85
|
-
return v ? pre + v + post : '';
|
|
85
|
+
return v ? (pre || '') + v + (post || '') : '';
|
|
86
86
|
}
|
|
87
87
|
exports.prefix = prefix;
|
|
88
88
|
function wait(ms, val) {
|
|
@@ -305,10 +305,13 @@ exports.asyncGeneratorToArray = asyncGeneratorToArray;
|
|
|
305
305
|
function repeat(everyMs, cb) {
|
|
306
306
|
let stop = false;
|
|
307
307
|
setTimeout(async () => {
|
|
308
|
-
while (!stop && await Promise.allSettled([cb()]))
|
|
308
|
+
while (!stop && await Promise.allSettled([cb(stopIt)]))
|
|
309
309
|
await wait(everyMs);
|
|
310
310
|
});
|
|
311
|
-
return
|
|
311
|
+
return stopIt;
|
|
312
|
+
function stopIt() {
|
|
313
|
+
stop = true;
|
|
314
|
+
}
|
|
312
315
|
}
|
|
313
316
|
exports.repeat = repeat;
|
|
314
317
|
function formatTimestamp(x) {
|
|
@@ -413,6 +416,15 @@ function inCommon(a, b) {
|
|
|
413
416
|
return i;
|
|
414
417
|
}
|
|
415
418
|
exports.inCommon = inCommon;
|
|
419
|
+
function mapFilter(arr, map, filter = (x) => x === undefined, invert = false) {
|
|
420
|
+
return arr[invert ? 'reduceRight' : 'reduce']((ret, x, idx) => {
|
|
421
|
+
const y = map(x, idx);
|
|
422
|
+
if (filter(y))
|
|
423
|
+
ret.push(y); // push is much faster than unshift, therefore invert using reduceRight https://measurethat.net/Benchmarks/Show/29/0/array-push-vs-unshift
|
|
424
|
+
return ret;
|
|
425
|
+
}, []);
|
|
426
|
+
}
|
|
427
|
+
exports.mapFilter = mapFilter;
|
|
416
428
|
function shortenAgent(agent) {
|
|
417
429
|
var _a;
|
|
418
430
|
return lodash_1.default.findKey(BROWSERS, re => re.test(agent))
|
package/src/geo.js
CHANGED
|
@@ -27,7 +27,7 @@ const geoFilter = async (ctx, next) => {
|
|
|
27
27
|
(0, connections_1.updateConnection)(connection, { country });
|
|
28
28
|
if (!ctx.state.skipFilters && allow.get() !== null)
|
|
29
29
|
if (country ? list.get().includes(country) !== allow.get() : !allowUnknown.get())
|
|
30
|
-
return (0, connections_1.disconnect)(ctx);
|
|
30
|
+
return (0, connections_1.disconnect)(ctx, 'geo-filter');
|
|
31
31
|
}
|
|
32
32
|
await next();
|
|
33
33
|
};
|
package/src/index.js
CHANGED
|
@@ -38,8 +38,8 @@ const keys = ((_a = process.env.COOKIE_SIGN_KEYS) === null || _a === void 0 ? vo
|
|
|
38
38
|
exports.app = new koa_1.default({ keys });
|
|
39
39
|
exports.app.use(middlewares_1.sessionMiddleware)
|
|
40
40
|
.use(selfCheck_1.selfCheckMiddleware)
|
|
41
|
-
.use(middlewares_1.someSecurity)
|
|
42
41
|
.use(acme_1.acmeMiddleware)
|
|
42
|
+
.use(middlewares_1.someSecurity)
|
|
43
43
|
.use(middlewares_1.prepareState)
|
|
44
44
|
.use(geo_1.geoFilter)
|
|
45
45
|
.use(middlewares_1.gzipper)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"author": "Pultsari",
|
|
3
|
-
"version": 1.
|
|
4
|
-
"hfs_version": "0.
|
|
2
|
+
"author": "Pultsari & Win_7",
|
|
3
|
+
"version": 1.2,
|
|
4
|
+
"hfs_version": "0.52.0",
|
|
5
5
|
"translate": {
|
|
6
6
|
"Select": "Valitse",
|
|
7
7
|
"n_files": "{n,plural,one{# tiedosto} other{# tiedostoa}}",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"Name": "Nimi",
|
|
101
101
|
"file_open": "Avaa",
|
|
102
102
|
"Download": "Lataa",
|
|
103
|
-
"Missing permission": "Oikeudet
|
|
103
|
+
"Missing permission": "Oikeudet puuttuvat",
|
|
104
104
|
"Reload": "Päivitä",
|
|
105
105
|
"Get list": "Näytä listana",
|
|
106
106
|
"Skip existing files": "Ohita jo olemassa olevat tiedostot",
|
|
@@ -126,6 +126,38 @@
|
|
|
126
126
|
"showHelp_space_body": "valitse",
|
|
127
127
|
"showHelp_D_body": "lataa",
|
|
128
128
|
"showHelp_Z_body": "vaihda zoomauksen tilaa",
|
|
129
|
-
"showHelp_F_body": "koko näyttö"
|
|
129
|
+
"showHelp_F_body": "koko näyttö",
|
|
130
|
+
"Destination": "Kohde",
|
|
131
|
+
"in_queue": "{n} jonossa",
|
|
132
|
+
"enter_comment": "Kirjoita kommentti tälle tiedostolle / hakemistolle",
|
|
133
|
+
"Comment": "Kommentti",
|
|
134
|
+
"upload_dd_hint": "Voit lähettää tiedostoja raahaamalla niitä tiedostolistauksessa",
|
|
135
|
+
"Upload not available": "Lähettäminen ei ole mahdollista",
|
|
136
|
+
"Cut": "Leikkaa",
|
|
137
|
+
"n_items": "{n,plural, one{# tiedosto / hakemisto leikepöydällä} other{# tiedostoa / hakemistoa leikepöydällä}}",
|
|
138
|
+
"good_bad": "{good} siirretty, {bad} epäonnistui",
|
|
139
|
+
"after_cut": "Valintasi on nyt leikepöydällä.\nMene kohdekansioon liittääksesi.",
|
|
140
|
+
"Cancel clipboard": "Sulje leikepöytä",
|
|
141
|
+
"to_clipboard_source": "Takaisin lähdekansioon",
|
|
142
|
+
"Paste": "Liitä",
|
|
143
|
+
"clipboard_list": "Kohteet leikepöydällä:",
|
|
144
|
+
"Close": "Sulje",
|
|
145
|
+
"Folder": "Kansio",
|
|
146
|
+
"Web page": "Verkko sivu",
|
|
147
|
+
"Link": "Linkki",
|
|
148
|
+
"Auto-play": "Auto-toisto",
|
|
149
|
+
"autoplay_seconds": "Sekunteja odottaa kuvissa",
|
|
150
|
+
"Select all": "Valitse kaikki",
|
|
151
|
+
"go_first": "Mene ensimmäiseen kohteeseen",
|
|
152
|
+
"go_last": "Mene viimeiseen kohteeseen",
|
|
153
|
+
"Shuffle": "Sekoita",
|
|
154
|
+
"Repeat": "Toisto",
|
|
155
|
+
"showHelpListShortcut": "Tiedosto listalta, klikkaa kun painat {key} Näyttääksesi nopeasti",
|
|
156
|
+
"Invalid value": "Virheellinen arvo",
|
|
157
|
+
"upload_skipped": "{n} ohitettu",
|
|
158
|
+
"Overwrite policy": "Ylikirjoitus käytäntö",
|
|
159
|
+
"Rename to avoid overwriting": "Uudelleen nimeä jotta ei ylikirjoiteta",
|
|
160
|
+
"Overwrite existing files": "Ylikirjoita olemassa olevat tiedostot",
|
|
161
|
+
"Menu": "Valikko"
|
|
130
162
|
}
|
|
131
163
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Massimo Melina",
|
|
3
3
|
"version": 1.9,
|
|
4
|
-
"hfs_version": "0.
|
|
4
|
+
"hfs_version": "0.52.0",
|
|
5
5
|
"translate": {
|
|
6
6
|
"Select": "Seleziona",
|
|
7
7
|
"n_files": "{n} file",
|
|
@@ -141,6 +141,10 @@
|
|
|
141
141
|
"Shuffle": "Riproduzione casuale",
|
|
142
142
|
"Repeat": "Ripeti a fine lista",
|
|
143
143
|
"showHelpListShortcut": "Dalla lista dei file, clicca tenendo {key} per accedere velocemente al File Show",
|
|
144
|
-
"Invalid value": "Valore non valido"
|
|
144
|
+
"Invalid value": "Valore non valido",
|
|
145
|
+
"upload_skipped": "{n,plural, one{# saltato} other{# saltati}}",
|
|
146
|
+
"Overwrite policy": "Per i file esistenti",
|
|
147
|
+
"Rename to avoid overwriting": "Rinomina per non sovrascrivere",
|
|
148
|
+
"Overwrite existing files": "Sovrascrivi i file esistenti"
|
|
145
149
|
}
|
|
146
150
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "H.F.P. Pit - PH5HP",
|
|
3
|
-
"version": 1.
|
|
4
|
-
"hfs_version": "0.
|
|
3
|
+
"version": 1.2,
|
|
4
|
+
"hfs_version": "0.52.0",
|
|
5
5
|
"translate": {
|
|
6
6
|
"Select": "Selecteer",
|
|
7
7
|
"n_files": "{n,plural,one{# bestand} other{# bestanden}}",
|
|
@@ -122,6 +122,23 @@
|
|
|
122
122
|
"Cancel clipboard": "Cancel clipboard",
|
|
123
123
|
"to_clipboard_source": "Naar map",
|
|
124
124
|
"Paste": "Plakken",
|
|
125
|
-
"clipboard_list": "Items in het klembord:"
|
|
125
|
+
"clipboard_list": "Items in het klembord:",
|
|
126
|
+
"Close": "Sluit",
|
|
127
|
+
"Folder": "Map",
|
|
128
|
+
"Web page": "Web pagina",
|
|
129
|
+
"Link": "Link",
|
|
130
|
+
"Auto-play": "Automatisch afspelen",
|
|
131
|
+
"autoplay_seconds": "Secondes tussen het afspelen van afbeeldingen",
|
|
132
|
+
"Select all": "Selecteer alles",
|
|
133
|
+
"go_first": "Ga naar het 1e item",
|
|
134
|
+
"go_last": "Ga naar het laatste item",
|
|
135
|
+
"Shuffle": "Mix door elkaar",
|
|
136
|
+
"Repeat": "Herhaal",
|
|
137
|
+
"showHelpListShortcut": "In de bestanden lijst, klik de bestandsnaam aan met de {key} ingedrukt om het snel te tonen",
|
|
138
|
+
"Invalid value": "Foutieve waarde",
|
|
139
|
+
"upload_skipped": "{n} overgeslagen",
|
|
140
|
+
"Overwrite policy": "Overschrijf beleid",
|
|
141
|
+
"Rename to avoid overwriting": "Hernoem om overschrijven te vermijden",
|
|
142
|
+
"Overwrite existing files": "Overschrijf bestaande bestanden"
|
|
126
143
|
}
|
|
127
144
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Mefistofell, SanokKule",
|
|
3
|
-
"version": 2.
|
|
4
|
-
"hfs_version": "0.
|
|
3
|
+
"version": 2.5,
|
|
4
|
+
"hfs_version": "0.52.0",
|
|
5
5
|
"translate": {
|
|
6
6
|
"Select": "Выбор",
|
|
7
7
|
"n_files": "{n,plural, one{# файл} few{# файла} many{# файлов}}",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"parent folder": "Родительская папка",
|
|
82
82
|
"home": "Домашняя папка",
|
|
83
83
|
"Continue": "Продолжить",
|
|
84
|
-
"Confirm": "
|
|
84
|
+
"Confirm": "Подтвердить",
|
|
85
85
|
"Don't": "Нет",
|
|
86
86
|
"Warning": "Внимание",
|
|
87
87
|
"Error": "Ошибка",
|
|
@@ -141,6 +141,24 @@
|
|
|
141
141
|
"to_clipboard_source": "В папку",
|
|
142
142
|
"Paste": "Вставить",
|
|
143
143
|
"clipboard_list": "Элементы в буфере обмена:",
|
|
144
|
+
"Close": "Закрыть",
|
|
145
|
+
"Folder": "Папка",
|
|
146
|
+
"Web page": "Веб адрес",
|
|
147
|
+
"Link": "Ссылка",
|
|
148
|
+
"Auto-play": "Автовоспроизведение",
|
|
149
|
+
"autoplay_seconds": "Сколько секунд ждать между изображениями",
|
|
150
|
+
"Select all": "Выбрать всё",
|
|
151
|
+
"go_first": "К первому элементу",
|
|
152
|
+
"go_last": "К последнему элементу",
|
|
153
|
+
"Shuffle": "Перемешать",
|
|
154
|
+
"Repeat": "Повтор",
|
|
155
|
+
"showHelpListShortcut": "Из списка файлов нажмите {key} чтобы быстро открыть Просмотр файла",
|
|
156
|
+
"Invalid value": "Недействительное значение",
|
|
157
|
+
"upload_skipped": "{n,plural, one{# пропущен} other{# пропущено}}",
|
|
158
|
+
"Overwrite policy": "Правило перезаписи",
|
|
159
|
+
"Rename to avoid overwriting": "Переименовать для избежания перезаписи",
|
|
160
|
+
"Overwrite existing files": "Перезаписать существующие файлы",
|
|
161
|
+
"Menu": "Меню",
|
|
144
162
|
"_PLUGINS SECTION": "",
|
|
145
163
|
"_PLUGIN thumbnails": "",
|
|
146
164
|
"Enable tiles mode": "Просмотр в режиме плиток",
|