feat(server): add workspace avatar support in doc reader (#10390)

This commit is contained in:
fengmk2
2025-02-28 12:41:26 +00:00
parent 008fdfc234
commit b59f60c60b
5 changed files with 132 additions and 30 deletions

View File

@@ -5,7 +5,7 @@ import { Controller, Get, Logger, Req, Res } from '@nestjs/common';
import type { Request, Response } from 'express';
import isMobile from 'is-mobile';
import { Config, metrics, URLHelper } from '../../base';
import { Config, metrics } from '../../base';
import { htmlSanitize } from '../../native';
import { Public } from '../auth';
import { DocReader } from '../doc';
@@ -52,8 +52,7 @@ export class DocRendererController {
constructor(
private readonly doc: DocReader,
private readonly permission: PermissionService,
private readonly config: Config,
private readonly url: URLHelper
private readonly config: Config
) {
this.webAssets = this.readHtmlAssets(
join(this.config.projectRoot, 'static')
@@ -132,11 +131,7 @@ export class DocRendererController {
return {
title: workspaceContent.name,
summary: '',
avatar: workspaceContent.avatarKey
? this.url.link(
`/api/workspaces/${workspaceId}/blobs/${workspaceContent.avatarKey}`
)
: undefined,
avatar: workspaceContent.avatarUrl,
};
}
}