Browse Source

fixed favicons

master
mort 8 years ago
parent
commit
2f79154930
5 changed files with 16 additions and 2 deletions
  1. 1
    0
      .gitignore
  2. 1
    1
      server.js
  3. BIN
      web/favicon.ico
  4. 13
    0
      web/favicon.node.js
  5. 1
    1
      web/i/index.node.js

+ 1
- 0
.gitignore View File

@@ -4,3 +4,4 @@ npm-debug.log
imgs
!imgs/.placeholder
.currentRun
favicon.ico

+ 1
- 1
server.js View File

@@ -12,7 +12,7 @@ var conf = JSON.parse(fs.readFileSync("conf.json"));
var endpoints = {

//General
"/favicon.ico": "favicon.ico",
"/favicon.ico": "favicon.node.js",
"/global.css": "global.css",
"/global.js": "global.js",
"/404": "404.node.js",

BIN
web/favicon.ico View File


+ 13
- 0
web/favicon.node.js View File

@@ -0,0 +1,13 @@
var fs = require("fs");

module.exports = function(ctx) {
var readStream = fs.createReadStream("favicon.ico");
readStream.pipe(ctx.res);

readStream.on("error", function(err) {
if (err.code === "ENOENT")
ctx.end(ctx.view("404"));
else
ctx.end(err.toString());
});
}

+ 1
- 1
web/i/index.node.js View File

@@ -14,7 +14,7 @@ module.exports = function(ctx) {
readStream.pipe(ctx.res);

readStream.on("error", function(err){
if (err.code == "ENOENT")
if (err.code === "ENOENT")
ctx.end(ctx.view("404"));
else
ctx.end(err.toString());

Loading…
Cancel
Save