feat(route): add logseq changelog (#6940)

Co-authored-by: NeverBehave <gayhub@never.pet>
This commit is contained in:
Ethan Shen
2021-03-01 23:39:54 -05:00
committed by GitHub
co-authored by NeverBehave
parent 235bf11ad3
commit 73200720aa
4 changed files with 56 additions and 0 deletions
+6
View File
@@ -174,6 +174,12 @@ Language
<RouteEn author="Jeason0228" example="/ipsw/index/ipsws/iPhone11,8" path="/ipsw/index/:ptype/:pname/" :paramsDesc="['Fill in ipsws or otas to get different versions of firmware','Product name, `http://rsshub.app/ipsw/index/ipsws/iPod`, if you fill in the iPad, follow the entire iPad series(ptype default to ipsws).`http://rsshub.app/ipsw/index/ipsws/iPhone11,8`, if you fill in the specific iPhone11,8, submit to the ipsws firmware information of this model']"/>
## Logseq
### Changelog
<RouteEn author="nczitzk" example="/logseq/changelog" path="/logseq/changelog"/>
## MacKed
### APP Update
+6
View File
@@ -218,6 +218,12 @@ pageClass: routes
<Route author="Jeason0228" example="/ipsw/index/ipsws/iPhone11,8" path="/ipsw/index/:ptype/:pname/" :paramsDesc="['填写ipsws或otas,得到不同版本的固件','产品名, `http://rsshub.app/ipsw/index/ipsws/iPod`如填写iPad则关注iPad整个系列(ptype选填为ipsws).`http://rsshub.app/ipsw/index/ipsws/iPhone11,8`如果填写具体的iPhone11,8则关注这个机型的ipsws固件信息']"/>
## Logseq
### Changelog
<Route author="nczitzk" example="/logseq/changelog" path="/logseq/changelog"/>
## MacKed
### 应用更新
+2
View File
@@ -3966,6 +3966,8 @@ router.get('/furaffinity/favorites/:username/:nsfw?', require('./routes/furaffin
router.get('/furaffinity/submission_comments/:id', require('./routes/furaffinity/submission_comments'));
router.get('/furaffinity/journal_comments/:id', require('./routes/furaffinity/journal_comments'));
// Logseq
router.get('/logseq/changelog', require('./routes/logseq/changelog'));
// 亿欧网
router.get('/iyiou', require('./routes/iyiou'));
+42
View File
@@ -0,0 +1,42 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const rootUrl = 'https://logseq.com';
const currentUrl = `${rootUrl}/blog/changelog`;
const response = await got({
method: 'get',
url: currentUrl,
});
const data = response.data.split('<p class="footer">')[0];
const list = [],
versionsIndices = [];
const versions = data.match(
/<div class="block"><div id=""><span class="page-reference"><a class="page-ref" href="[a-z]{3}%20\d+[a-z]{2}%2C%20\d{4}">[a-zA-Z]{3} \d+[a-z]{2}, \d{4}<\/a><\/span><\/div><p><b>Version \d\.\d\.\d\.\d/g
);
for (const version of versions) {
versionsIndices.push(data.indexOf(version));
}
for (let i = 0; i < versionsIndices.length; i++) {
list.push(data.slice(versionsIndices[i], versionsIndices[i + 1]));
}
const items = list.map((item, index) => {
const version = versions[index];
return {
link: currentUrl,
description: item,
title: version.match(/Version \d\.\d\.\d\.\d/)[0],
pubDate: new Date(version.match(/[a-zA-Z]{3} \d+[a-z]{2}, \d{4}/)[0].replace(/st|nd|rd|th/, '')).toUTCString(),
};
});
ctx.state.data = {
title: 'Changelog - Logseq',
link: currentUrl,
item: items,
};
};