feat: render export

This commit is contained in:
DIYgod
2024-02-28 14:58:50 +08:00
parent 5fb506f7a4
commit 85ad31e260
2 changed files with 7 additions and 15 deletions
+4 -4
View File
@@ -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));
}
};
+3 -11
View File
@@ -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';