better code
Massimo Melina committed
Aug 7, 2023 at 18:57 UTC
ecedefc780bdfc88957320f7f116a063cb6c8471
2 files changed
+3
-4
admin/src/OnlinePlugins.ts
-1
@@ -11,7 +11,6 @@ import { renderName, showError, startPlugin, UpdateButton } from './InstalledPlu
11
import { state, useSnapState } from './state'
12
import _ from 'lodash'
13
import { alertDialog } from './dialog'
14
-import { LinearProgress } from '@mui/material'
14
15
export default function OnlinePlugins() {
16
const [search, setSearch] = useState('')
src/plugins.ts
+3
-3
@@ -118,7 +118,7 @@ export const pluginsMiddleware: Koa.Middleware = async (ctx, next) => {
118
try {
119
const res = await pl.middleware?.(ctx)
120
if (res === true)
121
- ctx.pluginStopped = true
121
+ console.debug("plugin blocked request", ctx.pluginBlockedRequest = id)
122
if (typeof res === 'function')
123
after[id] = res
124
}
@@ -126,8 +126,8 @@ export const pluginsMiddleware: Koa.Middleware = async (ctx, next) => {
126
printError(id, e)
127
}
128
// expose public plugins' files
129
- const { path } = ctx
130
- if (!ctx.pluginStopped) {
129
+ if (!ctx.pluginBlockedRequest) {
130
+ const { path } = ctx
131
if (path.startsWith(PLUGINS_PUB_URI)) {
132
const a = path.substring(PLUGINS_PUB_URI.length).split('/')
133
const name = a.shift()!