Skip to content

Commit

Permalink
Github contributors add sort order
Browse files Browse the repository at this point in the history
  • Loading branch information
zoenglinghou committed Mar 21, 2020
1 parent 17de3a1 commit c4a13af
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 33 deletions.
58 changes: 28 additions & 30 deletions docs/en/programming.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,35 @@ GitHub provides some official RSS feeds:

### User Repo

<RouteEn author="dragon-yuan" path="/github/repos/:user" example="/github/repos/DIYgod" :paramsDesc="['GitHub username']" radar="1" />
<Route author="dragon-yuan" path="/github/repos/:user" example="/github/repos/DIYgod" :paramsDesc="['GitHub username']" radar="1" />

### Trending

<RouteEn path="/github/trending/:since/:language?" example="/github/trending/daily/javascript" :paramsDesc="['time frame, available in [Trending page](https://github.com/trending/javascript?since=monthly) \'s URL, possible values are: daily, weekly or monthly', 'the feed language, available in [Trending page](https://github.com/trending/javascript?since=monthly) \'s URL']" radar="1" />
<Route path="/github/trending/:since/:language?" example="/github/trending/daily/javascript" :paramsDesc="['time frame, available in [Trending page](https://github.com/trending/javascript?since=monthly) \'s URL, possible values are: daily, weekly or monthly', 'the feed language, available in [Trending page](https://github.com/trending/javascript?since=monthly) \'s URL']" radar="1" />

### Repo Issues

<RouteEn author="HenryQW AndreyMZ" path="/github/issue/:user/:repo/:state?/:labels?" example="/github/issue/DIYgod/RSSHub/all/bug" :paramsDesc="['GitHub username', 'GitHub repo name', 'the state of the issues. Can be either `open`, `closed`, or `all`. Default: `open`.', 'a list of comma separated label names']" radar="1" />
<Route author="HenryQW AndreyMZ" path="/github/issue/:user/:repo/:state?/:labels?" example="/github/issue/DIYgod/RSSHub/all/bug" :paramsDesc="['GitHub username', 'GitHub repo name', 'the state of the issues. Can be either `open`, `closed`, or `all`. Default: `open`.', 'a list of comma separated label names']" radar="1" />

### Repo Pull Requests

<RouteEn author="hashman" example="/github/pull/DIYgod/RSSHub" path="/github/pull/:user/:repo" :paramsDesc="['User name', 'Repo name']" radar="1"/>
<Route author="hashman" example="/github/pull/DIYgod/RSSHub" path="/github/pull/:user/:repo" :paramsDesc="['User name', 'Repo name']" radar="1"/>

### User Followers

<RouteEn author="HenryQW" path="/github/user/follower/:user" example="/github/user/followers/HenryQW" :paramsDesc="['GitHub username']" radar="1" />
<Route author="HenryQW" path="/github/user/follower/:user" example="/github/user/followers/HenryQW" :paramsDesc="['GitHub username']" radar="1" />

### Repo Stars

<RouteEn author="HenryQW" path="/github/stars/:user/:repo" example="/github/stars/DIYGod/RSSHub" :paramsDesc="['GitHub username', 'GitHub repo name']" radar="1" />
<Route author="HenryQW" path="/github/stars/:user/:repo" example="/github/stars/DIYGod/RSSHub" :paramsDesc="['GitHub username', 'GitHub repo name']" radar="1" />

### Repo Branches

<RouteEn author="max-arnold" example="/github/branches/DIYgod/RSSHub" path="/github/branches/:user/:repo" :paramsDesc="['User name', 'Repo name']" radar="1"/>
<Route author="max-arnold" example="/github/branches/DIYgod/RSSHub" path="/github/branches/:user/:repo" :paramsDesc="['User name', 'Repo name']" radar="1"/>

### Files Commits

<RouteEn author="zengxs" example="/github/file/DIYgod/RSSHub/master/lib/router.js" path="/github/file/:user/:repo/:branch/:filepath+" :paramsDesc="['User name', 'Repo name', 'Branch name', 'File path']" radar="1">
<Route author="zengxs" example="/github/file/DIYgod/RSSHub/master/lib/router.js" path="/github/file/:user/:repo/:branch/:filepath+" :paramsDesc="['User name', 'Repo name', 'Branch name', 'File path']" radar="1">

| User name | Repo name | Branch name | File path |
| --------- | --------- | ----------- | --------------- |
Expand All @@ -60,11 +60,11 @@ GitHub provides some official RSS feeds:
> >
> > Such as: replace `https://rsshub.app/github/file/DIYgod/RSSHub/master/lib/router%2ejs` to `https://rsshub.app/github/file/DIYgod/RSSHub/master/lib/router%2ejs.rss`
</RouteEn>
</Route>

### Search Result

<RouteEn author="LogicJake" example="/github/search/RSSHub/bestmatch/desc" path="/github/search/:query/:sort?/:order?" :paramsDesc="['search keyword', 'Sort options (default to bestmatch)','Sort order, desc and asc (desc descending by default)']"/>
<Route author="LogicJake" example="/github/search/RSSHub/bestmatch/desc" path="/github/search/:query/:sort?/:order?" :paramsDesc="['search keyword', 'Sort options (default to bestmatch)','Sort order, desc and asc (desc descending by default)']"/>

| Sort options | sort |
| ---------------- | --------- |
Expand All @@ -75,29 +75,29 @@ GitHub provides some official RSS feeds:

### User Starred Repositories

<RouteEn author="LanceZhu" example="/github/starred_repos/DIYgod" path="/github/starred_repos/:user" :paramsDesc="['User name']" radar="1"/>
<Route author="LanceZhu" example="/github/starred_repos/DIYgod" path="/github/starred_repos/:user" :paramsDesc="['User name']" radar="1"/>

### Repo Contributors

<RouteEn author="zoenglinghou" example="/github/contributors/DIYgod/RSSHub" path="/github/contributors/:user/:repo/:anon?" :paramsDesc="['User name', 'Repo name', 'If anonymous users are included. Leave blank for no, use any values for yes.']" radar="1"/>
<Route author="zoenglinghou" example="/github/contributors/DIYgod/RSSHub" path="/github/contributors/:user/:repo/:order?/:anon?" :paramsDesc="['User name','Repo name','Sort order by commit numbers, desc and asc (descending by default)','Show anonymous users. Defaults to no, use any values for yes.']" radar="1"/>

## GitLab

### Explore

<RouteEn author="imlonghao" example="/gitlab/explore/trending" path="/gitlab/explore/:type" :paramsDesc="['type']">
<Route author="imlonghao" example="/gitlab/explore/trending" path="/gitlab/explore/:type" :paramsDesc="['type']">

| Trending | Most stars | All |
| -------- | ---------- | --- |
| trending | starred | all |

</RouteEn>
</Route>

## Hacker News

### Section

<RouteEn author="cf020031308" example="/hackernews/best/comments" path="/hackernews/:section/:type?" :paramsDesc="['Section', 'Link type']">
<Route author="cf020031308" example="/hackernews/best/comments" path="/hackernews/:section/:type?" :paramsDesc="['Section', 'Link type']">

Website: https://news.ycombinator.com/

Expand All @@ -118,7 +118,7 @@ Website: https://news.ycombinator.com/
| story | Deault, link to shared address |
| comments | Link to Hacker News address |

</RouteEn>
</Route>

## Hex-Rays

Expand All @@ -131,45 +131,45 @@ Website: https://news.ycombinator.com/

### Discussion

<RouteEn author="LogicJake" example="/kaggle/discussion/387811/active" path="/kaggle/discussion/:forumId/:sort?" :paramsDesc="['Forum ID, open web request, search forumId; fill in all to subscribe to the whole site discussion forum', 'See the table below for sorting methods, default to hot']">
<Route author="LogicJake" example="/kaggle/discussion/387811/active" path="/kaggle/discussion/:forumId/:sort?" :paramsDesc="['Forum ID, open web request, search forumId; fill in all to subscribe to the whole site discussion forum', 'See the table below for sorting methods, default to hot']">

| hot | recent | new | top | active |
| ------- | --------------- | --------------- | ---------- | ------------- |
| Hotness | Recent Comments | Recently Posted | Most Votes | Most Comments |

</RouteEn>
</Route>

### Competitions

<RouteEn author="LogicJake" example="/kaggle/competitions" path="/kaggle/competitions/:category?" :paramsDesc="['category, default to all']">
<Route author="LogicJake" example="/kaggle/competitions" path="/kaggle/competitions/:category?" :paramsDesc="['category, default to all']">

|| featured | research | recruitment | gettingStarted | masters | playground | analytics |
| -------------- | -------- | -------- | ----------- | --------------- | ------- | ---------- | --------- |
| All Categories | Featured | Research | Recruitment | Getting started | Masters | Playground | Analytics |

</RouteEn>
</Route>

## LeetCode

### Articles

<RouteEn author="LogicJake" example="/leetcode/articles" path="/leetcode/articles"/>
<Route author="LogicJake" example="/leetcode/articles" path="/leetcode/articles"/>

### Submission

<RouteEn author="NathanDai" example="/leetcode/submission/us/nathandai" path="/leetcode/submission/:country/:user" :paramsDesc="['country, Chines(cn) and US(us)', 'Username, available at the URL of the LeetCode user homepage']"/>
<Route author="NathanDai" example="/leetcode/submission/us/nathandai" path="/leetcode/submission/:country/:user" :paramsDesc="['country, Chines(cn) and US(us)', 'Username, available at the URL of the LeetCode user homepage']"/>

## Linux Patchwork

### Patch Comments

<RouteEn author="ysc3839" example="/patchwork.kernel.org/comments/10723629" path="/patchwork.kernel.org/comments/:id" :paramsDesc="['Patch ID']"/>
<Route author="ysc3839" example="/patchwork.kernel.org/comments/10723629" path="/patchwork.kernel.org/comments/:id" :paramsDesc="['Patch ID']"/>

## LWN.net

### Security alerts

<RouteEn author="zengxs" example="/lwn/alerts/CentOS" path="/lwn/alerts/:distributor" :paramsDesc="['Distribution identification']">
<Route author="zengxs" example="/lwn/alerts/CentOS" path="/lwn/alerts/:distributor" :paramsDesc="['Distribution identification']">

| Distribution | Identification |
| :--------------- | :----------------- |
Expand All @@ -187,7 +187,7 @@ Website: https://news.ycombinator.com/
| SUSE | `SUSE` |
| Ubuntu | `Ubuntu` |

</RouteEn>
</Route>

## project-zero issues

Expand All @@ -199,18 +199,16 @@ Website: https://news.ycombinator.com/

### Scala Blog

<RouteEn author="fengkx" example="/scala/blog/posts" path="/scala/blog/:part?" :paramsDesc="['part']" >
part parmater can be found in the url of blog
</RouteEn>
<Route author="fengkx" example="/scala/blog/posts" path="/scala/blog/:part?" :paramsDesc="['part parmater can be found in the url of blog, defaults to All']"/>

## Visual Studio Code Marketplace

### Visual Studio Code Plugins Marketplace

<RouteEn author="SeanChao" example="/vscode/marketplace" path="/vscode/marketplace/:category?" :paramsDesc="['Category']">
<Route author="SeanChao" example="/vscode/marketplace" path="/vscode/marketplace/:category?" :paramsDesc="['Category']">

| Featured | Trending Weekly | Trending Monthly | Trending Daily | Most Popular | Recently Added |
| -------- | --------------- | ---------------- | -------------- | ------------ | -------------- |
| featured | trending | trending_m | trending_d | popular | new |

</RouteEn>
</Route>
2 changes: 1 addition & 1 deletion docs/programming.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ GitHub 官方也提供了一些 RSS:

### 仓库 Contirbutors

<Route author="zoenglinghou" example="/github/contributors/DIYgod/RSSHub" path="/github/contributors/:user/:repo/:anon?" :paramsDesc="['用户名', '仓库名', '是否包括匿名用户。留空默认不包含,任意值包含匿名用户']" radar="1"/>
<Route author="zoenglinghou" example="/github/contributors/DIYgod/RSSHub" path="/github/contributors/:user/:repo/:order?/:anon?" :paramsDesc="['用户名', '仓库名', 'Commit 数量排序顺序,desc和asc(默认desc降序)', '是否包括匿名用户,默认不包含,任意值包含匿名用户']" radar="1"/>

## GitLab

Expand Down
2 changes: 1 addition & 1 deletion lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ router.get('/github/search/:query/:sort?/:order?', require('./routes/github/sear
router.get('/github/branches/:user/:repo', require('./routes/github/branches'));
router.get('/github/file/:user/:repo/:branch/:filepath+', require('./routes/github/file'));
router.get('/github/starred_repos/:user', require('./routes/github/starred_repos'));
router.get('/github/contributors/:user/:repo/:anon?', require('./routes/github/contributors'));
router.get('/github/contributors/:user/:repo/:order?/:anon?', require('./routes/github/contributors'));

// f-droid
router.get('/fdroid/apprelease/:app', require('./routes/fdroid/apprelease'));
Expand Down
3 changes: 2 additions & 1 deletion lib/routes/github/contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const config = require('@/config').value;
module.exports = async (ctx) => {
const user = ctx.params.user;
const repo = ctx.params.repo;
const order = ctx.params.order;
const anon = ctx.params.anon;

const host = `https://github.com/${user}/${repo}`;
Expand Down Expand Up @@ -53,7 +54,7 @@ module.exports = async (ctx) => {

data.forEach(function(item) {
const time = new Date();
time.setMinutes(time.getMinutes() - data.length + index);
time.setMinutes(time.getMinutes() + (order === 'asc' ? -data.length + index : -index));
index++;

if (item.type === 'Anonymous') {
Expand Down

0 comments on commit c4a13af

Please sign in to comment.