Custom ownerAffiliations for general stats

This commit is contained in:
devStorm
2021-12-04 15:19:17 -05:00
parent b7849627a6
commit f19d94f270
2 changed files with 6 additions and 3 deletions
+2
View File
@@ -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(
+4 -3
View File
@@ -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);