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