@@ -8,8 +8,9 @@ const getCurrentUser = () => $(".js-menu-target img").attr("alt").slice(1) || ""
88const isPrivate = ( ) => $ ( ".label-private" ) . length > 0 ;
99let statsScope = "repo" ;
1010
11- const githubURLBase = window . location . hostname === 'github.com' ? 'api.github.com' : `${ window . location . hostname } /api/v3` ;
12- const githubURL = `https://${ githubURLBase } `
11+ const isEnterprise = window . location . hostname !== 'github.com' ;
12+ const githubURLBase = isEnterprise ? `${ window . location . hostname } /api/v3` : 'api.github.com' ;
13+ const githubURL = `https://${ githubURLBase } ` ;
1314
1415function getContributor ( ) {
1516 let $contributor = $ ( ".timeline-comment-wrapper .timeline-comment-header-text strong a" ) ;
@@ -333,11 +334,15 @@ function update({ contributor, repoPath, currentNum, user }) {
333334 if ( storageRes . prs || storageRes . issues ) {
334335 updateTextNodes ( appendPRText ( currentNum , storageRes ) ) ;
335336 } else {
336- getSyncStorage ( { "access_token" : null } )
337+ const token = isEnterprise ? "enterprise_access_token" : "access_token" ;
338+ console . log ( token )
339+ getSyncStorage ( { [ token ] : null } )
337340 . then ( ( res ) => {
341+ const access_token = isEnterprise ? res . enterprise_access_token : res . access_token ;
342+
338343 Promise . all ( [
339- contributorCount ( { old : storageRes , user, access_token : res . access_token , type : "pr" , contributor, repoPath} ) ,
340- contributorCount ( { old : storageRes , user, access_token : res . access_token , type : "issue" , contributor, repoPath} )
344+ contributorCount ( { old : storageRes , user, access_token, type : "pr" , contributor, repoPath} ) ,
345+ contributorCount ( { old : storageRes , user, access_token, type : "issue" , contributor, repoPath} )
341346 ] )
342347 . then ( ( [ prInfo , issueInfo ] ) => {
343348 let repoInfo = Object . assign ( prInfo , issueInfo ) ;
0 commit comments