Skip to content

Commit

Permalink
fix: added temporary blacklist (anuraghazra#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraghazra authored Aug 17, 2020
1 parent c05357d commit 6fa8c26
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
} = require("../src/common/utils");
const fetchStats = require("../src/fetchers/stats-fetcher");
const renderStatsCard = require("../src/cards/stats-card");
const blacklist = require("../src/common/blacklist");

module.exports = async (req, res) => {
const {
Expand All @@ -31,6 +32,10 @@ module.exports = async (req, res) => {

res.setHeader("Content-Type", "image/svg+xml");

if (blacklist.includes(username)) {
return res.send(renderError("Something went wrong"));
}

try {
stats = await fetchStats(
username,
Expand Down
5 changes: 5 additions & 0 deletions api/pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
} = require("../src/common/utils");
const fetchRepo = require("../src/fetchers/repo-fetcher");
const renderRepoCard = require("../src/cards/repo-card");
const blacklist = require("../src/common/blacklist");

module.exports = async (req, res) => {
const {
Expand All @@ -25,6 +26,10 @@ module.exports = async (req, res) => {

res.setHeader("Content-Type", "image/svg+xml");

if (blacklist.includes(username)) {
return res.send(renderError("Something went wrong"));
}

try {
repoData = await fetchRepo(username, repo);

Expand Down
5 changes: 5 additions & 0 deletions api/top-langs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
} = require("../src/common/utils");
const fetchTopLanguages = require("../src/fetchers/top-languages-fetcher");
const renderTopLanguages = require("../src/cards/top-languages-card");
const blacklist = require("../src/common/blacklist");

module.exports = async (req, res) => {
const {
Expand All @@ -27,6 +28,10 @@ module.exports = async (req, res) => {

res.setHeader("Content-Type", "image/svg+xml");

if (blacklist.includes(username)) {
return res.send(renderError("Something went wrong"));
}

try {
topLangs = await fetchTopLanguages(username);

Expand Down
3 changes: 3 additions & 0 deletions src/common/blacklist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const blacklist = ["renovate-bot", "technote-space", "sw-yx"];

module.exports = blacklist;

0 comments on commit 6fa8c26

Please sign in to comment.