File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 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 (
Original file line number Diff line number Diff 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 { } ,
You can’t perform that action at this time.
0 commit comments