add missing mime types to fix crash
This commit is contained in:
@ -14,7 +14,7 @@ function Websrv(tlib) {
|
||||
Websrv.prototype.getTpls();
|
||||
http.createServer((req, res) => {
|
||||
if(lib.cfg.websrv.wlip.hasOwnProperty(req.connection.remoteAddress)) {
|
||||
var filePath = '.' + req.url;
|
||||
var filePath = '.' + req.url.split('?')[0];
|
||||
var url = req.url.split("/")[1];
|
||||
if(filePath == './')
|
||||
filePath = './index.html';
|
||||
@ -73,7 +73,12 @@ function Websrv(tlib) {
|
||||
'.mp4': 'video/mp4',
|
||||
'.webm': 'video/webm',
|
||||
'.ogg': 'audio/ogg',
|
||||
'.mov': 'video/quicktime'
|
||||
'.mov': 'video/quicktime',
|
||||
'.woff': 'application/font-woff',
|
||||
'.woff2': 'font/woff2',
|
||||
'.eot': 'application/vnd.ms-fontobject',
|
||||
'.svg': 'image/svg+xml',
|
||||
'.ttf': 'application/octet-stream'
|
||||
}; // Todo: hat hier nichts zu suchen!
|
||||
if(filePath == "./index.html") { // mainpage
|
||||
var tpl = swig.compile(templates.index);
|
||||
@ -214,7 +219,7 @@ function Websrv(tlib) {
|
||||
fs.readFile(filePath, (error, content) => {
|
||||
if(error) {
|
||||
if(error.code == 'ENOENT') {
|
||||
res.writeHead(200, { 'Content-Type': contentType });
|
||||
res.writeHead(404, { 'Content-Type': contentType });
|
||||
res.end('404 - f0ck you', 'utf-8');
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user