mirror of
https://github.com/certd/certd.git
synced 2026-04-21 18:37:28 +08:00
19 lines
559 B
TypeScript
19 lines
559 B
TypeScript
import { Controller, Get, Inject, Provide } from '@midwayjs/core';
|
|
import { Constants, SysSettingsService } from '@certd/lib-server';
|
|
|
|
@Provide()
|
|
@Controller('/')
|
|
export class HomeController {
|
|
@Inject()
|
|
sysSettingsService: SysSettingsService;
|
|
@Get('/robots.txt', { summary: Constants.per.guest })
|
|
async robots(): Promise<string> {
|
|
const publicSettings = await this.sysSettingsService.getPublicSettings();
|
|
if (!publicSettings.robots) {
|
|
return 'User-agent: *\nDisallow: /';
|
|
} else {
|
|
return 'User-agent: *\nAllow: /';
|
|
}
|
|
}
|
|
}
|