diff --git a/api/index.js b/api/index.js index c983b436..9ec08f65 100644 --- a/api/index.js +++ b/api/index.js @@ -33,6 +33,7 @@ module.exports = async (req, res) => { disable_animations, border_radius, border_color, + role, } = req.query; res.setHeader("Content-Type", "image/svg+xml"); @@ -49,6 +50,7 @@ module.exports = async (req, res) => { username, parseBoolean(count_private), parseBoolean(include_all_commits), + parseArray(role), ); const cacheSeconds = clampValue( diff --git a/src/fetchers/stats-fetcher.js b/src/fetchers/stats-fetcher.js index 1a03b466..73dc9690 100644 --- a/src/fetchers/stats-fetcher.js +++ b/src/fetchers/stats-fetcher.js @@ -11,7 +11,7 @@ const fetcher = (variables, token) => { return request( { query: ` - query userInfo($login: String!) { + query userInfo($login: String!, $ownerAffiliations: [RepositoryAffiliation]) { user(login: $login) { name login @@ -34,7 +34,7 @@ const fetcher = (variables, token) => { followers { totalCount } - repositories(first: 100, ownerAffiliations: OWNER, orderBy: {direction: DESC, field: STARGAZERS}) { + repositories(first: 100, ownerAffiliations: $ownerAffiliations, orderBy: {direction: DESC, field: STARGAZERS}) { totalCount nodes { stargazers { @@ -91,6 +91,7 @@ async function fetchStats( username, count_private = false, include_all_commits = false, + ownerAffiliations, ) { if (!username) throw Error("Invalid username"); @@ -104,7 +105,7 @@ async function fetchStats( rank: { level: "C", score: 0 }, }; - let res = await retryer(fetcher, { login: username }); + let res = await retryer(fetcher, { login: username, ownerAffiliations}); if (res.data.errors) { logger.error(res.data.errors);