hfs 3.1.0-beta4 → 3.1.0-beta5
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 +7 -11
- package/admin/assets/{index-BL84dr-c.js → index-BWYlCMa-.js} +1 -1
- package/admin/assets/{index-aI7IEKyS.js → index-BfKB7Toy.js} +6 -6
- package/admin/assets/{sha512-BUo7IPyY.js → sha512-CUlBOCDV.js} +1 -1
- package/admin/index.html +1 -1
- package/frontend/assets/{index-legacy-f8_Sicwh.js → index-legacy-C91Lfwww.js} +2 -2
- package/frontend/assets/{index-legacy-CVyhaUXB.js → index-legacy-FtSDGrqy.js} +1 -1
- package/frontend/assets/{sha512-legacy-CXmh1M3g.js → sha512-legacy-BATa4BG9.js} +1 -1
- package/frontend/index.html +1 -1
- package/npm-shrinkwrap.json +17 -17
- package/package.json +1 -1
- package/src/github.js +2 -1
- package/src/langs/hfs-lang-ar.json +1 -1
- package/src/langs/hfs-lang-bg.json +1 -1
- package/src/langs/hfs-lang-de.json +1 -1
- package/src/langs/hfs-lang-el.json +1 -1
- package/src/langs/hfs-lang-es.json +1 -1
- package/src/langs/hfs-lang-fi.json +1 -1
- package/src/langs/hfs-lang-fr.json +1 -1
- package/src/langs/hfs-lang-hu.json +1 -1
- package/src/langs/hfs-lang-it.json +1 -1
- package/src/langs/hfs-lang-ja.json +1 -1
- package/src/langs/hfs-lang-ko.json +1 -1
- package/src/langs/hfs-lang-lt.json +1 -1
- package/src/langs/hfs-lang-ms.json +1 -1
- package/src/langs/hfs-lang-nl.json +1 -1
- package/src/langs/hfs-lang-pt-br.json +1 -1
- package/src/langs/hfs-lang-ro.json +1 -1
- package/src/langs/hfs-lang-ru.json +1 -1
- package/src/langs/hfs-lang-sr.json +1 -1
- package/src/langs/hfs-lang-th.json +1 -1
- package/src/langs/hfs-lang-tr.json +1 -1
- package/src/langs/hfs-lang-uk.json +1 -1
- package/src/langs/hfs-lang-vi.json +1 -1
- package/src/langs/hfs-lang-zh-tw.json +1 -1
- package/src/langs/hfs-lang-zh.json +1 -1
- package/src/listen.js +3 -0
- package/src/throttler.js +2 -1
- package/src/update.js +5 -2
- package/src/util-os.js +26 -2
- package/src/webdav.js +3 -3
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"Repeat": "Lặp",
|
|
155
155
|
"showHelpListShortcut": "Ở danh sách file, giữ {key} để hiển thị",
|
|
156
156
|
"Invalid value": "🤷 what u think something in ur freakin' brain?",
|
|
157
|
-
"
|
|
157
|
+
"upload_interrupted": "{n} Đã huỷ bỏi người dùng!",
|
|
158
158
|
"Overwrite policy": "Chính sách ghi đè:",
|
|
159
159
|
"Rename to avoid overwriting": "Đổi tên, tránh ghi đè file có sẳn",
|
|
160
160
|
"Overwrite existing files": "ĐÈ LUÔN file có sẳn",
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
"Repeat": "重複播放",
|
|
151
151
|
"showHelpListShortcut": "在檔案清單中,按一下 {key} 即可快速顯示",
|
|
152
152
|
"Invalid value": "無效值",
|
|
153
|
-
"
|
|
153
|
+
"upload_interrupted": "{n} 中止",
|
|
154
154
|
"Overwrite policy": "覆蓋規則",
|
|
155
155
|
"Rename to avoid overwriting": "重新命名以避免覆蓋",
|
|
156
156
|
"Overwrite existing files": "覆蓋已存在的檔案",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"Repeat": "重复",
|
|
155
155
|
"showHelpListShortcut": "在文件列表中,按住 {key} 点击可快速显示",
|
|
156
156
|
"Invalid value": "无效值",
|
|
157
|
-
"
|
|
157
|
+
"upload_interrupted": "{n} 中断",
|
|
158
158
|
"Overwrite policy": "覆盖策略",
|
|
159
159
|
"Rename to avoid overwriting": "重命名以避免覆盖",
|
|
160
160
|
"Overwrite existing files": "覆盖已存在的文件",
|
package/src/listen.js
CHANGED
|
@@ -67,8 +67,11 @@ const nat_1 = require("./nat");
|
|
|
67
67
|
const persistence_1 = require("./persistence");
|
|
68
68
|
const argv_1 = require("./argv");
|
|
69
69
|
const consoleLog_1 = require("./consoleLog");
|
|
70
|
+
const first_1 = require("./first");
|
|
70
71
|
let httpSrv;
|
|
71
72
|
let httpsSrv;
|
|
73
|
+
// update relaunch can keep a bridge process alive, so we proactively close listeners here to release ports before the next binary binds
|
|
74
|
+
(0, first_1.onProcessExit)(() => Promise.all([stopServer(httpSrv), stopServer(httpsSrv)]));
|
|
72
75
|
const openBrowserAtStart = (0, config_1.defineConfig)('open_browser_at_start', true);
|
|
73
76
|
exports.baseUrl = (0, config_1.defineConfig)(misc_1.CFG.base_url, '', x => /(?<=\/\/)[^\/]+/.exec(x)?.[0]); // compiled is host only
|
|
74
77
|
async function getBaseUrlOrDefault() {
|
package/src/throttler.js
CHANGED
|
@@ -57,7 +57,8 @@ const throttler = async (ctx, next) => {
|
|
|
57
57
|
if (outSpeed || !closed)
|
|
58
58
|
conn[SymTimeout] = setTimeout(update, DELAY);
|
|
59
59
|
}, DELAY, { leading: true, maxWait: DELAY });
|
|
60
|
-
ts.on('sent', (n) => {
|
|
60
|
+
ts.on('sent', async (n) => {
|
|
61
|
+
await exports.totalSent.ready();
|
|
61
62
|
exports.totalSent.set(x => x + n);
|
|
62
63
|
update();
|
|
63
64
|
});
|
package/src/update.js
CHANGED
|
@@ -134,13 +134,16 @@ async function update(tagOrUrl = '') {
|
|
|
134
134
|
}
|
|
135
135
|
if (url) {
|
|
136
136
|
console.log("downloading", url);
|
|
137
|
+
const temp = LOCAL_UPDATE + '-temp';
|
|
138
|
+
await (0, promises_1.rm)(temp, { force: true });
|
|
137
139
|
try {
|
|
138
|
-
await (0, promises_1.writeFile)(
|
|
140
|
+
await (0, promises_1.writeFile)(temp, await (0, misc_1.httpStream)(url));
|
|
139
141
|
}
|
|
140
142
|
catch (e) {
|
|
141
|
-
await (0, promises_1.rm)(
|
|
143
|
+
await (0, promises_1.rm)(temp).catch(() => { }); // no leftovers
|
|
142
144
|
throw "Download failed for " + url + (0, misc_1.prefix)(' – ', e?.message);
|
|
143
145
|
}
|
|
146
|
+
await (0, promises_1.rename)(temp, LOCAL_UPDATE);
|
|
144
147
|
console.debug("download finished");
|
|
145
148
|
}
|
|
146
149
|
const bin = process.execPath;
|
package/src/util-os.js
CHANGED
|
@@ -84,15 +84,39 @@ async function getWindowsServicePids() {
|
|
|
84
84
|
const no = parsed?.[1]?.[2];
|
|
85
85
|
return Object.fromEntries(parsed.slice(2).filter(x => x[2] !== no).map(x => [x[1], x[2]]));
|
|
86
86
|
}
|
|
87
|
-
exports.RUNNING_AS_SERVICE =
|
|
88
|
-
const ret = x[node_process_1.pid] || x[node_process_1.ppid];
|
|
87
|
+
exports.RUNNING_AS_SERVICE = detectRunningAsService().then(ret => {
|
|
89
88
|
if (ret)
|
|
90
89
|
console.log("running as service", ret);
|
|
91
90
|
return ret;
|
|
92
91
|
}, e => {
|
|
93
92
|
console.log("couldn't determine if we are running as a service");
|
|
94
93
|
console.debug(e);
|
|
94
|
+
return false;
|
|
95
95
|
});
|
|
96
|
+
async function detectRunningAsService() {
|
|
97
|
+
if (const_1.IS_WINDOWS)
|
|
98
|
+
return getWindowsServicePids().then(x => x[node_process_1.pid] || x[node_process_1.ppid]);
|
|
99
|
+
if (process.platform === 'linux') {
|
|
100
|
+
// interactive shells live in session-*.scope; only a leaf *.service means this process is actually inside a service unit
|
|
101
|
+
const systemdFromCgroup = await (0, promises_1.readFile)('/proc/self/cgroup', 'utf8').then(cgroup => cgroup.split('\n')
|
|
102
|
+
// cgroup v1 uses single-colon fields while v2 uses double-colon; taking the last colon-separated field covers both
|
|
103
|
+
.map(line => line.split(':').pop()?.split('/').pop() || '')
|
|
104
|
+
.find(unit => unit.endsWith('.service')));
|
|
105
|
+
if (systemdFromCgroup)
|
|
106
|
+
return systemdFromCgroup;
|
|
107
|
+
// keep env markers as a last fallback only for non-interactive runs, to avoid false positives in normal terminal sessions
|
|
108
|
+
if (!process.stdin.isTTY && !process.stdout.isTTY && (process.env.INVOCATION_ID || process.env.JOURNAL_STREAM || process.env.NOTIFY_SOCKET || process.env.SYSTEMD_EXEC_PID))
|
|
109
|
+
return process.env.INVOCATION_ID || process.env.SYSTEMD_EXEC_PID || 'systemd';
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
// launchd services expose LAUNCH_JOB_NAME and run detached from interactive ttys
|
|
113
|
+
if (!const_1.IS_MAC || process.stdin.isTTY || process.stdout.isTTY)
|
|
114
|
+
return false;
|
|
115
|
+
const launchdService = process.env.LAUNCH_JOB_NAME || false;
|
|
116
|
+
if (launchdService)
|
|
117
|
+
return launchdService;
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
96
120
|
function reg(...pars) {
|
|
97
121
|
return (0, util_1.promisify)(child_process_1.execFile)('reg', pars).then(x => x.stdout);
|
|
98
122
|
}
|
package/src/webdav.js
CHANGED
|
@@ -213,8 +213,8 @@ async function handledWebdav(ctx) {
|
|
|
213
213
|
return `<?xml version="1.0" encoding="utf-8"?><prop xmlns="DAV:"><lockdiscovery><activelock>
|
|
214
214
|
<locktype><write/></locktype>
|
|
215
215
|
<lockscope><exclusive/></lockscope>
|
|
216
|
-
<locktoken><href>${token}</href></locktoken>
|
|
217
|
-
<lockroot><href>${path}</href></lockroot>
|
|
216
|
+
<locktoken><href>${lodash_1.default.escape(token)}</href></locktoken>
|
|
217
|
+
<lockroot><href>${lodash_1.default.escape(path)}</href></lockroot>
|
|
218
218
|
<depth>0</depth>
|
|
219
219
|
<timeout>Second-${seconds}</timeout>
|
|
220
220
|
</activelock></lockdiscovery></prop>`;
|
|
@@ -254,7 +254,7 @@ async function handledWebdav(ctx) {
|
|
|
254
254
|
const isDir = await (0, vfs_1.nodeIsFolder)(node);
|
|
255
255
|
const st = await (0, vfs_1.nodeStats)(node);
|
|
256
256
|
res.write(`<response>
|
|
257
|
-
<href>${outPath + (append ? (0, cross_1.pathEncode)(name, true) + (isDir ? '/' : '') : '')}</href>
|
|
257
|
+
<href>${lodash_1.default.escape(outPath + (append ? (0, cross_1.pathEncode)(name, true) + (isDir ? '/' : '') : ''))}</href>
|
|
258
258
|
<propstat>
|
|
259
259
|
<status>HTTP/1.1 200 OK</status>
|
|
260
260
|
<prop>
|