mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 12:21:31 +08:00
feat: better Reeder support (#6510)
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const config = require('@/config').value;
|
||||
const typeRegrx = /\.(atom|rss)$/;
|
||||
const unsupportedRegrx = /\.json$/;
|
||||
const typeRegex = /\.(atom|rss)$/;
|
||||
const unsupportedRegex = /\.json$/;
|
||||
|
||||
module.exports = async (ctx, next) => {
|
||||
if (ctx.request.path.match(unsupportedRegrx)) {
|
||||
if (ctx.request.path.match(unsupportedRegex)) {
|
||||
throw Error('<b>JSON output had been removed, see: <a href="https://github.com/DIYgod/RSSHub/issues/1114">https://github.com/DIYgod/RSSHub/issues/1114</a></b>');
|
||||
}
|
||||
|
||||
ctx.state.type = ctx.request.path.match(typeRegrx) || ['', ''];
|
||||
ctx.request.path = ctx.request.path.replace(typeRegrx, '');
|
||||
if (ctx.headers['user-agent'].includes('Reeder')) {
|
||||
ctx.request.path = ctx.request.path.replace(/.com$/, '');
|
||||
}
|
||||
|
||||
ctx.state.type = ctx.request.path.match(typeRegex) || ['', ''];
|
||||
ctx.request.path = ctx.request.path.replace(typeRegex, '');
|
||||
|
||||
await next();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user