diff --git a/tvapp2/index.js b/tvapp2/index.js index afc3f4d2..39f1758b 100755 --- a/tvapp2/index.js +++ b/tvapp2/index.js @@ -1003,8 +1003,6 @@ const server = http.createServer( ( request, response ) => { if ( !err ) { - const html = data.toString(); - /* This allows us to serve all files locally: css, js, etc. the file loaded is dependent on what comes to the right of the period. @@ -1022,10 +1020,17 @@ const server = http.createServer( ( request, response ) => '.css' : 'text/css', '.gz' : 'application/gzip', '.js' : 'text/javascript' - }[loadAsset.substr( fileExt )]; + }[loadAsset.substring( fileExt )]; + + /* + ejs is only for templates; if we want to load an binary data (like images); we must use fs.readFile + */ + + if ( fileMime !== 'text/html' ) + data = fs.readFileSync( './www/' + loadAsset ); response.setHeader( 'Content-type', fileMime ); - response.end( html ); + response.end( data ); Log.debug( `www`, chalk.green( ` [LOAD] ` ), chalk.white( ` → ` ), chalk.grey( `asset:${ loadAsset } mime:${ fileMime }` ) ); } diff --git a/tvapp2/www/favicon.ico b/tvapp2/www/favicon.ico new file mode 100644 index 00000000..0d46efd0 Binary files /dev/null and b/tvapp2/www/favicon.ico differ diff --git a/tvapp2/www/index.html b/tvapp2/www/index.html index f421bfbf..93ad0f18 100644 --- a/tvapp2/www/index.html +++ b/tvapp2/www/index.html @@ -7,6 +7,7 @@ +