diff --git a/src/modules/app.ts b/src/modules/app.ts index b6a66b8..fd33979 100644 --- a/src/modules/app.ts +++ b/src/modules/app.ts @@ -19,3 +19,7 @@ export async function start() { await app.listen({ port: config.uint("core.appport"), host: "0.0.0.0" }); } + +export function get(): FastifyInstance { + return app; +} diff --git a/src/modules/plugin.ts b/src/modules/plugin.ts index 55acc9b..8ed955c 100644 --- a/src/modules/plugin.ts +++ b/src/modules/plugin.ts @@ -17,6 +17,7 @@ import { ProtocolManager, } from "./swarm.js"; import { get as getSSl, SSLManager } from "./ssl.js"; +import { get as getApp } from "./app.js"; import type { HDKey } from "micro-ed25519-hdkey"; import corePlugins from "../plugins"; import Util from "./plugin/util"; @@ -95,6 +96,10 @@ class PluginAPI extends EventEmitter2 { return getProtocolManager(); } + get app() { + return getApp(); + } + public loadPlugin( moduleName: string ): (moduleName: string) => Promise {