@@ -20,7 +20,7 @@ const routes = [
2020 { path : '/~' , file : 'apps.html' } ,
2121 { path : '/-' , file : 'games.html' } ,
2222 { path : '/!' , file : 'settings.html' } ,
23- { path : '/% ' , file : 'tabs.html' } ,
23+ { path : '/0 ' , file : 'tabs.html' } ,
2424 { path : '/&' , file : 'go.html' } ,
2525 { path : '/w' , file : 'edu.html' } ,
2626] ;
@@ -42,6 +42,23 @@ app.get('/y/*', cors({ origin: false }), async (req, res, next) => {
4242 }
4343} ) ;
4444
45+ app . get ( '/y/*' , cors ( { origin : false } ) , async ( req , res , next ) => {
46+ try {
47+ const reqTarget = `https://raw.githubusercontent.com/retrobowl-unblocked/retrobowl-unblocked.github.io/main/${ req . params [ 0 ] } ` ;
48+ const asset = await fetch ( reqTarget ) ;
49+
50+ if ( asset . ok ) {
51+ const data = await asset . arrayBuffer ( ) ;
52+ res . end ( Buffer . from ( data ) ) ;
53+ } else {
54+ next ( ) ;
55+ }
56+ } catch ( error ) {
57+ console . error ( 'Error fetching:' , error ) ;
58+ next ( error ) ;
59+ }
60+ } ) ;
61+
4562routes . forEach ( ( route ) => {
4663 app . get ( route . path , ( req , res ) => {
4764 res . sendFile ( path . join ( __dirname , 'static' , route . file ) ) ;
0 commit comments