diff --git a/lib/middleware/template.ts b/lib/middleware/template.ts index 23c4119a15..39019cf447 100644 --- a/lib/middleware/template.ts +++ b/lib/middleware/template.ts @@ -1,4 +1,4 @@ -import render from '@/utils/render'; +import { rss3Ums, json, art } from '@/utils/render'; import * as path from 'node:path'; import { config } from '@/config'; import utils from '@/utils/common-utils'; @@ -88,12 +88,12 @@ const middleware: MiddlewareHandler = async (ctx, next) => { if (outputType === 'ums') { ctx.header('Content-Type', 'application/json; charset=UTF-8'); - return ctx.body(render.rss3Ums(result)); + return ctx.body(rss3Ums(result)); } else if (outputType === 'json') { ctx.header('Content-Type', 'application/feed+json; charset=UTF-8'); - return ctx.body(render.json(result)); + return ctx.body(json(result)); } else { - return ctx.body(render.art(template, result)); + return ctx.body(art(template, result)); } }; diff --git a/lib/utils/render.ts b/lib/utils/render.ts index e30abf2781..397781a9e2 100644 --- a/lib/utils/render.ts +++ b/lib/utils/render.ts @@ -1,11 +1,3 @@ -import art from 'art-template'; -import json from '@/views/json'; -import rss3Ums from '@/views/rss3-ums'; - -// We may add more control over it later - -export default { - art, - json, // This should be used by RSSHub middleware only. - rss3Ums, -}; +export { default as rss3Ums } from '@/views/rss3-ums'; +export { default as json } from '@/views/json'; +export { default as art } from 'art-template';