feat(router): 增加 xiaote.com 论坛路由 (#13062)

* feat: 增加 xiaote.com 论坛路由

* feat: add radar.js

* feat: format code

* bugfix: radar error

* fix: all marge issuse
This commit is contained in:
simon
2023-08-18 19:09:59 +08:00
committed by GitHub
parent f3afc1954d
commit d73cf524a2
5 changed files with 74 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
const got = require('@/utils/got'); // 自订的 got
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const { data } = await got.post('https://lcen.xiaote.net//api/graphql/', {
json: {
query: `query($startCursor: Int) {
communities(startCursor: $startCursor) {
edges {
node {
objectId
content
createdAt
imageUrls
user{
nickname
}
}
}
}
}`,
},
});
ctx.state.data = {
title: '小特社区',
// 源链接
link: 'https://xiaote.com/',
// 遍历所有此前获取的数据
item: data.data.communities.edges.map((node) => {
const item = node.node;
let description = item.content;
if (item.imageUrls) {
item.imageUrls.forEach((url) => {
description += `<img src="${url}">`;
});
}
return {
title: item.content,
link: `https://www.xiaote.com/r/${item.objectId}`,
description,
pubDate: parseDate(item.createdAt * 1000),
author: item.user.nickname,
};
}),
};
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/news': ['wxsimon'],
};
+13
View File
@@ -0,0 +1,13 @@
module.exports = {
'xiaote.com': {
_name: '小特社区',
'.': [
{
title: '首页帖子',
docs: 'https://docs.rsshub.app/bbs#xiao-te-she-qu',
source: ['/'],
target: '/xiaote/news',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/news', require('./index'));
};
+7
View File
@@ -1087,6 +1087,12 @@ import Route from '@site/src/components/Route';
</Route>
## 小特社区 {#xiao-te-she-qu}
### 首页帖子 {#xiao-te-she-qu-shou-ye-tie-zi}
<Route author="wxsimon" example="/xiaote/news" path="/xiaote/news"></Route>
## 一亩三分地 {#yi-mu-san-fen-di}
### 帖子 {#yi-mu-san-fen-di-tie-zi}
@@ -1238,3 +1244,4 @@ import Route from '@site/src/components/Route';
| lingyishijain | lingyitupian | minjianqitan |
</Route>