mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-15 07:34:42 -04:00
Remove banner from frontend config
NestJS adds the headers "Last Modified" and "ETag" to asset serving responses. Therefore all the information we need for the banner are already given by the file content or the file meta data. Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
ff06f368de
commit
58075f787e
3 changed files with 0 additions and 50 deletions
|
@ -8,7 +8,6 @@ import { Inject, Injectable } from '@nestjs/common';
|
|||
import { ConsoleLoggerService } from '../logger/console-logger.service';
|
||||
import {
|
||||
AuthProviders,
|
||||
BannerDto,
|
||||
BrandingDto,
|
||||
CustomAuthNamesDto,
|
||||
FrontendConfigDto,
|
||||
|
@ -24,8 +23,6 @@ import externalServicesConfiguration, {
|
|||
ExternalServicesConfig,
|
||||
} from '../config/external-services.config';
|
||||
import { getServerVersionFromPackageJson } from '../utils/serverVersion';
|
||||
import { promises as fs, Stats } from 'fs';
|
||||
import { join } from 'path';
|
||||
|
||||
@Injectable()
|
||||
export class FrontendConfigService {
|
||||
|
@ -49,7 +46,6 @@ export class FrontendConfigService {
|
|||
allowAnonymous: false,
|
||||
allowRegister: this.authConfig.email.enableRegister,
|
||||
authProviders: this.getAuthProviders(),
|
||||
banner: await FrontendConfigService.getBanner(),
|
||||
branding: this.getBranding(),
|
||||
customAuthNames: this.getCustomAuthNames(),
|
||||
iframeCommunication: this.getIframeCommunication(),
|
||||
|
@ -138,23 +134,4 @@ export class FrontendConfigService {
|
|||
: new URL(this.appConfig.domain),
|
||||
};
|
||||
}
|
||||
|
||||
private static async getBanner(): Promise<BannerDto> {
|
||||
const path = join(__dirname, '../../banner.md');
|
||||
try {
|
||||
const bannerContent: string = await fs.readFile(path, {
|
||||
encoding: 'utf8',
|
||||
});
|
||||
const fileStats: Stats = await fs.stat(path);
|
||||
return {
|
||||
text: bannerContent,
|
||||
updateTime: fileStats.mtime,
|
||||
};
|
||||
} catch (e) {
|
||||
return {
|
||||
text: '',
|
||||
updateTime: new Date(0),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue