Skip to content

Commit

Permalink
feat: add author for all feeds close #75
Browse files Browse the repository at this point in the history
  • Loading branch information
cooderl committed Mar 14, 2024
1 parent f5e826c commit 784f2c5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/server/src/feeds/feeds.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,23 +156,31 @@ export class FeedsService {
copyright: '',
updated: new Date(feedInfo.updateTime * 1e3),
generator: 'WeWe-RSS',
author: { name: feedInfo.mpName },
});

feed.addExtension({
name: 'generator',
objects: `WeWe-RSS`,
});

const feeds = await this.prismaService.feed.findMany({
select: { id: true, mpName: true },
});

/**mode 高于 globalMode。如果 mode 值存在,取 mode 值*/
const enableFullText =
typeof mode === 'string'
? mode === 'fulltext'
: globalMode === 'fulltext';

const showAuthor = feedInfo.id === 'all';

const mapper = async (item) => {
const { title, id, publishTime, picUrl } = item;
const { title, id, publishTime, picUrl, mpId } = item;
const link = `https://mp.weixin.qq.com/s/${id}`;

const mpName = feeds.find((item) => item.id === mpId)?.mpName || '-';
const published = new Date(publishTime * 1e3);

let description = '';
Expand All @@ -188,6 +196,7 @@ export class FeedsService {
description,
date: published,
image: picUrl,
author: showAuthor ? [{ name: mpName }] : undefined,
});
};

Expand Down

0 comments on commit 784f2c5

Please sign in to comment.