@@ -138,6 +138,12 @@ <h1 id="title" style="display:none"></h1>
138138 const REPO = "prompt-sharing" ;
139139 const BRANCH = "main" ;
140140 const PRETTY_TITLES = true ;
141+ const PROXY_BASE = 'https://sharing.dogi.workers.dev/gh' ;
142+
143+ function viaProxy ( apiUrl ) {
144+ const u = new URL ( apiUrl ) ;
145+ return `${ PROXY_BASE } ${ u . pathname } ${ u . search } ` ;
146+ }
141147
142148 function parseParams ( ) {
143149 const out = { } ;
@@ -208,7 +214,7 @@ <h1 id="title" style="display:none"></h1>
208214 } else {
209215 // No specific file - fetch gist metadata to find the best file
210216 const apiUrl = `https://api.github.com/gists/${ gistId } ` ;
211- const res = await fetch ( apiUrl ) ;
217+ const res = await fetch ( viaProxy ( apiUrl ) ) ;
212218 if ( ! res . ok ) {
213219 throw new Error ( `Failed to fetch gist metadata: ${ res . status } ` ) ;
214220 }
@@ -287,7 +293,7 @@ <h1 id="title" style="display:none"></h1>
287293 }
288294
289295 async function fetchJSON ( url ) {
290- const res = await fetch ( url , {
296+ const res = await fetch ( viaProxy ( url ) , {
291297 cache : 'no-store' ,
292298 headers : { 'Accept' : 'application/vnd.github+json' }
293299 } ) ;
@@ -856,7 +862,7 @@ <h1 id="title" style="display:none"></h1>
856862 branchSelect . innerHTML = `<option>Loading branches…</option>` ;
857863 try {
858864 const res = await fetch (
859- `https://api.github.com/repos/${ currentOwner } /${ currentRepo } /branches?per_page=100&ts=${ Date . now ( ) } ` ,
865+ viaProxy ( `https://api.github.com/repos/${ currentOwner } /${ currentRepo } /branches?per_page=100&ts=${ Date . now ( ) } ` ) ,
860866 { cache : 'no-store' , headers : { 'Accept' : 'application/vnd.github+json' } }
861867 ) ;
862868 if ( ! res . ok ) {
0 commit comments