mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 13:39:35 +08:00
feat: allow empty for certain routes
This commit is contained in:
@@ -3,7 +3,7 @@ const he = require('he');
|
|||||||
module.exports = async (ctx, next) => {
|
module.exports = async (ctx, next) => {
|
||||||
await next();
|
await next();
|
||||||
|
|
||||||
if (ctx.state.data && (!ctx.state.data.item || ctx.state.data.item.length === 0)) {
|
if (ctx.state.data && (!ctx.state.data.item || ctx.state.data.item.length === 0) && !ctx.state.allowEmpty) {
|
||||||
throw Error('this route is empty, please check the origin site or create an issue to feedback on https://github.com/DIYgod/RSSHub/issues/new/choose');
|
throw Error('this route is empty, please check the origin site or create an issue to feedback on https://github.com/DIYgod/RSSHub/issues/new/choose');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,4 +49,5 @@ module.exports = async (ctx) => {
|
|||||||
link,
|
link,
|
||||||
item,
|
item,
|
||||||
};
|
};
|
||||||
|
ctx.state.allowEmpty = true;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user