mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 23:25:24 +00:00
feat: serve plugin http and websockets from one mount instead of ports
This commit is contained in:
1 parent
c496a093ca
commit
8431570ff7
102 files changed
+2894
-2308
No files matched your search
@@ -5,8 +5,10 @@ import {
|
||||
} from "./routes.js";
|
||||
|
||||
export async function activate(ctx: PluginContext) {
|
||||
startNetworkTopologyService();
|
||||
ctx.log.info("Network Topology router registered at /network-topology");
|
||||
startNetworkTopologyService(ctx.http.router());
|
||||
ctx.log.info(
|
||||
"Network Topology routes mounted at /plugin-api/network-topology",
|
||||
);
|
||||
}
|
||||
|
||||
export async function deactivate() {
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import express from "express";
|
||||
import express, { type Router } from "express";
|
||||
import { AuthManager } from "../../../../src/backend/utils/auth-manager.js";
|
||||
import type { AuthenticatedRequest } from "../../../../src/types/index.js";
|
||||
import { databaseLogger } from "../../../../src/backend/utils/logger.js";
|
||||
import { createCurrentNetworkTopologyRepository } from "../../../../src/backend/database/repositories/factory.js";
|
||||
import {
|
||||
registerNetworkTopologyRouter,
|
||||
unregisterNetworkTopologyRouter,
|
||||
} from "../../../../src/backend/database/routes/network-topology-dispatch.js";
|
||||
|
||||
export const router = express.Router();
|
||||
|
||||
@@ -179,10 +175,10 @@ router.post(
|
||||
},
|
||||
);
|
||||
|
||||
export function startNetworkTopologyService(): void {
|
||||
registerNetworkTopologyRouter(router);
|
||||
export function startNetworkTopologyService(mountOn: Router): void {
|
||||
mountOn.use(router);
|
||||
}
|
||||
|
||||
export function stopNetworkTopologyService(): void {
|
||||
unregisterNetworkTopologyRouter();
|
||||
// Unmounted by the runtime when the plugin deactivates.
|
||||
}
|
||||
Reference in new issue
Block a user