mirror of
https://github.com/sern-handler/automata
synced 2026-06-28 02:32:16 +00:00
* some progress * feat: ssh commiting done * remove submodules * Merge branch 'main' into fix/pushing * remove dockerfile
18 lines
693 B
TypeScript
18 lines
693 B
TypeScript
import type { Request, Response } from "express"
|
|
|
|
export default async function resolvePlugins(plugins: string[], req: Request, res: Response) {
|
|
if (plugins.length === 0)
|
|
// not doing any crazy stuff today sorry
|
|
return [true]
|
|
const resolvedPlugins: boolean[] = []
|
|
plugins.forEach(async (plugin) => {
|
|
const resolvedPlugin = await import(`../plugins/${plugin}.js`)
|
|
.then(async (plugin) => await plugin.default(req, res) as boolean)
|
|
.catch(() => {
|
|
console.error(`Plugin ${plugin} doesn't exist`)
|
|
return false
|
|
})
|
|
resolvedPlugins.push(resolvedPlugin)
|
|
})
|
|
return resolvedPlugins
|
|
} |