removed some legacy code
Massimo Melina committed
Jul 7, 2024 at 10:31 UTC
a891c025ed4486b845ce8fc108e9d79e1b2f0fc0
6 files changed
+3
-22
admin/src/LogsPage.ts
+1
-1
@@ -272,7 +272,7 @@ function LogFile({ file, addToFooter, hidden }: { hidden?: boolean, file: string
272
const [path, query] = splitAt('?', value).map(safeDecodeURIComponent)
273
const ul = row.extra?.ul
274
if (ul)
275
- return typeof ul === 'string' ? ul // legacy pre-0.51
275
+ return typeof ul === 'string' ? ul //legacy pre-0.51
276
: path + ul.join(' + ')
277
if (!path.startsWith(API_URL))
278
return [path, query && h(Box, { key: 0, component: 'span', color: 'text.secondary', fontSize: 'smaller' }, '?', query)]
frontend/src/useFetchList.ts
-1
@@ -37,7 +37,6 @@ export default function useFetchList() {
37
state.uri = uri // this should be a better way than uriChanged
38
state.showFilter = false
39
state.stopSearch?.()
40
- hfsEvent('uriChanged', { uri, previous }) // legacy pre-0.52, remove in 0.54
40
}
41
state.searchManuallyInterrupted = false
42
if (previous && previous !== uri && search) {
plugins/download-counter/plugin.js
-15
@@ -16,21 +16,6 @@ exports.configDialog = {
16
17
exports.init = async api => {
18
const db = await api.openDb('counters.kv', { defaultPutDelay: 5_000, maxPutDelay: 30_000 })
19
-
20
- try { // load legacy file
21
- const countersFile = 'counters.yaml'
22
- const yaml = api.require('yaml')
23
- const { readFile, unlink } = api.require('fs/promises')
24
- const data = await readFile(countersFile, 'utf8')
25
- for (const [k,v] of Object.entries(yaml.parse(data)))
26
- db.put(uri2key(k), v)
27
- await unlink(countersFile)
28
- api.log("data converted")
29
- }
30
- catch(err) {
31
- if (err.code !== 'ENOENT')
32
- api.log(err)
33
- }
19
return {
20
frontend_js: 'main.js',
21
frontend_css: 'style.css',
src/plugins.ts
+1
-1
@@ -141,7 +141,7 @@ export const pluginsMiddleware: Koa.Middleware = async (ctx, next) => {
141
lastStatus = ctx.status
142
lastBody = ctx.body
143
}
144
- if (res === true && !ctx.isStopped) { // legacy pre-0.53
144
+ if (res === true && !ctx.isStopped) { //legacy pre-0.53
145
ctx.stop()
146
warnOnce(`plugin ${id} is using deprecated API (return true on middleware) and may not work with future versions (check for an update to "${id}")`)
147
}
src/serveFile.ts
-2
@@ -77,9 +77,7 @@ export async function serveFile(ctx: Koa.Context, source:string, mime?:string, c
77
if (!stats.isFile())
78
return ctx.status = HTTP_METHOD_NOT_ALLOWED
79
ctx.set('Last-Modified', stats.mtime.toUTCString())
80
- ctx.fileSource = // legacy pre-0.51
80
ctx.state.fileSource = source
82
- ctx.fileStats = // legacy pre-0.51
81
ctx.state.fileStats = stats
82
ctx.status = HTTP_OK
83
if (ctx.fresh)
src/upload.ts
+1
-2
@@ -203,8 +203,7 @@ export function uploadWriter(base: VfsNode, path: string, ctx: Koa.Context) {
203
}
204
205
async function overwriteAnyway() {
206
- if (ctx.query.overwrite === undefined // legacy pre-0.52
207
- && ctx.query.existing !== 'overwrite') return
206
+ if (ctx.query.existing !== 'overwrite') return
207
const n = await getNodeByName(path, base)
208
return n && hasPermission(n, 'can_delete', ctx)
209
}