mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-06 05:03:44 +08:00
Add GitHub branches (#1969)
This commit is contained in:
@@ -89,6 +89,8 @@ GitHub 官方也提供了一些 RSS:
|
|||||||
|
|
||||||
<Route name="仓库 Stars" author="HenryQW" example="/github/stars/DIYgod/RSSHub" path="/github/stars/:user/:repo" :paramsDesc="['用户名', '仓库名']"/>
|
<Route name="仓库 Stars" author="HenryQW" example="/github/stars/DIYgod/RSSHub" path="/github/stars/:user/:repo" :paramsDesc="['用户名', '仓库名']"/>
|
||||||
|
|
||||||
|
<Route name="仓库 Branches" author="max-arnold" example="/github/branches/DIYgod/RSSHub" path="/github/branches/:user/:repo" :paramsDesc="['用户名', '仓库名']"/>
|
||||||
|
|
||||||
<Route name="搜索结果" author="LogicJake" example="/github/search/RSSHub/bestmatch/desc" path="/github/search/:query/:sort?/:order?" :paramsDesc="['搜索关键词', '排序选项(默认为bestmatch)','排序顺序,desc和asc(默认desc降序)']"/>
|
<Route name="搜索结果" author="LogicJake" example="/github/search/RSSHub/bestmatch/desc" path="/github/search/:query/:sort?/:order?" :paramsDesc="['搜索关键词', '排序选项(默认为bestmatch)','排序顺序,desc和asc(默认desc降序)']"/>
|
||||||
|
|
||||||
| 排序选项 | sort |
|
| 排序选项 | sort |
|
||||||
|
|||||||
@@ -340,6 +340,7 @@ router.get('/github/pull/:user/:repo', require('./routes/github/pulls'));
|
|||||||
router.get('/github/user/followers/:user', require('./routes/github/follower'));
|
router.get('/github/user/followers/:user', require('./routes/github/follower'));
|
||||||
router.get('/github/stars/:user/:repo', require('./routes/github/star'));
|
router.get('/github/stars/:user/:repo', require('./routes/github/star'));
|
||||||
router.get('/github/search/:query/:sort?/:order?', require('./routes/github/search'));
|
router.get('/github/search/:query/:sort?/:order?', require('./routes/github/search'));
|
||||||
|
router.get('/github/branches/:user/:repo', require('./routes/github/branches'));
|
||||||
|
|
||||||
// f-droid
|
// f-droid
|
||||||
router.get('/fdroid/apprelease/:app', require('./routes/fdroid/apprelease'));
|
router.get('/fdroid/apprelease/:app', require('./routes/fdroid/apprelease'));
|
||||||
|
|||||||
25
lib/routes/github/branches.js
Normal file
25
lib/routes/github/branches.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
const axios = require('../../utils/axios');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const user = ctx.params.user;
|
||||||
|
const repo = ctx.params.repo;
|
||||||
|
|
||||||
|
const host = `https://github.com/${user}/${repo}`;
|
||||||
|
const url = `https://api.github.com/repos/${user}/${repo}/branches`;
|
||||||
|
|
||||||
|
const response = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url,
|
||||||
|
});
|
||||||
|
const data = response.data;
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${user}/${repo} Branches`,
|
||||||
|
link: `${host}/branches/all`,
|
||||||
|
item: data.map((item) => ({
|
||||||
|
title: item.name,
|
||||||
|
description: item.name,
|
||||||
|
link: `${host}/commits/${item.name}`,
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user