diff --git a/src/legacy/views/header.ejs b/src/legacy/views/header.ejs
index b89133a..3f245ef 100644
--- a/src/legacy/views/header.ejs
+++ b/src/legacy/views/header.ejs
@@ -34,6 +34,7 @@
}
-->
+
diff --git a/src/routes/rss.xml.js b/src/routes/rss.xml.js
deleted file mode 100644
index 3cde28b..0000000
--- a/src/routes/rss.xml.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import RSS from 'rss';
-import Article from '../models/article.js';
-
-export async function get(req, res)
-{
- let feed = new RSS();
- let articles = await Article.find().populate({
- path: 'author',
- select: 'realname avatar'
- }).populate({
- path: 'category'
- });
-
- for (let article of articles) {
- feed.item({
- title: article.title,
- description: article.html,
- url: `http://howfeed.biz/a/${article.slug}`,
- categories: [ article.category.name ],
- author: article.author.realname,
- date: article.created_at,
- enclosure: {
- url: `http://howfeed.biz/a/${article.image}`
- }
- });
- }
-
- res.writeHead(200, {
- 'Content-Type': 'application/rss+xml'
- });
- res.end(feed.xml());
-}
diff --git a/src/server.js b/src/server.js
index 85c92fa..997862e 100644
--- a/src/server.js
+++ b/src/server.js
@@ -13,6 +13,7 @@ import fs from 'fs';
import cors from 'cors';
import helmet from 'helmet';
import useragent from 'useragent';
+import RSS from 'rss';
import path from 'path';
import crypto from 'crypto';
import Article from './models/article.js';
@@ -391,7 +392,44 @@ mainRouter
}));
}
}
- );
+ )
+ .get('/rss.xml', async function (req, res) {
+ let year = new Date().getFullYear();
+ let feed = new RSS({
+ title: 'HowFeed.biz Articles',
+ feed_url: 'http://howfeed.biz/rss.xml',
+ site_url: 'http://howfeed.biz/',
+ image_url: 'http://howfeed.biz/logo.png',
+ language: 'en',
+ webMaster: 'webmaster@howfeed.biz',
+ copyright: `${year} FemboyFinancial Holdings Co., Ltd. (USA LLC)`
+ });
+ let articles = await Article.find().populate({
+ path: 'author',
+ select: 'realname avatar'
+ }).populate({
+ path: 'category'
+ });
+
+ for (let article of articles) {
+ feed.item({
+ title: article.title,
+ description: article.html,
+ url: `http://howfeed.biz/a/${article.slug}`,
+ categories: [ article.category.name ],
+ author: article.author.realname,
+ date: article.created_at,
+ enclosure: {
+ url: `http://howfeed.biz/a/${article.image}`
+ }
+ });
+ }
+
+ res.writeHead(200, {
+ 'Content-Type': 'application/rss+xml'
+ });
+ res.end(feed.xml());
+ });
app.use(helmet())
.use(cors())