Skip to content

Commit 5c3711c

Browse files
HenryQWpull[bot]
andauthored
feat: support .rss3 output type (#15258)
Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
1 parent 4245edc commit 5c3711c

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lib/middleware/template.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { rss3Ums, json, RSS, Atom } from '@/utils/render';
1+
import { rss3, json, RSS, Atom } from '@/utils/render';
22
import { config } from '@/config';
33
import { collapseWhitespace, convertDateToISO8601 } from '@/utils/common-utils';
44
import type { MiddlewareHandler } from 'hono';
@@ -94,8 +94,9 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
9494
return ctx.json(result);
9595
}
9696

97-
if (outputType === 'ums') {
98-
return ctx.json(rss3Ums(result));
97+
// retain .ums for backward compatibility
98+
if (outputType === 'ums' || outputType === 'rss3') {
99+
return ctx.json(rss3(result));
99100
} else if (outputType === 'json') {
100101
ctx.header('Content-Type', 'application/feed+json; charset=UTF-8');
101102
return ctx.body(json(result));

lib/utils/render.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { default as rss3Ums } from '@/views/rss3-ums';
1+
export { default as rss3 } from '@/views/rss3';
22
export { default as json } from '@/views/json';
33
export { default as RSS } from '@/views/rss';
44
export { default as Atom } from '@/views/atom';

lib/views/rss3-ums.ts renamed to lib/views/rss3.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const NETWORK = 'RSS';
1010
const TAG = 'RSS';
1111
const TYPE = 'feed';
1212

13-
const rss3Ums = (data) => {
13+
const rss3 = (data) => {
1414
const currentUnixTsp = dayjs().unix();
1515
const umsResult = {
1616
data: data.item.map((item) => {
@@ -59,4 +59,4 @@ function getOwnershipFieldFromURL(item) {
5959
}
6060
}
6161

62-
export default rss3Ums;
62+
export default rss3;

0 commit comments

Comments
 (0)