mirror of
https://github.com/TheBinaryNinja/tvapp2.git
synced 2026-06-04 04:35:41 -04:00
feat: add favicon; support for binary data
This commit is contained in:
@@ -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 }` ) );
|
||||
}
|
||||
|
||||
BIN
tvapp2/www/favicon.ico
Normal file
BIN
tvapp2/www/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 90 KiB |
@@ -7,6 +7,7 @@
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/tvapp2.min.css">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
|
||||
Reference in New Issue
Block a user