File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ export default {
2+ async fetch ( request : Request , env : { ASSETS : Fetcher } ) : Promise < Response > {
3+ const url = new URL ( request . url ) ;
4+
5+ // Serve assets from the dist directory
6+ const response = await env . ASSETS . fetch ( request ) ;
7+
8+ // Add CORS header for giscus theme CSS
9+ if ( url . pathname === '/giscus-theme.css' ) {
10+ const newHeaders = new Headers ( response . headers ) ;
11+ newHeaders . set ( 'Access-Control-Allow-Origin' , 'https://giscus.app' ) ;
12+ return new Response ( response . body , {
13+ status : response . status ,
14+ statusText : response . statusText ,
15+ headers : newHeaders ,
16+ } ) ;
17+ }
18+
19+ return response ;
20+ } ,
21+ } ;
Original file line number Diff line number Diff line change 11name = " codingwithcalvin-net"
22compatibility_date = " 2024-12-01"
3+ main = " src/worker.ts"
34
45[assets ]
56directory = " ./dist"
7+ binding = " ASSETS"
You can’t perform that action at this time.
0 commit comments