Archived
1
0

src/node/plugin.ts: Implement new plugin API

This commit is contained in:
Anmol Sethi
2020-10-30 03:18:45 -04:00
parent 481df70622
commit e08a55d44a
2 changed files with 166 additions and 79 deletions

View File

@ -12,7 +12,7 @@ import { AuthType, DefaultedArgs } from "../cli"
import { rootPath } from "../constants"
import { Heart } from "../heart"
import { replaceTemplates } from "../http"
import { loadPlugins } from "../plugin"
import { PluginAPI } from "../plugin"
import { getMediaMime, paths } from "../util"
import { WebsocketRequest } from "../wsRouter"
import * as domainProxy from "./domainProxy"
@ -115,7 +115,9 @@ export const register = async (
app.use("/static", _static.router)
app.use("/update", update.router)
await loadPlugins(app, args)
const papi = new PluginAPI(logger, process.env.CS_PLUGIN, process.env.CS_PLUGIN_PATH)
await papi.loadPlugins()
papi.mount(app)
app.use(() => {
throw new HttpError("Not Found", HttpCode.NotFound)