mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 06:35: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
@@ -2,8 +2,8 @@ import type { PluginContext } from "@termix/plugin-sdk/backend";
|
||||
import { startWorkspacesService, stopWorkspacesService } from "./routes.js";
|
||||
|
||||
export async function activate(ctx: PluginContext) {
|
||||
startWorkspacesService();
|
||||
ctx.log.info("Workspaces router registered at /workspaces");
|
||||
startWorkspacesService(ctx.http.router());
|
||||
ctx.log.info("Workspaces routes mounted at /plugin-api/workspaces");
|
||||
}
|
||||
|
||||
export async function deactivate() {
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import type { AuthenticatedRequest } from "../../../../src/types/index.js";
|
||||
import express, { type Request, type Response } from "express";
|
||||
import express, { type Request, type Response, type Router } from "express";
|
||||
import { databaseLogger } from "../../../../src/backend/utils/logger.js";
|
||||
import { AuthManager } from "../../../../src/backend/utils/auth-manager.js";
|
||||
import { createCurrentWorkspaceRepository } from "../../../../src/backend/database/repositories/factory.js";
|
||||
import type { WorkspaceRecord } from "../../../../src/backend/database/repositories/workspace-repository.js";
|
||||
import {
|
||||
registerWorkspacesRouter,
|
||||
unregisterWorkspacesRouter,
|
||||
} from "../../../../src/backend/database/routes/workspace-dispatch.js";
|
||||
|
||||
export const router = express.Router();
|
||||
|
||||
@@ -639,10 +635,10 @@ router.delete(
|
||||
},
|
||||
);
|
||||
|
||||
export function startWorkspacesService(): void {
|
||||
registerWorkspacesRouter(router);
|
||||
export function startWorkspacesService(mountOn: Router): void {
|
||||
mountOn.use(router);
|
||||
}
|
||||
|
||||
export function stopWorkspacesService(): void {
|
||||
unregisterWorkspacesRouter();
|
||||
// Unmounted by the runtime when the plugin deactivates.
|
||||
}
|
||||
Reference in new issue
Block a user