mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
fix: 修复/robots.txt路由 (#4874)
This commit is contained in:
@@ -22,14 +22,13 @@ for (const project in RouterPath) {
|
|||||||
// index
|
// index
|
||||||
router.get('/', require('./routes/index'));
|
router.get('/', require('./routes/index'));
|
||||||
|
|
||||||
router.get('/robots.txt', async (ctx, next) => {
|
router.get('/robots.txt', async (ctx) => {
|
||||||
if (config.disallowRobot) {
|
if (config.disallowRobot) {
|
||||||
ctx.set('Content-Type', 'text/plain');
|
ctx.set('Content-Type', 'text/plain');
|
||||||
ctx.body = 'User-agent: *\nDisallow: /';
|
ctx.body = 'User-agent: *\nDisallow: /';
|
||||||
} else {
|
} else {
|
||||||
ctx.throw(404, 'Not Found');
|
ctx.throw(404, 'Not Found');
|
||||||
}
|
}
|
||||||
await next();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// test
|
// test
|
||||||
|
|||||||
Reference in New Issue
Block a user