@samitouri / QOSami-HFS / commits / 0525838c

remove legacy code

Massimo Melina committed Oct 22, 2025 at 22:47 UTC 0525838ce3755a42f368c2c28b06eae7ef9f77a8
3 files changed +5 -12
admin/src/LogsPage.ts
+2 -3
@@ -319,9 +319,8 @@ export function LogFile({ file, footerSide, hidden, limit, filter, ...rest }: Lo
319 renderCell: ({ value, row }) => {
320 const [path, query] = splitAt('?', value).map(safeDecodeURIComponent)
321 const ul = row.extra?.ul
322 - if (ul)
323 - return typeof ul === 'string' ? ul //legacy pre-0.51
324 - : path + ul.join(' + ')
322 + if (_.isArray(ul))
323 + return path + ul.join(' + ')
324 if (!path.startsWith(API_URL))
325 return [path, query && h(Box, { key: 0, component: 'span', color: 'text.secondary', fontSize: 'smaller' }, '?', query)]
326 const name = path.slice(API_URL.length)
frontend/src/misc.ts
+2 -2
@@ -69,7 +69,7 @@ export function hfsEvent(name: string, params?:Dict) {
69 })
70 }
71
72 -export function onHfsEvent(name: string, cb: (params:any, extra: { output: any[], setOrder: Callback<number>, preventDefault: Callback }, output: any[]) => any, options?: { once?: boolean }) {
72 +export function onHfsEvent(name: string, cb: (params:any, extra: { output: any[], setOrder: Callback<number>, preventDefault: Callback }) => any, options?: { once?: boolean }) {
73 const key = 'hfs.' + name
74 document.addEventListener(key, wrapper, options)
75 return () => document.removeEventListener(key, wrapper)
@@ -81,7 +81,7 @@ export function onHfsEvent(name: string, cb: (params:any, extra: { output: any[]
81 output,
82 setOrder(x) { thisOrder = x },
83 preventDefault: () => ev.preventDefault()
84 - }, output) // legacy pre-0.54, third parameter used by file-icons plugin
84 + })
85 if (res !== undefined && Array.isArray(output)) {
86 output.push(res)
87 if (thisOrder)
src/plugins.ts
+1 -7
@@ -18,7 +18,7 @@ import { DirEntry } from './api.get_file_list'
18 import { VfsNode } from './vfs'
19 import { serveFile } from './serveFile'
20 import events from './events'
21 -import { mkdir, readdir, readFile, rename, rm } from 'fs/promises'
21 +import { mkdir, readdir, readFile, rm } from 'fs/promises'
22 import { existsSync, mkdirSync } from 'fs'
23 import { getConnections } from './connections'
24 import { dirname, join, resolve } from 'path'
@@ -194,10 +194,6 @@ export const pluginsMiddleware: Koa.Middleware = async (ctx, next) => {
194 }
195 if (ctx.isAborted())
196 ctx.stop()
197 - if (res === true && !ctx.isStopped) { //legacy pre-0.53
198 - ctx.stop()
199 - warnOnce(`plugin ${id} is using deprecated API (return true on middleware) and may not work with future versions (check for an update to "${id}")`)
200 - }
197 // don't just check ctx.isStopped, as the async plugin that called ctx.stop will reach here after sync ones
198 if (ctx.isStopped && !ctx.pluginBlockedRequest)
199 console.debug("plugin blocked request", ctx.pluginBlockedRequest = id)
@@ -511,8 +507,6 @@ function watchPlugin(id: string, path: string) {
507 await alreadyRunning?.unload(true)
508 console.debug("starting plugin", id)
509 const storageDir = resolve(PATH, id, STORAGE_FOLDER) + (IS_WINDOWS ? '\\' : '/')
514 - if (!module.startsWith(process.cwd())) //legacy pre-0.53.0, bundled plugins' storageDir was not under cwd
515 - await rename(resolve(module, '..', STORAGE_FOLDER), storageDir).catch(() => {})
510 await mkdir(storageDir, { recursive: true })
511 const openDbs: KvStorage[] = []
512 const subbedConfigs: Callback[] = []