certd/ui/certd-server/controllers/plugins.js

20 lines
463 B
JavaScript

import Router from 'koa-router'
import { pluginRegistry } from '@certd/api'
import DefaultPlugins from '@certd/plugins'
import _ from 'lodash-es'
import { Ret } from '../models/Ret.js'
const router = Router()
router.prefix('/plugins')
DefaultPlugins.install()
router.get('/list', function (ctx, next) {
const list = []
_.forEach(pluginRegistry.collection, item => {
list.push(item.define())
})
ctx.body = Ret.success(list)
})
export default router