Browse Source

Update deps with npm audit fix

Mike L 3 months from now
parent
commit
cc1043421b
2 changed files with 16 additions and 12 deletions
  1. 9 5
      lib/tools.js
  2. 7 7
      package.json

+ 9 - 5
lib/tools.js

@@ -1,5 +1,5 @@
 var redis = require("redis");
-var uuidv4 = require('uuid/v4');
+var uuidv4 = require('uuid').v4;
 
 /**
  * Redis存档的Hash消息管理工具
@@ -15,14 +15,18 @@ module.exports = function(conf)
 	 */
 	var init = () => {
 		this.conf = conf;
+		var socket = { host: conf.redis_host, port: conf.redis_port };
 		// noderedis密码等选项
-		var options = conf.redis_pwd ? { password: conf.redis_pwd } : null;
+		var options = { legacyMode: true, password: conf.redis_pwd, socket: socket };
+		if (!options.password) delete options.password;
 		// redis client instance
-		this.client = redis.createClient(conf.redis_port, conf.redis_host, options);
+		this.client = redis.createClient(options);
 
 		this.client.on("error", (err) => {
-		    console.log("redis Error " + err);
+			console.log("redis Error " + err);
 		});
+
+		return this.client.connect();
 	}
 
 	/**
@@ -96,4 +100,4 @@ module.exports = function(conf)
 
 	// 初始化
 	init();
-}
+}

+ 7 - 7
package.json

@@ -7,16 +7,16 @@
     "start": "node ./bin/www"
   },
   "dependencies": {
-    "body-parser": "~1.18.2",
+    "body-parser": "^1.20.5",
     "cookie-parser": "~1.4.3",
     "debug": "~2.6.9",
-    "express": "~4.15.5",
-    "express-rate-limit": "^2.11.0",
-    "morgan": "~1.9.0",
-    "pug": "latest",
-    "redis": "^2.8.0",
+    "express": "^4.22.2",
+    "express-rate-limit": "^2.14.2",
+    "morgan": "^1.11.0",
+    "pug": "^3.0.4",
+    "redis": "^4.7.1",
     "serve-favicon": "~2.4.5",
     "util": "^0.10.3",
-    "uuid": "^3.2.1"
+    "uuid": "^11.1.1"
   }
 }