chore(server): enable renderer for all deployment (#8283)

This commit is contained in:
forehalo
2024-09-19 02:34:57 +00:00
parent a1fe7c8ef6
commit 03ac9bc4a1
2 changed files with 14 additions and 9 deletions

View File

@@ -33,7 +33,7 @@ const defaultAssets: HtmlAssets = {
description: '',
};
@Controller('/workspace/:workspaceId/:docId')
@Controller('/workspace')
export class DocRendererController {
private readonly logger = new Logger(DocRendererController.name);
private readonly webAssets: HtmlAssets = defaultAssets;
@@ -68,7 +68,7 @@ export class DocRendererController {
}
@Public()
@Get()
@Get('/:workspaceId/:docId')
async render(
@Req() req: Request,
@Res() res: Response,
@@ -87,7 +87,7 @@ export class DocRendererController {
try {
opts =
workspaceId === docId
? await this.renderWorkspace(workspaceId)
? await this.getWorkspaceContent(workspaceId)
: await this.getPageContent(workspaceId, docId);
metrics.doc.counter('render').add(1);
} catch (e) {
@@ -123,7 +123,7 @@ export class DocRendererController {
return null;
}
private async renderWorkspace(
private async getWorkspaceContent(
workspaceId: string
): Promise<RenderOptions | null> {
const allowUrlPreview = await this.permission.allowUrlPreview(workspaceId);