@@ -108,17 +108,8 @@ class GitHubAPIClient {
108108 private githubToken = "" ;
109109
110110 constructor ( ) {
111- < < < << << Updated upstream
112111 // Try to get token from environment
113112 if ( typeof process !== 'undefined' && process . env ?. GITHUB_TOKEN ) {
114- === === =
115- // Only read env token on the server to avoid exposing secrets client-side
116- if (
117- typeof window === "undefined" &&
118- typeof process !== "undefined" &&
119- process . env ?. GITHUB_TOKEN
120- ) {
121- >>> > >>> Stashed changes
122113 this . githubToken = process . env . GITHUB_TOKEN ;
123114 }
124115 }
@@ -189,25 +180,9 @@ class GitHubAPIClient {
189180 getTokenInfo ( ) : { hasToken : boolean ; tokenPrefix : string ; source : string } {
190181 return {
191182 hasToken : ! ! this . githubToken ,
192- << < < < << Updated upstream
193183 tokenPrefix : this . githubToken ? this . githubToken . substring ( 0 , 10 ) + '...' : 'NO_TOKEN' ,
194184 source : this . githubToken === process . env . GITHUB_TOKEN ? 'ENV_VAR' : 'USER_SET'
195185 }
196- === = ===
197- tokenPrefix : this . githubToken
198- ? this . githubToken . substring ( 0 , 10 ) + "..."
199- : "NO_TOKEN" ,
200- source :
201- typeof window = = = "undefined" &&
202- typeof process !== "undefined" &&
203- process . env ?. GITHUB_TOKEN &&
204- this . githubToken === process . env . GITHUB_TOKEN
205- ? "ENV_VAR"
206- : this . githubToken
207- ? "USER_SET"
208- : "NONE" ,
209- } ;
210- >>> >>> > Stashed changes
211186 }
212187
213188 // Test GitHub API connection
@@ -295,40 +270,8 @@ class GitHubAPIClient {
295270
296271 const data = await response . json ( ) ;
297272
298- << < < < << Updated upstream
299273 // Check rate limit status
300274 // Rate limit headers available but not currently used
301- === = ===
302- if ( typeof window !== "undefined" ) {
303- const updateRateLimit = (
304- window as typeof window & {
305- updateRateLimit ?: ( headers : Headers ) => void ;
306- }
307- ) . updateRateLimit ;
308- if ( updateRateLimit ) {
309- const headers = new Headers ( ) ;
310- const remaining =
311- response . headers . get ( "x-ratelimit-remaining" ) ||
312- response . headers . get ( "X-RateLimit-Remaining" ) ;
313- const limit =
314- response . headers . get ( "x-ratelimit-limit" ) ||
315- response . headers . get ( "X-RateLimit-Limit" ) ;
316- const reset =
317- response . headers . get ( "x-ratelimit-reset" ) ||
318- response . headers . get ( "X-RateLimit-Reset" ) ;
319- const used =
320- response . headers . get ( "x-ratelimit-used" ) ||
321- response . headers . get ( "X-RateLimit-Used" ) ;
322- if ( remaining && limit && reset ) {
323- headers . set ( "x-ratelimit-remaining" , remaining ) ;
324- headers . set ( "x-ratelimit-limit" , limit ) ;
325- headers . set ( "x-ratelimit-reset" , reset ) ;
326- if ( used ) headers . set ( "x-ratelimit-used" , used ) ;
327- updateRateLimit ( headers ) ;
328- }
329- }
330- }
331- >>> >>> > Stashed changes
332275
333276 this . cache . set ( cacheKey , { data, timestamp : Date . now ( ) } ) ;
334277 return data ;
0 commit comments