|
|
|
@ -5,10 +5,13 @@
|
|
|
|
|
topics = require('./topics.js'),
|
|
|
|
|
fs = require('fs'),
|
|
|
|
|
rss = require('node-rss'),
|
|
|
|
|
winston = require('winston');
|
|
|
|
|
winston = require('winston'),
|
|
|
|
|
path = require('path');
|
|
|
|
|
|
|
|
|
|
function saveFeed(location, feed) {
|
|
|
|
|
fs.writeFile(location, rss.getFeedXML(feed), function (err) {
|
|
|
|
|
var savePath = path.join(__dirname, '../', location);
|
|
|
|
|
|
|
|
|
|
fs.writeFile(savePath, rss.getFeedXML(feed), function (err) {
|
|
|
|
|
if(err) {
|
|
|
|
|
winston.err(err);
|
|
|
|
|
}
|
|
|
|
@ -30,9 +33,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Feed.updateTopic = function(tid, cid) {
|
|
|
|
|
winston.info('[RSS] Updating RSS feeds for topic ' + tid);
|
|
|
|
|
var cache_time_in_seconds = 60;
|
|
|
|
|
|
|
|
|
|
topics.getTopicWithPosts(tid, 0, function(err, topicData) {
|
|
|
|
|
topics.getTopicWithPosts(tid, 0, 0, -1, function(err, topicData) {
|
|
|
|
|
if (err) winston.error('Problem saving topic RSS feed', err.stack);
|
|
|
|
|
|
|
|
|
|
var location = '/topic/' + topicData.slug,
|
|
|
|
|