removed some legacy code
Massimo Melina committed
Jun 8, 2025 at 19:27 UTC
1ca8a29992b731ae52c690bbce3799ae97a7a3ae
3 files changed
+2
-8
src/roots.ts
+1
-5
@@ -1,4 +1,4 @@
1
-import { defineConfig, getConfig } from './config'
1
+import { defineConfig } from './config'
2
import {
3
ADMIN_URI, API_URI, Callback, CFG, isLocalHost, join, makeMatcher, removeStarting, SPECIAL_URI, try_,
4
enforceFinal, enforceStarting
@@ -15,10 +15,6 @@ export const roots = defineConfig(CFG.roots, {} as { [hostMask: string]: string
15
return (host: string) => values[matchers.findIndex(m => m(host))]
16
})
17
const forceAddress = defineConfig(CFG.force_address, false)
18
-forceAddress.sub((v, { version }) => { // convert from legacy configs
19
- if (version?.olderThan('0.53.0-alpha2'))
20
- forceAddress.set(getConfig('force_base_url') || getConfig('roots_mandatory') || false)
21
-})
18
19
export const rootsMiddleware: Koa.Middleware = (ctx, next) =>
20
(() => {
src/serveFile.ts
-1
@@ -49,7 +49,6 @@ export async function serveFileNode(ctx: Koa.Context, node: VfsNode) {
49
return ctx.status = HTTP_FORBIDDEN
50
}
51
52
- ctx.vfsNode = // legacy pre-0.51 (download-quota)
52
ctx.state.vfsNode = node // useful to tell service files from files shared by the user
53
const download = 'dl' in ctx.query
54
disposition(ctx, name, download)
src/vfs.ts
+1
-2
@@ -133,8 +133,7 @@ export async function urlToNode(url: string, ctx?: Koa.Context, parent: VfsNode=
133
134
export async function nodeStats(ret: VfsNode) {
135
if (ret.stats)
136
- if (_.isPlainObject(ret.stats)) delete ret.stats // legacy pre-55-alpha1
137
- else return ret.stats
136
+ return ret.stats
137
const stats = ret.source ? await fs.stat(ret.source) : undefined
138
setHidden(ret, { stats })
139
return stats