hfs 0.48.0-alpha4 → 0.48.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/admin/assets/{index-67290e78.js → index-d266c6e7.js} +3 -3
- package/admin/assets/{sha512-92cfe0b0.js → sha512-7fcb77a2.js} +1 -1
- package/admin/index.html +1 -1
- package/frontend/assets/{index-110410d0.js → index-ad985b09.js} +17 -17
- package/frontend/assets/{sha512-8d938ca9.js → sha512-ff90a9e0.js} +1 -1
- package/frontend/fontello.css +2 -11
- package/frontend/fontello.woff2 +0 -0
- package/frontend/index.html +1 -1
- package/package.json +1 -1
- package/plugins/list-uploader/plugin.js +1 -0
- package/plugins/list-uploader/public/main.js +3 -2
- package/src/api.net.js +14 -5
- package/src/const.js +3 -2
- package/src/frontEndApis.js +1 -1
- package/src/github.js +4 -17
- package/src/listen.js +3 -2
- package/src/misc.js +1 -1
- package/src/upload.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as OF,c as UF}from"./index-
|
|
1
|
+
import{g as OF,c as UF}from"./index-ad985b09.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/fontello.css
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: 'fontello';
|
|
3
|
-
src: url('fontello.woff2?
|
|
3
|
+
src: url('fontello.woff2?13611077') format('woff2');
|
|
4
4
|
font-weight: normal;
|
|
5
5
|
font-style: normal;
|
|
6
6
|
}
|
|
7
|
-
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
|
|
8
|
-
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
|
|
9
|
-
/*
|
|
10
|
-
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
|
11
|
-
@font-face {
|
|
12
|
-
font-family: 'fontello';
|
|
13
|
-
src: url('../font/fontello.svg?44288867#fontello') format('svg');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
*/
|
|
17
7
|
[class^="fa-"]:before, [class*=" fa-"]:before {
|
|
18
8
|
font-family: "fontello";
|
|
19
9
|
font-style: normal;
|
|
@@ -64,6 +54,7 @@
|
|
|
64
54
|
.fa-key:before { content: '\e80c'; } /* '' */
|
|
65
55
|
.fa-trash:before { content: '\e80d'; } /* '' */
|
|
66
56
|
.fa-to_start:before { content: '\e80e'; } /* '' */
|
|
57
|
+
.fa-pause:before { content: '\e80f'; } /* '' */
|
|
67
58
|
.fa-to_end:before { content: '\e810'; } /* '' */
|
|
68
59
|
.fa-image:before { content: '\e811'; } /* '' */
|
|
69
60
|
.fa-camera:before { content: '\e812'; } /* '' */
|
package/frontend/fontello.woff2
CHANGED
|
Binary file
|
package/frontend/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
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
7
|
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-ad985b09.js"></script>
|
|
9
9
|
<link rel="stylesheet" href="/assets/index-05dfd82f.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
: display === 'ip' || !x.username ? x.ip
|
|
16
16
|
: x.ip + ' (' + x.username + ')'
|
|
17
17
|
}, [data])
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const iconOnly = display === 'tooltip'
|
|
19
|
+
return text && HFS.h('span', { className: 'uploader', title: HFS.t`Uploader` + (iconOnly ? ' ' + text : '') },
|
|
20
|
+
HFS.hIcon('upload'), ' ', !iconOnly && text, ' – ')
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
function getDetails(batched) {
|
package/src/api.net.js
CHANGED
|
@@ -96,12 +96,21 @@ const acmeMiddleware = (ctx, next) => {
|
|
|
96
96
|
};
|
|
97
97
|
exports.acmeMiddleware = acmeMiddleware;
|
|
98
98
|
async function checkDomain(domain) {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
const resolver = new promises_2.Resolver();
|
|
100
|
+
const prjInfo = await (0, github_1.getProjectInfo)();
|
|
101
|
+
resolver.setServers(prjInfo.dnsServers);
|
|
102
|
+
const settled = await Promise.allSettled([
|
|
103
|
+
resolver.resolve(domain, 'A'),
|
|
104
|
+
resolver.resolve(domain, 'AAAA'),
|
|
105
|
+
(0, promises_2.lookup)(domain).then(x => [x.address]),
|
|
106
|
+
]);
|
|
107
|
+
// merge all results
|
|
108
|
+
const ips = lodash_1.default.uniq((0, misc_1.onlyTruthy)(settled.map(x => x.status === 'fulfilled' && x.value)).flat());
|
|
109
|
+
if (!ips.length)
|
|
110
|
+
throw new apiMiddleware_1.ApiError(const_1.HTTP_FAILED_DEPENDENCY, "domain not working");
|
|
102
111
|
const { publicIp } = await getNatInfo(); // do this before stopping the server
|
|
103
|
-
if (publicIp
|
|
104
|
-
throw new apiMiddleware_1.ApiError(const_1.HTTP_FAILED_DEPENDENCY, `please configure your domain to point to ${publicIp} (currently on ${
|
|
112
|
+
if (!ips.includes(publicIp))
|
|
113
|
+
throw new apiMiddleware_1.ApiError(const_1.HTTP_FAILED_DEPENDENCY, `please configure your domain to point to ${publicIp} (currently on ${ips[0]}) --- a change can take hours to be effective`);
|
|
105
114
|
}
|
|
106
115
|
async function generateSSLCert(domain, email) {
|
|
107
116
|
await checkDomain(domain);
|
package/src/const.js
CHANGED
|
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.APP_PATH = exports.IS_BINARY = exports.IS_MAC = exports.IS_WINDOWS = exports.HTTP_SERVICE_UNAVAILABLE = exports.HTTP_SERVER_ERROR = exports.HTTP_FAILED_DEPENDENCY = exports.HTTP_FOOL = exports.HTTP_RANGE_NOT_SATISFIABLE = exports.HTTP_PAYLOAD_TOO_LARGE = exports.HTTP_CONFLICT = exports.HTTP_NOT_ACCEPTABLE = exports.HTTP_METHOD_NOT_ALLOWED = exports.HTTP_NOT_FOUND = exports.HTTP_FORBIDDEN = exports.HTTP_UNAUTHORIZED = exports.HTTP_BAD_REQUEST = exports.HTTP_NOT_MODIFIED = exports.HTTP_TEMPORARY_REDIRECT = exports.HTTP_PARTIAL_CONTENT = exports.HTTP_NO_CONTENT = exports.HTTP_OK = exports.PLUGINS_PUB_URI = exports.API_URI = exports.ADMIN_URI = exports.FRONTEND_URI = exports.SPECIAL_URI = exports.HFS_REPO = exports.COMPATIBLE_API_VERSION = exports.API_VERSION = exports.RUNNING_BETA = exports.VERSION = exports.BUILD_TIMESTAMP = exports.HFS_STARTED = exports.ORIGINAL_CWD = exports.DEV = exports.argv = void 0;
|
|
30
|
+
exports.APP_PATH = exports.IS_BINARY = exports.IS_MAC = exports.IS_WINDOWS = exports.HTTP_SERVICE_UNAVAILABLE = exports.HTTP_SERVER_ERROR = exports.HTTP_FAILED_DEPENDENCY = exports.HTTP_FOOL = exports.HTTP_RANGE_NOT_SATISFIABLE = exports.HTTP_PAYLOAD_TOO_LARGE = exports.HTTP_CONFLICT = exports.HTTP_NOT_ACCEPTABLE = exports.HTTP_METHOD_NOT_ALLOWED = exports.HTTP_NOT_FOUND = exports.HTTP_FORBIDDEN = exports.HTTP_UNAUTHORIZED = exports.HTTP_BAD_REQUEST = exports.HTTP_NOT_MODIFIED = exports.HTTP_TEMPORARY_REDIRECT = exports.HTTP_PARTIAL_CONTENT = exports.HTTP_NO_CONTENT = exports.HTTP_OK = exports.PLUGINS_PUB_URI = exports.API_URI = exports.ADMIN_URI = exports.FRONTEND_URI = exports.SPECIAL_URI = exports.HFS_REPO_BRANCH = exports.HFS_REPO = exports.COMPATIBLE_API_VERSION = exports.API_VERSION = exports.RUNNING_BETA = exports.VERSION = exports.BUILD_TIMESTAMP = exports.HFS_STARTED = exports.ORIGINAL_CWD = exports.DEV = exports.argv = void 0;
|
|
31
31
|
const minimist_1 = __importDefault(require("minimist"));
|
|
32
32
|
const fs = __importStar(require("fs"));
|
|
33
33
|
const os_1 = require("os");
|
|
@@ -38,13 +38,14 @@ exports.DEV = process.env.DEV || exports.argv.dev ? 'DEV' : '';
|
|
|
38
38
|
exports.ORIGINAL_CWD = process.cwd();
|
|
39
39
|
exports.HFS_STARTED = new Date();
|
|
40
40
|
const PKG_PATH = (0, path_1.join)(__dirname, '..', 'package.json');
|
|
41
|
-
exports.BUILD_TIMESTAMP = "2023-09-
|
|
41
|
+
exports.BUILD_TIMESTAMP = "2023-09-17T18:48:53.971Z";
|
|
42
42
|
const pkg = JSON.parse(fs.readFileSync(PKG_PATH, 'utf8'));
|
|
43
43
|
exports.VERSION = pkg.version;
|
|
44
44
|
exports.RUNNING_BETA = exports.VERSION.includes('-');
|
|
45
45
|
exports.API_VERSION = 8.3;
|
|
46
46
|
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
|
|
47
47
|
exports.HFS_REPO = 'rejetto/hfs';
|
|
48
|
+
exports.HFS_REPO_BRANCH = exports.RUNNING_BETA ? 'next' : 'main';
|
|
48
49
|
exports.SPECIAL_URI = '/~/';
|
|
49
50
|
exports.FRONTEND_URI = exports.SPECIAL_URI + 'frontend/';
|
|
50
51
|
exports.ADMIN_URI = exports.SPECIAL_URI + 'admin/';
|
package/src/frontEndApis.js
CHANGED
|
@@ -56,7 +56,7 @@ exports.frontEndApis = {
|
|
|
56
56
|
if (typeof (uris === null || uris === void 0 ? void 0 : uris[0]) !== 'string')
|
|
57
57
|
return new apiMiddleware_1.ApiError(const_1.HTTP_BAD_REQUEST, 'bad uris');
|
|
58
58
|
return {
|
|
59
|
-
details: Promise.all(uris.map(async (uri) => {
|
|
59
|
+
details: await Promise.all(uris.map(async (uri) => {
|
|
60
60
|
if (typeof uri !== 'string')
|
|
61
61
|
return false; // false means error
|
|
62
62
|
const node = await (0, vfs_1.urlToNode)(uri, ctx);
|
package/src/github.js
CHANGED
|
@@ -150,7 +150,7 @@ async function apiGithub(uri) {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
async function searchPlugins(text = '') {
|
|
153
|
-
const projectInfo = await getProjectInfo();
|
|
153
|
+
const projectInfo = await (0, exports.getProjectInfo)();
|
|
154
154
|
const list = await apiGithub('search/repositories?q=topic:hfs-plugin+' + encodeURI(text));
|
|
155
155
|
return new misc_1.AsapStream(list.items.map(async (it) => {
|
|
156
156
|
var _a, _b;
|
|
@@ -186,20 +186,7 @@ async function searchPlugins(text = '') {
|
|
|
186
186
|
}
|
|
187
187
|
exports.searchPlugins = searchPlugins;
|
|
188
188
|
// centralized hosted information, to be used as little as possible
|
|
189
|
-
let cache;
|
|
190
189
|
const FN = 'central.json';
|
|
191
|
-
let
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
.catch(() => latest) // fall back to latest
|
|
195
|
-
.then(x => {
|
|
196
|
-
if (!x)
|
|
197
|
-
throw x; // go catch
|
|
198
|
-
setTimeout(() => cache = undefined, misc_1.DAY); // invalidate cache
|
|
199
|
-
return latest = JSON.parse(x);
|
|
200
|
-
}).catch(() => {
|
|
201
|
-
setTimeout(() => cache = undefined, 10000); // invalidate cache sooner on errors
|
|
202
|
-
return latest;
|
|
203
|
-
}));
|
|
204
|
-
}
|
|
205
|
-
exports.getProjectInfo = getProjectInfo;
|
|
190
|
+
let builtIn = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '..', FN), 'utf8'));
|
|
191
|
+
exports.getProjectInfo = (0, misc_1.debounceAsync)(() => readGithubFile(`${const_1.HFS_REPO}/${const_1.HFS_REPO_BRANCH}/${FN}`).then(JSON.parse, () => builtIn), // fall back to latest
|
|
192
|
+
0, { retain: misc_1.DAY, retainFailure: 60000 });
|
package/src/listen.js
CHANGED
|
@@ -51,12 +51,13 @@ function getHttpsWorkingPort() {
|
|
|
51
51
|
return (httpsSrv === null || httpsSrv === void 0 ? void 0 : httpsSrv.listening) && ((_a = httpsSrv.address()) === null || _a === void 0 ? void 0 : _a.port);
|
|
52
52
|
}
|
|
53
53
|
exports.getHttpsWorkingPort = getHttpsWorkingPort;
|
|
54
|
+
const commonOptions = { requestTimeout: 0 };
|
|
54
55
|
exports.portCfg = (0, config_1.defineConfig)('port', 80);
|
|
55
56
|
exports.portCfg.sub(async (port) => {
|
|
56
57
|
while (!index_1.app)
|
|
57
58
|
await (0, misc_1.wait)(100);
|
|
58
59
|
stopServer(httpSrv).then();
|
|
59
|
-
httpSrv = Object.assign(http.createServer(
|
|
60
|
+
httpSrv = Object.assign(http.createServer(commonOptions, index_1.app.callback()), { name: 'http' });
|
|
60
61
|
port = await startServer(httpSrv, { port });
|
|
61
62
|
if (!port)
|
|
62
63
|
return;
|
|
@@ -95,7 +96,7 @@ const considerHttps = (0, misc_1.debounceAsync)(async () => {
|
|
|
95
96
|
try {
|
|
96
97
|
while (!index_1.app)
|
|
97
98
|
await (0, misc_1.wait)(100);
|
|
98
|
-
httpsSrv = Object.assign(https.createServer(port === PORT_DISABLED ? {} : { key: httpsOptions.private_key, cert: httpsOptions.cert }, index_1.app.callback()), { name: 'https' });
|
|
99
|
+
httpsSrv = Object.assign(https.createServer(port === PORT_DISABLED ? {} : { ...commonOptions, key: httpsOptions.private_key, cert: httpsOptions.cert }, index_1.app.callback()), { name: 'https' });
|
|
99
100
|
if (port >= 0) {
|
|
100
101
|
const cert = getCertObject();
|
|
101
102
|
const cn = (_a = cert.subject) === null || _a === void 0 ? void 0 : _a.CN;
|
package/src/misc.js
CHANGED
|
@@ -69,7 +69,7 @@ function onOff(em, events) {
|
|
|
69
69
|
}
|
|
70
70
|
exports.onOff = onOff;
|
|
71
71
|
function isLocalHost(c) {
|
|
72
|
-
const ip = c.socket.remoteAddress; // don't use Context.ip as it is subject to proxied ips, and that's no use for localhost detection
|
|
72
|
+
const ip = typeof c === 'string' ? c : c.socket.remoteAddress; // don't use Context.ip as it is subject to proxied ips, and that's no use for localhost detection
|
|
73
73
|
return ip && (ip === '::1' || ip.endsWith('127.0.0.1'));
|
|
74
74
|
}
|
|
75
75
|
exports.isLocalHost = isLocalHost;
|
package/src/upload.js
CHANGED
|
@@ -26,7 +26,7 @@ function getUploadMeta(path) {
|
|
|
26
26
|
exports.getUploadMeta = getUploadMeta;
|
|
27
27
|
function setUploadMeta(path, ctx) {
|
|
28
28
|
return (0, misc_1.storeFileAttr)(path, ATTR_UPLOADER, {
|
|
29
|
-
username: (0, perm_1.getCurrentUsername)(ctx),
|
|
29
|
+
username: (0, perm_1.getCurrentUsername)(ctx) || undefined,
|
|
30
30
|
ip: ctx.ip,
|
|
31
31
|
});
|
|
32
32
|
}
|