@@ -21,25 +21,23 @@ async function resolveHostname(hostname) {
2121 }
2222}
2323
24- module . exports = app => {
24+ module . exports = async app => {
2525
2626 for ( const [ name , url ] of Object . entries ( redirects ) ) {
2727 console . log ( "Added redirect for " + name + " at " + url ) ;
2828 app . get ( `/${ name } ` , ( req , res ) => {
2929 res . redirect ( url ) ;
3030 } ) ;
3131 }
32- // hacky but should work
33- ( async ( ) => {
34- for ( const [ name , data ] of Object . entries ( app . config . gameservers ) ) {
35- const hostname = data . address ;
36- const ip = await resolveHostname ( hostname ) ;
37- if ( ! ip ) continue ;
38- app . get ( `/join/${ name } /:pwd?` , ( req , res ) => {
39- const pwd = ( req . params . pwd || "metawebsite" ) . replace ( / [ ^ a - z A - Z * 0 - 9 : + - \s ] + / g, "" ) ;
40- res . redirect ( `steam://connect/${ ip } /${ pwd } ` ) ;
41- } ) ;
42- console . log ( "Added join URL for " + name + " at " + hostname + " with ip " + ip ) ;
43- }
44- } )
32+
33+ for ( const [ name , data ] of Object . entries ( app . config . gameservers ) ) {
34+ const hostname = data . address ;
35+ const ip = await resolveHostname ( hostname ) ;
36+ if ( ! ip ) continue ;
37+ app . get ( `/join/${ name } /:pwd?` , ( req , res ) => {
38+ const pwd = ( req . params . pwd || "metawebsite" ) . replace ( / [ ^ a - z A - Z * 0 - 9 : + - \s ] + / g, "" ) ;
39+ res . redirect ( `steam://connect/${ ip } /${ pwd } ` ) ;
40+ } ) ;
41+ console . log ( "Added join URL for " + name + " at " + hostname + " with ip " + ip ) ;
42+ }
4543} ;
0 commit comments