fix(core): update

This commit is contained in:
Philipp Kunz 2020-11-11 10:11:18 +00:00
parent b0719c481e
commit 599af94709
2 changed files with 8 additions and 4 deletions

View File

@ -23,7 +23,8 @@ tap.test('should create a feed', async () => {
authorName: 'Phil', authorName: 'Phil',
imageUrl: 'https://central.eu/someimage.png', imageUrl: 'https://central.eu/someimage.png',
timestamp: Date.now(), timestamp: Date.now(),
url: 'https://central.eu/article/somearticle' url: 'https://central.eu/article/somearticle',
content: 'somecontent'
}); });
const rssFeed = feed.exportRssFeedString(); const rssFeed = feed.exportRssFeedString();
console.log(rssFeed); console.log(rssFeed);

View File

@ -16,6 +16,7 @@ export interface IFeedItem {
url: string; url: string;
authorName: string; authorName: string;
imageUrl: string; imageUrl: string;
content: string;
} }
export class Feed { export class Feed {
@ -32,7 +33,8 @@ export class Feed {
private getFeedObject() { private getFeedObject() {
const feed = new plugins.feed.Feed({ const feed = new plugins.feed.Feed({
copyright: `All rights reserved, ${this.options.company}`, copyright: `All rights reserved, ${this.options.company}`,
id: this.options.domain, id: `https://${this.options.domain}`,
link: `https://${this.options.domain}`,
title: this.options.title, title: this.options.title,
author: { author: {
name: this.options.company, name: this.options.company,
@ -49,8 +51,9 @@ export class Feed {
feed.addItem({ feed.addItem({
title: itemArg.title, title: itemArg.title,
date: new Date(itemArg.timestamp), date: new Date(itemArg.timestamp),
link: itemArg.url, link: itemArg.url.replace(/&/gm, '&'),
image: itemArg.imageUrl, image: itemArg.imageUrl.replace(/&/gm, '&'),
content: itemArg.content,
author: [{ author: [{
name: itemArg.authorName name: itemArg.authorName
}] }]