mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-06 05:03:44 +08:00
feat: better Reeder support (#6510)
This commit is contained in:
@@ -1,16 +1,20 @@
|
|||||||
const art = require('art-template');
|
const art = require('art-template');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const config = require('@/config').value;
|
const config = require('@/config').value;
|
||||||
const typeRegrx = /\.(atom|rss)$/;
|
const typeRegex = /\.(atom|rss)$/;
|
||||||
const unsupportedRegrx = /\.json$/;
|
const unsupportedRegex = /\.json$/;
|
||||||
|
|
||||||
module.exports = async (ctx, next) => {
|
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>');
|
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) || ['', ''];
|
if (ctx.headers['user-agent'].includes('Reeder')) {
|
||||||
ctx.request.path = ctx.request.path.replace(typeRegrx, '');
|
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();
|
await next();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user