fix(plugins): let an admin run a plugin outside its TREK range, and tidy the plugins panel

TREK 5.0 left most registry plugins blocked because their authors still declare
"<5.0.0", and the only way past that was TREK_PLUGINS_IGNORE_TREK_RANGE for every
plugin at once. An admin can now install or switch on one such plugin after a
warning; the consent is kept on its row for that plugin version and TREK major,
so an update or a new major asks again. The environment switch works as before.

Discover marks a plugin not confirmed for this TREK on its card, and Install opens
the warning first. Admin > Plugins reads cleaner: one row of alike facts per plugin
with each state that needs attention on its own line, type, status and order behind
one Filter button, and the containment notes in a dialog behind the shield in the
header. The row, the filter menu and the dialog moved into their own files.
This commit is contained in:
Maurice
2026-10-26 00:48:13 +01:00
parent d589da59f2
commit 0067b0ff19
62 changed files with 1673 additions and 575 deletions
+10 -3
View File
@@ -113,8 +113,15 @@ export class PluginsController {
// compatible version and reporting addons the admin still has to enable.
// Dependency resolution pins versions internally but never DELIBERATELY, so
// only the plain path below recomputes the update hold.
if (body.withDependencies) return await this.registry.installWithDependencies(body.id, body.constraint);
const res = await this.registry.install(body.id, { version: body.version, constraint: body.constraint });
const acceptTrekRange = body.acceptTrekRange === true;
if (body.withDependencies) {
return await this.registry.installWithDependencies(body.id, body.constraint, acceptTrekRange);
}
const res = await this.registry.install(body.id, {
version: body.version,
constraint: body.constraint,
acceptTrekRange,
});
await this.registry.recomputeUpdateHold(res.id, res.version, !!body.version);
return res;
} catch (e) {
@@ -272,7 +279,7 @@ export class PluginsController {
async activate(@Param('id') id: string, @Body() body: PluginActivateDto) {
if (!pluginsEnabled()) throw new HttpException({ error: 'Plugins are disabled by server configuration' }, 503);
try {
await this.runtime.activate(id, !!body?.consent);
await this.runtime.activate(id, !!body?.consent, body?.acceptTrekRange === true);
} catch (e) {
// Re-enabling a plugin whose update widened its permissions must NOT grant
// them silently — surface a distinct code so the UI opens the consent dialog.