mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-21 23:41:18 +01:00
code cleanup
This commit is contained in:
parent
8750b863a8
commit
de5bad8702
@ -10,8 +10,8 @@ if (cluster.isMaster) {
|
||||
cluster.fork();
|
||||
}
|
||||
|
||||
cluster.on("exit", function (worker, code, signal) {
|
||||
logging.error("Worker died. Rebooting a new one.");
|
||||
cluster.on("exit", function (worker) {
|
||||
logging.error("Worker #" + worker.id + " died. Rebooting a new one.");
|
||||
setTimeout(cluster.fork, 100);
|
||||
});
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// https://github.com/confuser/serverless-mc-skin-viewer
|
||||
// Permission to use & distribute https://github.com/confuser/serverless-mc-skin-viewer/blob/master/LICENSE
|
||||
|
||||
var helpers = require("./helpers");
|
||||
var logging = require("./logging");
|
||||
var fs = require("fs");
|
||||
var Canvas = require("canvas");
|
||||
@ -43,7 +42,7 @@ exp.draw_head = function(skin_canvas, model_ctx, scale) {
|
||||
// using the skin from the +model_ctx+ at the +scale+
|
||||
// parts are labeled as if drawn from the skin's POV
|
||||
exp.draw_body = function(rid, skin_canvas, model_ctx, scale) {
|
||||
if (skin_canvas.height == 32 * scale) {
|
||||
if (skin_canvas.height === 32 * scale) {
|
||||
logging.debug(rid + "uses old skin format");
|
||||
//Left Leg
|
||||
//Left Leg - Front
|
||||
@ -189,8 +188,8 @@ function scale_image(imageData, context, d_x, d_y, scale) {
|
||||
var width = imageData.width;
|
||||
var height = imageData.height;
|
||||
context.clearRect(0,0,width,height); //Clear the spot where it originated from
|
||||
for(y=0; y<height; y++) { //height original
|
||||
for(x=0; x<width; x++) { //width original
|
||||
for(var y = 0; y < height; y++) { // height original
|
||||
for(var x = 0; x < width; x++) { // width original
|
||||
//Gets original colour, then makes a scaled square of the same colour
|
||||
var index = (x + y * width) * 4;
|
||||
context.fillStyle = "rgba(" + imageData.data[index+0] + "," + imageData.data[index+1] + "," + imageData.data[index+2] + "," + imageData.data[index+3] + ")";
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
var logging = require("../modules/logging");
|
||||
var helpers = require("../modules/helpers");
|
||||
var config = require("../modules/config");
|
||||
var cache = require("../modules/cache");
|
||||
|
||||
var human_status = {
|
||||
0: "none",
|
||||
@ -35,7 +36,7 @@ module.exports = function(req, res) {
|
||||
logging.log(rid + "storage type: " + human_status[status]);
|
||||
if (err) {
|
||||
logging.error(rid + err);
|
||||
if (err.code == "ENOENT") {
|
||||
if (err.code === "ENOENT") {
|
||||
// no such file
|
||||
cache.remove_hash(rid, userId);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
var logging = require("../modules/logging");
|
||||
var helpers = require("../modules/helpers");
|
||||
var config = require("../modules/config");
|
||||
var cache = require("../modules/cache");
|
||||
var skins = require("../modules/skins");
|
||||
var renders = require("../modules/renders");
|
||||
var fs = require("fs");
|
||||
@ -65,7 +66,7 @@ module.exports = function(req, res) {
|
||||
logging.log(rid + "storage type: " + human_status[status]);
|
||||
if (err) {
|
||||
logging.error(rid + err);
|
||||
if (err.code == "ENOENT") {
|
||||
if (err.code === "ENOENT") {
|
||||
// no such file
|
||||
cache.remove_hash(rid, userId);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user