File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11console . log ( 'Script loaded' ) ;
22
3- // Add your GitHub token here (optional - increases rate limit from 60 to 5000 requests/hour)
4- // Get a token at: https://github.com/settings/tokens (no scopes needed)
5- const GITHUB_TOKEN = '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' ; // Example: 'ghp_xxxxxxxxxxxx'
6-
73// State
84const state = {
95 platforms : [ ] ,
@@ -27,12 +23,7 @@ async function fetchFolderContents(path) {
2723 }
2824
2925 try {
30- const headers = { 'Accept' : 'application/vnd.github.v3+json' } ;
31- if ( GITHUB_TOKEN ) {
32- headers [ 'Authorization' ] = `token ${ GITHUB_TOKEN } ` ;
33- }
34-
35- const res = await fetch ( `https://api.github.com/repos/${ getRepoPath ( ) } /contents/${ path } ` , { headers } ) ;
26+ const res = await fetch ( `https://api.github.com/repos/${ getRepoPath ( ) } /contents/${ path } ` ) ;
3627
3728 if ( ! res . ok ) {
3829 console . error ( `Failed to fetch ${ path } : ${ res . status } ${ res . statusText } ` ) ;
@@ -273,12 +264,7 @@ async function renderProblem() {
273264
274265 if ( pyFiles . length > 0 ) {
275266 try {
276- const headers = { 'Accept' : 'application/vnd.github.v3+json' } ;
277- if ( GITHUB_TOKEN ) {
278- headers [ 'Authorization' ] = `token ${ GITHUB_TOKEN } ` ;
279- }
280-
281- const res = await fetch ( `https://api.github.com/repos/${ getRepoPath ( ) } /contents/${ pathStr } /${ pyFiles [ 0 ] . name } ` , { headers } ) ;
267+ const res = await fetch ( `https://api.github.com/repos/${ getRepoPath ( ) } /contents/${ pathStr } /${ pyFiles [ 0 ] . name } ` ) ;
282268 if ( res . ok ) {
283269 const data = await res . json ( ) ;
284270 pythonCode = atob ( data . content ) ;
You can’t perform that action at this time.
0 commit comments