feat: add everything changes (#6363)

This commit is contained in:
Ethan Shen
2020-12-06 18:15:58 +00:00
committed by GitHub
parent 368ffdf2c6
commit a458b0669e
4 changed files with 48 additions and 0 deletions
+6
View File
@@ -70,6 +70,12 @@ The owner of the official image fills in the library, for example: https://rsshu
:::
## Everything
### Changes
<RouteEn author="nczitzk" example="/everything/changes" path="/everything/changes"/>
## F-Droid
### App Update
+6
View File
@@ -116,6 +116,12 @@ pageClass: routes
:::
## Everything
### Changes
<Route author="nczitzk" example="/everything/changes" path="/everything/changes"/>
## F-Droid
### App 更新
+3
View File
@@ -3519,6 +3519,9 @@ router.get('/uisdc/news', require('./routes/uisdc/news'));
router.get('/uisdc/zt/:title?', require('./routes/uisdc/zt'));
router.get('/uisdc/topic/:title?/:sort?', require('./routes/uisdc/topic'));
// Everything
router.get('/everything/changes', require('./routes/everything/changes'));
// 中国劳工通讯
router.get('/clb/commentary/:lang?', require('./routes/clb/commentary'));
+33
View File
@@ -0,0 +1,33 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const rootUrl = 'https://www.voidtools.com/Changes.txt';
const response = await got({
method: 'get',
url: rootUrl,
});
const items = response.data
.replace(/\t\n|\t\n\n/g, '\n\n')
.split('\n\n')
.map((item) => {
item = item.indexOf('\n') === 0 ? item.substr(2, item.length - 2) : item;
const title = item.split('\n')[0].split(':');
const description = item.split(title[1])[1].replace(/\t/g, '<li>').replace(/\n/g, '</li>');
return {
description,
link: rootUrl,
title: title[1],
pubDate: new Date(title[0]).toUTCString(),
};
});
ctx.state.data = {
title: 'Everything - Changes',
link: rootUrl,
item: items,
};
};