mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
* 知乎日报全文rss * reverse router.js * 知乎日报当天全文rss * Update daily.js 去除JSON处理方法,添加对redis的异步get兼容,统一缓存保留时间。 * git ignore * 即刻topic广场信息 * Delete .gitignore * Revert "Merge branch 'master' into master" This reverts commitd2acb89f0b, reversing changes made to2c401dba0a. * fix bug * delete request for topic info * 把缩略图改成原图 * 添加exclude过滤 * fix md
27 lines
1.3 KiB
JavaScript
27 lines
1.3 KiB
JavaScript
module.exports = async (ctx, next) => {
|
|
await next();
|
|
|
|
if (ctx.state.data && ctx.query && (ctx.query.filter || ctx.query.filter_title || ctx.query.filter_description)) {
|
|
ctx.state.data.item = ctx.state.data.item.filter((item) => {
|
|
const title = item.title;
|
|
const description = item.description;
|
|
return !(
|
|
(ctx.query.filter && !title.match(ctx.query.filter) && !description.match(ctx.query.filter)) ||
|
|
(ctx.query.filter_title && !title.match(ctx.query.filter_title)) ||
|
|
(ctx.query.filter_description && !description.match(ctx.query.filter_description))
|
|
);
|
|
});
|
|
}
|
|
if (ctx.state.data && ctx.query && (ctx.query.filterout || ctx.query.filterout_title || ctx.query.filterout_description)) {
|
|
ctx.state.data.item = ctx.state.data.item.filter((item) => {
|
|
const title = item.title;
|
|
const description = item.description;
|
|
return (
|
|
(ctx.query.filterout && !title.match(ctx.query.filterout) && !description.match(ctx.query.filterout)) ||
|
|
(ctx.query.filterout_title && !title.match(ctx.query.filterout_title)) ||
|
|
(ctx.query.filterout_description && !description.match(ctx.query.filterout_description))
|
|
);
|
|
});
|
|
}
|
|
};
|