@@ -57,10 +57,13 @@ export async function serve(serveDirectory, key) {
5757 }
5858 }
5959 console . log ( `hyperparam server running on http://localhost:${ port } ` )
60- if ( ! key ) openUrl ( `http://localhost:${ port } ` )
61- else {
62- key = encodeURIComponent ( key )
63- openUrl ( `http://localhost:${ port } /files?key=${ key } ` )
60+ const isDev = process . env . NODE_ENV === 'development'
61+ if ( ! isDev ) {
62+ if ( ! key ) openUrl ( `http://localhost:${ port } ` )
63+ else {
64+ key = encodeURIComponent ( key )
65+ openUrl ( `http://localhost:${ port } /files?key=${ key } ` )
66+ }
6467 }
6568}
6669
@@ -91,15 +94,12 @@ function handleRequest(req, serveDirectory) {
9194 } else if ( pathname . startsWith ( '/assets/' ) || pathname . startsWith ( '/favicon' ) ) {
9295 // serve static files
9396 return handleStatic ( `${ hyperparamPath } /dist${ pathname } ` )
94- // else if (pathname.startsWith('/public/')) {
95- // // serve static files
96- // return handleStatic(`${hyperparamPath}${pathname.replace(/^(\/public).*/, '/dist')}`)
9797 } else if ( serveDirectory && pathname === '/api/store/list' ) {
9898 // serve file list
9999 const prefix = parsedUrl . query . prefix || ''
100100 if ( Array . isArray ( prefix ) ) return { status : 400 , content : 'bad request' }
101- const perfixPath = `${ serveDirectory } /${ decodeURIComponent ( prefix ) } `
102- return handleListing ( perfixPath )
101+ const prefixPath = `${ serveDirectory } /${ decodeURIComponent ( prefix ) } `
102+ return handleListing ( prefixPath )
103103 } else if ( serveDirectory && pathname === '/api/store/get' ) {
104104 // serve file content
105105 const key = parsedUrl . query . key || ''
0 commit comments