Prechádzať zdrojové kódy

Merge branch 'master' of github.com:Jake0oo0/crafatar

jomo 10 rokov pred
rodič
commit
6a4a78767c
6 zmenil súbory, kde vykonal 9 pridanie a 8 odobranie
  1. 1 1
      .gitignore
  2. 1 0
      Procfile
  3. 4 4
      modules/cache.js
  4. 3 3
      modules/helpers.js
  5. 0 0
      skins/faces/.gitkeep
  6. 0 0
      skins/helms/.gitkeep

+ 1 - 1
.gitignore

@@ -1,4 +1,4 @@
-skins/
+skins/*.png
 *.log
 node_modules/
 .DS_Store

+ 1 - 0
Procfile

@@ -0,0 +1 @@
+web: npm start

+ 4 - 4
modules/cache.js

@@ -4,10 +4,10 @@ var redis = null;
 
 function connect_redis() {
   console.log("connecting to redis");
-  if (process.env.REDISTOGO_URL) {
-    var rtg = require("url").parse(process.env.REDISTOGO_URL);
-    redis = require("redis").createClient(rtg.port, rtg.hostname);
-    redis.auth(rtg.auth.split(":")[1]);
+  if (process.env.REDISCLOUD_URL) {
+    var redisURL = require("url").parse(process.env.REDISCLOUD_URL);
+    redis = require("redis").createClient(redisURL.port, redisURL.hostname);
+    redis.auth(redisURL.auth.split(":")[1]);
   } else {
     redis = require("redis").createClient();
   }

+ 3 - 3
modules/helpers.js

@@ -31,8 +31,8 @@ function store_images(uuid, details, callback) {
         } else {
           // hash has changed
           console.log(uuid + "new hash: " + hash);
-          var facepath = config.faces_dir + hash + ".png";
-          var helmpath = config.helms_dir + hash + ".png";
+          var facepath = __dirname + '/../' + config.faces_dir + hash + ".png";
+          var helmpath = __dirname + '/../' + config.helms_dir + hash + ".png";
           // download skin, extract face/helm
           networking.skin_file(skinurl, facepath, helmpath, function(err) {
             if (err) {
@@ -114,7 +114,7 @@ exp.get_avatar = function(uuid, helm, size, callback) {
   console.log("\nrequest: " + uuid);
   get_image_hash(uuid, function(err, status, hash) {
     if (hash) {
-      var filepath = (helm ? config.helms_dir : config.faces_dir) + hash + ".png";
+      var filepath = __dirname + '/../' + (helm ? config.helms_dir : config.faces_dir) + hash + ".png";
       skins.resize_img(filepath, size, function(img_err, result) {
         if (img_err) {
           callback(img_err, -1, null);

+ 0 - 0
skins/faces/.gitkeep


+ 0 - 0
skins/helms/.gitkeep