@@ -35,14 +35,16 @@ server.on('connection', (socket) => {
3535 . filter ( data => ( data [ 0 ] !== '' ) ) ) ;
3636
3737 if ( path !== '/' && ! path . startsWith ( '/cdn/' ) ) {
38+ const protocol = ( mode === 'test' ? 'http:' : ( headers [ 'upgrade-insecure-requests' ] === '1' ? 'http:' : 'https:' ) ) ;
39+
3840 const remoteSocket = net . createConnection ( {
3941 host : ( mode === 'prod' ? 'api.embernet.work' : '127.0.0.1' ) ,
4042 port : ( mode === 'prod' ? 433 : 3000 )
4143 } ) ;
4244
4345 const connectionData = data . toString ( ) . split ( '\r' ) . slice ( 1 ) . slice ( 0 , - 2 ) ;
4446 connectionData . unshift ( `GET ${ '/GameHub' + url } HTTP/1.1` ) ;
45- connectionData . push ( `\nMirror: ${ 'https://' + headers [ 'host' ] || query . get ( 'server' ) || 'gamehub.dev ' } ` ) ;
47+ connectionData . push ( `\nMirror: ${ protocol } // ${ headers [ 'host' ] || query . get ( 'server' ) || 'invalid ' } ` ) ;
4648 connectionData . push ( '\n\n' ) ;
4749
4850 remoteSocket . write ( connectionData . join ( '\r' ) ) ;
@@ -53,7 +55,7 @@ server.on('connection', (socket) => {
5355 if ( path !== '/' && ! path . startsWith ( '/cdn/' ) ) {
5456 const connectionData = data . toString ( ) . split ( '\r' ) . slice ( 1 ) . slice ( 0 , - 2 ) ;
5557 connectionData . unshift ( `GET ${ '/GameHub' + url } HTTP/1.1` ) ;
56- connectionData . push ( `\nMirror: ${ 'https://' + headers [ 'host' ] || query . get ( 'server' ) || 'gamehub.dev ' } ` ) ;
58+ connectionData . push ( `\nMirror: ${ protocol } // ${ headers [ 'host' ] || query . get ( 'server' ) || 'invalid ' } ` ) ;
5759 connectionData . push ( '\n\n' ) ;
5860
5961 remoteSocket . write ( connectionData . join ( '\r' ) ) ;
0 commit comments