@samitouri / QOSami-HFS / commits / eed20e8b

?refuse starting plugins with wrong api version

Massimo Melina committed Jun 11, 2024 at 15:13 UTC eed20e8b0f97d0170183023f8abc030800fd1d10
2 files changed +2 -3
admin/src/InstalledPlugins.ts
+1 -2
@@ -138,8 +138,7 @@ export default function InstalledPlugins({ updates }: { updates?: true }) {
138 export function renderName({ row, value }: any) {
139 const { repo } = row
140 return h(Fragment, {},
141 - errorIcon(row.badApi, true),
142 - errorIcon(row.error),
141 + errorIcon(row.error || row.badApi, !row.error),
142 repo?.includes('//') ? h(Link, { href: repo, target: 'plugin' }, value)
143 : !repo ? value
144 : with_(repo?.split('/'), arr => h(Fragment, {},
src/plugins.ts
+1 -1
@@ -413,7 +413,7 @@ function watchPlugin(id: string, path: string) {
413 deleteModule(require.resolve(module)) // avoid caching at next import
414 calculateBadApi(pluginData)
415 if (pluginData.badApi)
416 - console.log("plugin", id, pluginData.badApi)
416 + throw Error(pluginData.badApi)
417
418 await alreadyRunning?.unload(true)
419 console.debug("starting plugin", id)