mirror of
https://github.com/certd/certd.git
synced 2026-04-16 05:50:50 +08:00
perf: 是否允许爬虫爬取增加ui设置选项
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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: /';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user