mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 07:05:24 +00:00
feat: finish the web-endpoint plugin, add ctx.desktop (B8)
This commit is contained in:
1 parent
1682861853
commit
535126fd1b
50 files changed
+2018
-898
No files matched your search
@@ -1,12 +1,25 @@
|
||||
import type { Router } from "express";
|
||||
import type { PluginContext } from "@termix/plugin-sdk/backend";
|
||||
import { startWebEndpointService, stopWebEndpointService } from "./routes.js";
|
||||
import { createWebEndpointRoutes } from "./routes.js";
|
||||
import { hostImportNormalizer } from "./host-import.js";
|
||||
|
||||
export async function activate(ctx: PluginContext) {
|
||||
startWebEndpointService(ctx.http.router(), ctx);
|
||||
ctx.disposables.add(() => stopWebEndpointService());
|
||||
const router = ctx.http.router<Router>();
|
||||
router.use(createWebEndpointRoutes(ctx));
|
||||
|
||||
ctx.registry.provide(
|
||||
"web-endpoint.hostImportNormalizer",
|
||||
hostImportNormalizer,
|
||||
);
|
||||
ctx.disposables.add(
|
||||
() =>
|
||||
void ctx.registry.revoke(
|
||||
"web-endpoint.hostImportNormalizer",
|
||||
hostImportNormalizer,
|
||||
),
|
||||
);
|
||||
|
||||
ctx.log.info("Web Endpoint routes mounted at /plugin-api/web-endpoint");
|
||||
}
|
||||
|
||||
export async function deactivate() {
|
||||
stopWebEndpointService();
|
||||
}
|
||||
export async function deactivate() {}
|
||||
Reference in new issue
Block a user