mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 13:39:35 +08:00
feat: github Basic Authentication
This commit is contained in:
@@ -5,13 +5,17 @@ const queryString = require('query-string');
|
||||
module.exports = async (ctx) => {
|
||||
const user = ctx.params.user;
|
||||
|
||||
const headers = {};
|
||||
if (config.github && config.github.access_token) {
|
||||
headers.Authorization = `token ${config.github.access_token}`;
|
||||
}
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.github.com/users/${user}/repos`,
|
||||
searchParams: queryString.stringify({
|
||||
sort: 'created',
|
||||
access_token: config.github && config.github.access_token,
|
||||
}),
|
||||
headers,
|
||||
});
|
||||
const data = response.data;
|
||||
ctx.state.data = {
|
||||
|
||||
Reference in New Issue
Block a user