Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
F1xGOD authored Sep 12, 2024
1 parent 65ae799 commit 6f06f3c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ async function config(config) {
}
if(request.headers.useragent === 'googlebot') return response.writeHead(403).end('');
}
if(request.headers['host']!=undefined){
if (request.headers['host'].startsWith('cdn.')) {
var res;
var url = 'http://'+request.headers['host']+':8080'+request.url
if (request.url.startsWith('/method/swf')) return response.writeHead(301, {location: 'https://'+request.headers['host'].replace('cdn.','')+'/client/gateway?url=https://cohenerickson.github.io/radon-games-assets'+request.url.replace('/method','')}).end('')
fetch(url).then(r => {res=r;return r.text()}).then(text=>{var headers = res.headers;Object.entries(headers).forEach(([e,v])=>headers[e]=v.join(''));response.writeHead(res.status,headers).end(text)})
return ''
}
}}
if (request.url.startsWith('/key')) return fetch('http://cdn.'+request.headers['host']+':8443/').then(e=>e.text()).then(e=>response.end(e));//fetch('https://cdn.'+request.headers['host']+':8443/').then(e=>e.text()).then(e=>response.end(e))

if (request.url.endsWith('/webretro/info/')) request.url = '/webretro/info/index.html'
Expand Down

0 comments on commit 6f06f3c

Please sign in to comment.