Code cleanup

This commit is contained in:
Jake 2015-01-29 19:09:02 -06:00
parent 32c3ece12d
commit ffcd023c05
6 changed files with 8 additions and 10 deletions

View File

@ -21,7 +21,7 @@ function extract_url(profile, property) {
}); });
} }
return url; return url;
}; }
// exracts the skin url of a +profile+ object // exracts the skin url of a +profile+ object
// returns null when no url found (user has no skin) // returns null when no url found (user has no skin)

View File

@ -38,7 +38,7 @@ exp.extract_helm = function(uuid, facefile, buffer, outname, callback) {
if (err) { if (err) {
callback(err); callback(err);
} else { } else {
face_img.toBuffer("png", {compression: "none"}, function(err, face_buffer) { face_img.toBuffer("png", { compression: "none" }, function(err, face_buffer) {
skin_img.crop(40, 8, 47, 15, function(err, helm_img) { skin_img.crop(40, 8, 47, 15, function(err, helm_img) {
if (err) { if (err) {
callback(err); callback(err);
@ -99,7 +99,7 @@ exp.open_skin = function(uuid, skinpath, callback) {
fs.readFile(skinpath, function(err, buf) { fs.readFile(skinpath, function(err, buf) {
if (err) { if (err) {
logging.error(uuid + " error while opening skin file: " + err); logging.error(uuid + " error while opening skin file: " + err);
callback(err, null) callback(err, null);
} else { } else {
callback(null, buf); callback(null, buf);
} }

View File

@ -1,4 +1,3 @@
var networking = require("../modules/networking");
var logging = require("../modules/logging"); var logging = require("../modules/logging");
var helpers = require("../modules/helpers"); var helpers = require("../modules/helpers");
var config = require("../modules/config"); var config = require("../modules/config");
@ -49,7 +48,7 @@ module.exports = function(req, res) {
logging.log(uuid + " - " + human_status[status]); logging.log(uuid + " - " + human_status[status]);
if (err) { if (err) {
logging.error(uuid + " " + err); logging.error(uuid + " " + err);
if (err.code == "ENOENT") { if (err.code === "ENOENT") {
cache.remove_hash(uuid); cache.remove_hash(uuid);
} }
} }
@ -75,7 +74,7 @@ module.exports = function(req, res) {
} }
function handle_default(http_status, img_status, uuid) { function handle_default(http_status, img_status, uuid) {
if (def && def != "steve" && def != "alex") { if (def && def !== "steve" && def !== "alex") {
logging.log(uuid + " status: 301"); logging.log(uuid + " status: 301");
res.writeHead(301, { res.writeHead(301, {
"Cache-Control": "max-age=" + config.browser_cache_time + ", public", "Cache-Control": "max-age=" + config.browser_cache_time + ", public",

View File

@ -90,7 +90,7 @@ module.exports = function(req, res) {
// default alex/steve images can be rendered, but // default alex/steve images can be rendered, but
// custom images will not be // custom images will not be
function handle_default(http_status, img_status, uuid) { function handle_default(http_status, img_status, uuid) {
if (def && def != "steve" && def != "alex") { if (def && def !== "steve" && def !== "alex") {
logging.log(uuid + " status: 301"); logging.log(uuid + " status: 301");
res.writeHead(301, { res.writeHead(301, {
"Cache-Control": "max-age=" + config.browser_cache_time + ", public", "Cache-Control": "max-age=" + config.browser_cache_time + ", public",

View File

@ -1,4 +1,3 @@
var networking = require("../modules/networking");
var logging = require("../modules/logging"); var logging = require("../modules/logging");
var helpers = require("../modules/helpers"); var helpers = require("../modules/helpers");
var config = require("../modules/config"); var config = require("../modules/config");
@ -52,7 +51,7 @@ module.exports = function(req, res) {
} }
function handle_default(http_status, uuid) { function handle_default(http_status, uuid) {
if (def && def != "steve" && def != "alex") { if (def && def !== "steve" && def !== "alex") {
logging.log(uuid + " status: 301"); logging.log(uuid + " status: 301");
res.writeHead(301, { res.writeHead(301, {
"Cache-Control": "max-age=" + config.browser_cache_time + ", public", "Cache-Control": "max-age=" + config.browser_cache_time + ", public",

View File

@ -46,7 +46,7 @@ function requestHandler(req, res) {
var local_path = request.url.path_list[1]; var local_path = request.url.path_list[1];
logging.log(request.method + " " + request.url.href); logging.log(request.method + " " + request.url.href);
if (request.method == "GET" || request.method == "HEAD") { if (request.method === "GET" || request.method === "HEAD") {
try { try {
switch (local_path) { switch (local_path) {
case "": case "":