cgserver 9.2.6 → 9.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ const https = require("https");
9
9
  const EventTool_1 = require("../Logic/EventTool");
10
10
  const IServerConfig_1 = require("../Config/IServerConfig");
11
11
  const cgserver_1 = require("../cgserver");
12
+ const Config_1 = require("../Config/Config");
12
13
  class ISocketServer {
13
14
  _cfg = null;
14
15
  //方便提示
@@ -95,8 +96,8 @@ class ISocketServer {
95
96
  let server = null;
96
97
  if (wss) {
97
98
  let options = {
98
- key: fs.readFileSync("ssl/ssl2.key"),
99
- cert: fs.readFileSync("ssl/ssl2.crt"),
99
+ key: fs.readFileSync(Config_1.Config.rootDataDir + "ssl/ssl2.key"),
100
+ cert: fs.readFileSync(Config_1.Config.rootDataDir + "ssl/ssl2.crt"),
100
101
  //passphrase:'1234'//如果秘钥文件有密码的话,用这个属性设置密码
101
102
  };
102
103
  server = https.createServer(options, (request, response) => {
@@ -8,6 +8,7 @@ const fs = require("fs");
8
8
  const form_1 = require("alipay-sdk/lib/form");
9
9
  const Log_1 = require("../Logic/Log");
10
10
  const IServerConfig_1 = require("../Config/IServerConfig");
11
+ const Config_1 = require("../Config/Config");
11
12
  class AlipayResult {
12
13
  alipay_trade_app_pay_response = {
13
14
  code: "10000",
@@ -98,7 +99,7 @@ class AlipayTool {
98
99
  else {
99
100
  let app_key = "";
100
101
  if (this._cfg.app_key.indexOf(".pem") > 0) {
101
- app_key = fs.readFileSync(this._cfg.app_key, 'ascii');
102
+ app_key = fs.readFileSync(Config_1.Config.rootDataDir + this._cfg.app_key, 'ascii');
102
103
  }
103
104
  else {
104
105
  app_key = this._cfg.app_key;
@@ -7,6 +7,7 @@ const ec_key_1 = require("ec-key");
7
7
  const uuid_1 = require("uuid");
8
8
  const fs = require("fs");
9
9
  const IServerConfig_1 = require("../Config/IServerConfig");
10
+ const Config_1 = require("../Config/Config");
10
11
  //developer.apple.com/documentation/appstorereceipts/responsebody
11
12
  class ReceiptInfo {
12
13
  cancellation_date = "";
@@ -201,7 +202,7 @@ class AppleTool {
201
202
  create_time;
202
203
  // Get the PEM-formatted private key string associated with the Key ID.
203
204
  const path = IServerConfig_1.GServerCfg.apple.keyIds[keyIdentifier];
204
- const keyString = fs.readFileSync(path).toString();
205
+ const keyString = fs.readFileSync(Config_1.Config.rootDataDir + path).toString();
205
206
  // Create an Elliptic Curve Digital Signature Algorithm (ECDSA) object using the private key.
206
207
  const key = new ec_key_1.default(keyString, 'pem');
207
208
  // Set up the cryptographic format used to sign the key with the SHA-256 hashing algorithm.
@@ -10,6 +10,7 @@ const Log_1 = require("../../Logic/Log");
10
10
  const cors = require("cors");
11
11
  const Express = require("express");
12
12
  const cookieParser = require("cookie-parser");
13
+ const Config_1 = require("../../Config/Config");
13
14
  class Engine {
14
15
  _app = Express();
15
16
  _cfg = null;
@@ -38,8 +39,8 @@ class Engine {
38
39
  }
39
40
  if (this._cfg.ssl) {
40
41
  const httpsOption = {
41
- key: fs.readFileSync(this._cfg.ssl.key),
42
- cert: fs.readFileSync(this._cfg.ssl.crt)
42
+ key: fs.readFileSync(Config_1.Config.rootDataDir + this._cfg.ssl.key),
43
+ cert: fs.readFileSync(Config_1.Config.rootDataDir + this._cfg.ssl.crt)
43
44
  };
44
45
  https.createServer(httpsOption, this._app).listen(port, () => {
45
46
  this._is_running = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "9.2.6",
3
+ "version": "9.2.7",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",