removed unused code
Massimo Melina committed
Apr 1, 2026 at 11:21 UTC
cdd5fed84d336341c4b1d7007b879294aba77a52
12 files changed
+11
-78
admin/package.json
-2
@@ -27,7 +27,6 @@
27
"react-router-dom": "^6.23.1",
28
"react-simple-code-editor": "^0.13.1",
29
"react-window": "^1.8.10",
30
- "tssrp6a": "^3.0.0",
30
"valtio": "^1.13.0",
31
"immer": "*",
32
"usehooks-ts": "^2.9.5"
@@ -37,7 +36,6 @@
36
"@types/react": "^18.3.14",
37
"@types/react-dom": "^18.3.2",
38
"@types/react-window": "^1.8.8",
40
- "@types/react-virtualized-auto-sizer": "^1.0.4",
39
"vite": "^6.4.1"
40
},
41
"eslintConfig": {
admin/src/InstalledPlugins.ts
+1
-1
@@ -163,7 +163,7 @@ function getSingleConfig(k: string) {
163
}
164
165
// hide the hfs- prefix, as one may want to use it for its repository, because github is the context, but in the hfs context the prefix it's not only redundant, but also ruins the sorting
166
-export function treatPluginName(name: string) {
166
+function treatPluginName(name: string) {
167
return name.replace(/hfs-/, '')
168
}
169
admin/src/addFiles.ts
+1
-1
@@ -59,7 +59,7 @@ function normalizeFilename(x: string) {
59
return x.toLocaleLowerCase().normalize() // in this context we always use lowercase for comparison
60
}
61
62
-export function isSameFilenameAs(name: string) {
62
+function isSameFilenameAs(name: string) {
63
const normalized = normalizeFilename(name)
64
return (other: string | VfsNodeAdmin) =>
65
normalized === normalizeFilename(typeof other === 'string' ? other : other.name)
admin/src/setupTests.ts
deleted
-5
@@ -1,5 +0,0 @@
1
-// jest-dom adds custom jest matchers for asserting on DOM nodes.
2
-// allows you to do things like:
3
-// expect(element).toHaveTextContent(/react/i)
4
-// learn more: https://github.com/testing-library/jest-dom
5
-import '@testing-library/jest-dom';
frontend/package.json
-1
@@ -12,7 +12,6 @@
12
"@hfs/shared": "*",
13
"lodash": "^4.17.21",
14
"preact": "^10.28.1",
15
- "tssrp6a": "^3.0.0",
15
"usehooks-ts": "^2.6.0",
16
"valtio": "^1.13.0",
17
"wouter": "^3.4.1",
frontend/src/setupTests.ts
deleted
-5
@@ -1,5 +0,0 @@
1
-// jest-dom adds custom jest matchers for asserting on DOM nodes.
2
-// allows you to do things like:
3
-// expect(element).toHaveTextContent(/react/i)
4
-// learn more: https://github.com/testing-library/jest-dom
5
-import '@testing-library/jest-dom';
package.json
+1
-4
@@ -80,7 +80,7 @@
80
},
81
"dependencies": {
82
"@gregoranders/csv": "^0.0.13",
83
- "@rejetto/kvstorage": "^0.17.2",
83
+ "@rejetto/kvstorage": "^0.17.1",
84
"acme-client": "^5.4.0",
85
"busboy": "^1.6.0",
86
"crc-32": "^1.2.2",
@@ -114,10 +114,7 @@
114
"@playwright/test": "^1.55.1",
115
"@types/busboy": "^1.5.4",
116
"@types/koa": "^3.0.0",
117
- "@types/koa__router": "^12.0.4",
118
- "@types/koa-compress": "^4.0.6",
117
"@types/koa-mount": "^4.0.5",
120
- "@types/koa-session": "^6.4.5",
118
"@types/lodash": "^4.17.20",
119
"@types/mime-types": "^3.0.1",
120
"@types/minimist": "^1.2.5",
plugins/updater-disabled/plugin.js
deleted
-48
@@ -1,48 +0,0 @@
1
-/*
2
-This plugin is currently experimental and working only with exe version.
3
-Its capability is to offer automatic restart when an update is available in the form of hfs.exe-new file.
4
-
5
-Tip: In my case I'm uploading "hfs.exe-new" over ftp, and it's a bit slow, so to avoid the plugin to catch
6
- an unfinished file, I do the upload using a temporary name, and only when it's done I rename it to "hfs.exe-new".
7
-*/
8
-exports.version = 0.3
9
-exports.description = "automatic restart when an update is available in the form of hfs.exe-new file"
10
-exports.apiRequired = 3 // api.log
11
-
12
-const NEW = 'hfs.exe-new'
13
-const UPDATING = 'hfs.exe-updating'
14
-const BATCH_NAME = 'run-updater.bat'
15
-const BATCH = `@echo off
16
-:loop
17
-setlocal
18
-SET hfs_updater=1
19
-hfs %*
20
-endlocal
21
-if exist hfs.exe-new (
22
- move /y hfs.exe hfs.exe-old
23
- move /y ${UPDATING} hfs.exe
24
- goto loop
25
-)
26
-`
27
-
28
-exports.init = async api => {
29
- const fs = api.require('fs')
30
- fs.writeFile(BATCH_NAME, BATCH, err =>
31
- err && api.log("couldn't write", BATCH_NAME))
32
- if (!process.env.hfs_updater)
33
- return api.log("run", BATCH_NAME, "to have restart-on-update")
34
-
35
- api.log("ready")
36
- const timer = setInterval(() => {
37
- fs.rename(NEW, UPDATING, err => {
38
- if (err) return
39
- api.log("exiting for update")
40
- process.emit('SIGTERM')
41
- })
42
- }, 5000)
43
- return {
44
- unload() {
45
- clearInterval(timer)
46
- }
47
- }
48
-}
src/serveFile.ts
+5
-8
@@ -194,8 +194,11 @@ function downloadLimiter<T>(configMax: { get: () => number | undefined }, cbKey:
194
if (k === undefined) return // undefined = skip limit
195
const max = configMax.get()
196
const now = map.get(k) || 0
197
- if (max && now >= max)
198
- return tooMany()
197
+ if (max && now >= max) {
198
+ ctx.set('retry-after', '60')
199
+ return sendErrorPage(ctx, HTTP_TOO_MANY_REQUESTS)
200
+ .then(() => true) // true = limit exceeded
201
+ }
202
map.set(k, now + 1)
203
ctx.req.on('close', () => {
204
const n = map.get(k)!
@@ -205,11 +208,5 @@ function downloadLimiter<T>(configMax: { get: () => number | undefined }, cbKey:
208
map.delete(k)
209
})
210
return false // limit is enforced but passed
208
-
209
- async function tooMany() {
210
- ctx.set('retry-after', '60')
211
- await sendErrorPage(ctx, HTTP_TOO_MANY_REQUESTS)
212
- return true
213
- }
211
}
212
}
src/srp.ts
+1
-1
@@ -1,6 +1,6 @@
1
// This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
2
3
-export type ApiCall = (cmd:string, params:any) => any
3
+type ApiCall = (cmd:string, params:any) => any
4
type Srp = typeof import('tssrp6a')
5
6
export async function srpClientSequence(srp: Srp, username:string, password:string, apiCall: ApiCall, extra?: object) {
src/walkDir.ts
+1
-1
@@ -10,7 +10,7 @@ import { Context } from 'koa'
10
import fswin from 'fswin'
11
import { isDirectory, statWithTimeout } from './util-files'
12
13
-export interface DirStreamEntry extends Dirent {
13
+interface DirStreamEntry extends Dirent {
14
closingBranch?: Promise<string>
15
stats?: Stats
16
}
src/watchLoad.ts
+1
-1
@@ -6,7 +6,7 @@ import { readFileWithBusyRetry } from './util-files'
6
import { debounceAsync } from './debounceAsync'
7
import { BetterEventEmitter } from './events'
8
9
-export type WatchLoadCanceller = () => void
9
+type WatchLoadCanceller = () => void
10
11
interface Options { failedOnFirstAttempt?: ()=>void, immediateFirst?: boolean }
12