mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
380641f4fd
First slice of the plugin system. Lays down the data model and a read-only admin surface; nothing executes yet. - Migration 155: plugins, plugin_meta_migrations, plugin_error_log and plugin_settings_fields tables. Plugin data will live in a per-plugin sqlite file under /plugins-data, never in these tables. - New Nest module server/src/nest/plugins with GET /api/admin/plugins (admin-gated, returns the installed list + the runtime-enabled flag). - TREK_PLUGINS_ENABLED kill switch (config.pluginsEnabled), off by default. - Admin → Plugins tab with a read-only panel: installed list, status badges, and a clear banner when the runtime is disabled by server config. - i18n keys for the tab and panel across all locales. Install, activation, the isolated runtime and the registry browser follow in later slices.
25 lines
862 B
TypeScript
25 lines
862 B
TypeScript
import { Controller, Get, UseGuards } from '@nestjs/common';
|
|
import { PluginsService } from './plugins.service';
|
|
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
|
import { AdminGuard } from '../auth/admin.guard';
|
|
|
|
/**
|
|
* /api/admin/plugins — admin-only plugin control surface (#plugins).
|
|
*
|
|
* M0 scaffold: read-only listing + the runtime-enabled flag. Install, activate,
|
|
* disable, uninstall and the registry browser are added in later milestones.
|
|
* Admin-gated like the rest of /api/admin. The proxy namespace /api/plugins/:id
|
|
* is reserved for the (future) runtime and is intentionally NOT part of this
|
|
* admin controller.
|
|
*/
|
|
@Controller('api/admin/plugins')
|
|
@UseGuards(JwtAuthGuard, AdminGuard)
|
|
export class PluginsController {
|
|
constructor(private readonly plugins: PluginsService) {}
|
|
|
|
@Get()
|
|
list() {
|
|
return this.plugins.list();
|
|
}
|
|
}
|