mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-23 03:43:57 +03:00
chore(server): enable renderer for all deployment (#8283)
This commit is contained in:
parent
a1fe7c8ef6
commit
03ac9bc4a1
15
.github/helm/affine/templates/ingress.yaml
vendored
15
.github/helm/affine/templates/ingress.yaml
vendored
@ -60,15 +60,20 @@ spec:
|
||||
name: affine-graphql
|
||||
port:
|
||||
number: {{ .Values.graphql.service.port }}
|
||||
{{- if eq .Values.global.app.buildType "canary" }}
|
||||
- path: /workspace
|
||||
pathType: Prefix
|
||||
- path: /workspace/([^/]+)/(home|all|search|collection|tag|trash)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
service:
|
||||
name: affine-web
|
||||
port:
|
||||
number: {{ .Values.web.service.port }}
|
||||
- path: /workspace/([^/]+)/.+
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
service:
|
||||
name: affine-renderer
|
||||
port:
|
||||
number: {{ .Values.graphql.service.port }}
|
||||
{{- end }}
|
||||
number: {{ .Values.renderer.service.port }}
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user