Skip to content

Commit d1808ca

Browse files
authored
fix: temporarily disable badge counter (#196)
1 parent b69d47d commit d1808ca

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/api/utils/badge.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Badge utilities for GitMCP documentation tracking
33
*/
44

5+
const badgeCountAllowedRepos = ["mcp-ui", "git-mcp"];
6+
57
/**
68
* Gets a Durable Object stub for the view counter
79
* @param env Cloudflare environment
@@ -163,7 +165,12 @@ export function withViewTracking<T, R>(
163165
): (args: T) => Promise<R> {
164166
return async (args: T) => {
165167
// Only track if we have both owner and repo and counter binding available
166-
if (repoData.owner && repoData.repo && env?.VIEW_COUNTER) {
168+
if (
169+
repoData.owner &&
170+
repoData.repo &&
171+
badgeCountAllowedRepos.includes(repoData.repo) &&
172+
env?.VIEW_COUNTER
173+
) {
167174
// Handle the view count tracking
168175
try {
169176
const incrementPromise = incrementRepoViewCount(

src/test/badge.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe("Badge utilities", () => {
119119
const originalCallback = vi.fn().mockResolvedValue("result");
120120

121121
// Create the wrapped callback
122-
const repoData = { owner: "owner", repo: "repo" };
122+
const repoData = { owner: "idosal", repo: "git-mcp" };
123123
const wrappedCallback = withViewTracking(
124124
mockEnv,
125125
mockCtx,
@@ -171,7 +171,7 @@ describe("Badge utilities", () => {
171171
const originalCallback = vi.fn().mockResolvedValue("result");
172172

173173
// Create the wrapped callback
174-
const repoData = { owner: "owner", repo: "repo" };
174+
const repoData = { owner: "idosal", repo: "git-mcp" };
175175
const wrappedCallback = withViewTracking(
176176
mockEnv,
177177
{},

0 commit comments

Comments
 (0)