diff --git a/index.js b/index.js index 0e11e8f..573aa9b 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,7 @@ const db = require.main.require('./src/database'); const pubsub = require.main.require('./src/pubsub'); const routeHelpers = require.main.require('./src/routes/helpers'); +const utils = require.main.require('./src/utils'); const database = require('./lib/database'); const controllers = require('./lib/controllers'); @@ -95,4 +96,3 @@ RssPlugin.widgets.defineWidgets = widget.defineWidgets; * Called on `filter:widget.render:rss` */ RssPlugin.widgets.renderRssWidget = widget.render; - diff --git a/lib/feed.js b/lib/feed.js index cc6082f..1670d5d 100644 --- a/lib/feed.js +++ b/lib/feed.js @@ -21,6 +21,7 @@ Feed.getItems = async function (feedUrl, entriesToPull = Feed.DEFAULT_ENTRIES_TO published: item.pubDate, link: { href: item.link }, id: item.guid || item.id, + content: item.contentSnippet, tags: item.categories, })); }; diff --git a/lib/pull.js b/lib/pull.js index 3ddb582..1ce3cc6 100644 --- a/lib/pull.js +++ b/lib/pull.js @@ -75,10 +75,11 @@ async function postEntry(feed, entry) { winston.info(`[plugin-rss] posting, ${feed.url} - title: ${entry.title}, published date: ${getEntryDate(entry)}`); + const url = entry.link && entry.link.href; const result = await topics.post({ uid: posterUid, title: entry.title, - content: entry.link && entry.link.href, + content: `${entry.content}\n\n----\n\n${url}`, cid: feed.category, tags: tags, }); @@ -92,7 +93,7 @@ async function postEntry(feed, entry) { const max = Math.max(parseInt(meta.config.postDelay, 10) || 10, parseInt(meta.config.newbiePostDelay, 10) || 10) + 1; await user.setUserField(posterUid, 'lastposttime', Date.now() - (max * 1000)); - const uuid = entry.id || (entry.link && entry.link.href) || entry.title; + const uuid = entry.id || (url) || entry.title; await db.sortedSetAdd(`nodebb-plugin-rss:feed:${feed.url}:uuid`, topicData.tid, uuid); }