mirror of https://github.com/certd/certd
perf: 是否允许爬虫爬取增加ui设置选项
parent
5d29a08ab7
commit
779db9da70
|
@ -25,6 +25,7 @@ export class SysPublicSettings extends BaseSettings {
|
|||
limitUserPipelineCount = 0;
|
||||
managerOtherUserPipeline = false;
|
||||
icpNo?: string;
|
||||
robots?: boolean = true;
|
||||
}
|
||||
|
||||
export class SysPrivateSettings extends BaseSettings {
|
||||
|
|
|
@ -34,6 +34,7 @@ export type SysPublicSetting = {
|
|||
limitUserPipelineCount?: number;
|
||||
managerOtherUserPipeline?: boolean;
|
||||
icpNo?: string;
|
||||
robots?: boolean;
|
||||
};
|
||||
export type SuiteSetting = {
|
||||
enabled?: boolean;
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
<a-input v-model:value="formState.public.icpNo" placeholder="粤ICP备xxxxxxx号" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="允许爬虫" :name="['public', 'robots']">
|
||||
<a-switch v-model:checked="formState.public.robots" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="HTTP代理" :name="['private', 'httpProxy']" :rules="urlRules">
|
||||
<a-input v-model:value="formState.private.httpProxy" placeholder="http://192.168.1.2:18010/" />
|
||||
<div class="helper">当某些网站被墙时可以配置</div>
|
||||
|
|
|
@ -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: /';
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue