diff --git a/api/index.js b/api/index.js index 68c34e0..87da679 100644 --- a/api/index.js +++ b/api/index.js @@ -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 { @@ -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, diff --git a/api/pin.js b/api/pin.js index 3fc5058..c09b2d6 100644 --- a/api/pin.js +++ b/api/pin.js @@ -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 { @@ -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); diff --git a/api/top-langs.js b/api/top-langs.js index 8950158..9810c52 100644 --- a/api/top-langs.js +++ b/api/top-langs.js @@ -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 { @@ -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); diff --git a/src/common/blacklist.js b/src/common/blacklist.js new file mode 100644 index 0000000..3ef635c --- /dev/null +++ b/src/common/blacklist.js @@ -0,0 +1,3 @@ +const blacklist = ["renovate-bot", "technote-space", "sw-yx"]; + +module.exports = blacklist;