Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Based on the top-langs API, implemented the function to statistics the distribution of the language in many code repo just by the paramas: &langtuage=Java #3576

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
594 changes: 594 additions & 0 deletions NOTICE.md

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion api/top-langs.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ export default async (req, res) => {
border_color,
disable_animations,
hide_progress,
language,
isFork
} = req.query;
res.setHeader("Content-Type", "image/svg+xml");

console.log("访问Top-Langs 成功");
if (blacklist.includes(username)) {
return res.send(
renderError("Something went wrong", "This username is blacklisted", {
Expand Down Expand Up @@ -65,9 +67,11 @@ export default async (req, res) => {
try {
const topLangs = await fetchTopLanguages(
username,
language,
parseArray(exclude_repo),
size_weight,
count_weight,
parseBoolean(isFork)
);

let cacheSeconds = clampValue(
Expand Down Expand Up @@ -113,6 +117,7 @@ export default async (req, res) => {
CONSTANTS.ERROR_CACHE_SECONDS
}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
); // Use lower cache period for errors.
console.log("Something went wrong:", err);
return res.send(
renderError(err.message, err.secondaryMessage, {
title_color,
Expand Down
239 changes: 239 additions & 0 deletions assets/aggregation_by_a_language.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.