From fff2032a81bf247c966aa73473e8ca74d3fda03e Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 19 Nov 2018 11:28:10 +0800 Subject: [PATCH] throw error for json output parameter --- middleware/template.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/middleware/template.js b/middleware/template.js index 02b4f1b21..45acacbe8 100644 --- a/middleware/template.js +++ b/middleware/template.js @@ -3,8 +3,13 @@ const path = require('path'); const config = require('../config'); const he = require('he'); const typeRegrx = /\.(atom|rss)$/; +const unsupportedRegrx = /\.json$/; module.exports = async (ctx, next) => { + if (ctx.request.path.match(unsupportedRegrx)) { + throw Error('JSON output had been removed, see: https://github.com/DIYgod/RSSHub/issues/1114'); + } + ctx.state.type = ctx.request.path.match(typeRegrx) || ['', '']; ctx.request.path = ctx.request.path.replace(typeRegrx, '');