yakuza0 2.23.40 → 2.23.41

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.
@@ -40,6 +40,10 @@ var _replace = require('./replace');
40
40
 
41
41
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42
42
 
43
+ // Remove e-mail addresses left in bundled dependency banners/comments. The
44
+ // optional backslashes also cover addresses escaped by some bundlers/scanners.
45
+ var emailAddressPattern = /[a-z0-9.!#$%&'*+/=?^_`{|}~-]+\\?@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/ig;
46
+
43
47
  var customExtend = function customExtend(_ref) {
44
48
  var eslint = _ref.eslint,
45
49
  alias = _ref.alias,
@@ -86,6 +90,9 @@ exports.default = function (config) {
86
90
  // test: /package.json/,
87
91
  test: /\.js$/,
88
92
  rules: [{
93
+ search: emailAddressPattern,
94
+ replace: ''
95
+ }, {
89
96
  // search: /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/ig,
90
97
  search: '@indutny.com',
91
98
  replace: ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yakuza0",
3
- "version": "2.23.40",
3
+ "version": "2.23.41",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -68,9 +68,16 @@ var appAtSameDir = _paths2.default.appAtSameDir,
68
68
  access = _paths2.default.access,
69
69
  ykCert = _paths2.default.ykCert;
70
70
 
71
+ var passthroughApiKeys = ['apiv5', 'apiv6'];
72
+ var isPassthroughApiPath = function isPassthroughApiPath(path) {
73
+ return passthroughApiKeys.some(function (apiKey) {
74
+ var prefix = '/' + apiKey;
75
+ return path === prefix || path.startsWith(prefix + '/') || path.startsWith(prefix + '?');
76
+ });
77
+ };
78
+
71
79
  // cert verify
72
80
  // fs.readFileSync(`${appAtSameDir}${yConf.name.toLocaleString()}.pfx`)
73
-
74
81
  var getCert = function getCert() {
75
82
  var custom = {
76
83
  pfx: '' + appAtSameDir + _config2.default.name.toLocaleString() + '.pfx',
@@ -120,12 +127,18 @@ exports.default = function () {
120
127
  proxyConf = _ref.proxyConf,
121
128
  nuxt = _ref.nuxt,
122
129
  config = _ref.config;
123
- var pKey, servers, wsProxyKeys;
130
+ var webProxyConf, pKey, servers, wsProxyKeys;
124
131
  return _regenerator2.default.wrap(function _callee3$(_context3) {
125
132
  while (1) {
126
133
  switch (_context3.prev = _context3.next) {
127
134
  case 0:
128
- _server._.forEach(proxyConf, function (proxyOpts, key) {
135
+ webProxyConf = proxyConf.apiv3 ? (0, _extends3.default)({}, proxyConf, {
136
+ apiv5: proxyConf.apiv3,
137
+ apiv6: proxyConf.apiv3
138
+ }) : proxyConf;
139
+
140
+
141
+ _server._.forEach(webProxyConf, function (proxyOpts, key) {
129
142
  var baseUrl = typeof proxyOpts === "string" ? proxyOpts : proxyOpts && proxyOpts.target || '';
130
143
  var proxyOptions = typeof proxyOpts !== "string" ? proxyOpts : {};
131
144
  var local = _config2.default.proxyServer.apiKey === key;
@@ -160,7 +173,7 @@ exports.default = function () {
160
173
  // if (!path.startsWith('/apiv3/')) {
161
174
  // console.log(path);
162
175
  // if (!['/apiv2/', '/apiv3/'].includes(path)) {
163
- if (!path.startsWith('/apiv2/') && !path.startsWith('/apiv3/') && !path.startsWith('/api-ws/')) {
176
+ if (!path.startsWith('/apiv2/') && !path.startsWith('/apiv3/') && !isPassthroughApiPath(path) && !path.startsWith('/api-ws/')) {
164
177
  path = path.replace('/' + key, '');
165
178
  }
166
179
 
@@ -169,7 +182,9 @@ exports.default = function () {
169
182
  }
170
183
 
171
184
  return path;
172
- } }, proxyOptions))(ctx, next);
185
+ } }, proxyOptions, passthroughApiKeys.includes(key) ? { rewrite: function rewrite(path) {
186
+ return path;
187
+ } } : {}))(ctx, next);
173
188
  });
174
189
  }
175
190
  });
@@ -392,6 +407,8 @@ exports.default = function () {
392
407
 
393
408
  servers.forEach(function (ser) {
394
409
  ser.on('upgrade', function (req, socket, head) {
410
+ socket.on('error', function (err) {});
411
+
395
412
  if (_config2.default.server.om.enabled && _server.global.__cpm__ && (0, _om.isOmOpen)(req)) {
396
413
  _server.global.__cpm__.upgrade(req, socket, head);
397
414
  } else {
@@ -400,6 +417,21 @@ exports.default = function () {
400
417
  nuxtAppName: config.appName,
401
418
  nuxtAppConf: config.appConf || {}
402
419
  };
420
+ var requestPath = req.url.split('?')[0];
421
+ var basePath = config.appConf.server.basePathMU || '/';
422
+ var passthroughApiKey = passthroughApiKeys.find(function (key) {
423
+ return ['/' + key, '' + basePath + key].some(function (prefix) {
424
+ return requestPath === prefix || requestPath.startsWith(prefix + '/');
425
+ });
426
+ });
427
+
428
+ if (passthroughApiKey && webProxyConf.apiv3) {
429
+ var apiv3ProxyConf = typeof webProxyConf.apiv3 === 'string' ? { target: webProxyConf.apiv3 } : webProxyConf.apiv3;
430
+ var apiv3ProxyOptions = _server._.omit(apiv3ProxyConf, ['logs', 'rewrite', 'events']);
431
+ _mid.proxy.ws(req, socket, head, (0, _extends3.default)({}, defProxyOpt, apiv3ProxyOptions));
432
+ return;
433
+ }
434
+
403
435
  if (req.url.startsWith('/' + _config2.default.proxyServer.ws.key)) {
404
436
  var headers = {
405
437
  Host: _config2.default.server.orbHost
@@ -441,12 +473,10 @@ exports.default = function () {
441
473
  }, defProxyOpt));
442
474
  }
443
475
  }
444
-
445
- socket.on('error', function (err) {});
446
476
  });
447
477
  });
448
478
 
449
- case 8:
479
+ case 9:
450
480
  case 'end':
451
481
  return _context3.stop();
452
482
  }
@@ -975,6 +975,8 @@ var render = function () {
975
975
 
976
976
  conf.proxyServer.proxy.apiv2 = orbAddr;
977
977
  conf.proxyServer.proxy.apiv3 = orbAddr;
978
+ conf.proxyServer.proxy.apiv5 = orbAddr;
979
+ conf.proxyServer.proxy.apiv6 = orbAddr;
978
980
  conf.proxyServer.proxy[conf.proxyServer.ws.key] = orbAddr;
979
981
  conf.server.orbAddr = orbAddr;
980
982
 
@@ -1001,7 +1003,7 @@ var render = function () {
1001
1003
  conf.server.csp.directives = directives;
1002
1004
 
1003
1005
  // const appPortUsed = [];
1004
- _context2.next = 87;
1006
+ _context2.next = 89;
1005
1007
  return _yakuza._.asyncMap(conf.router.config, function () {
1006
1008
  var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(v, key) {
1007
1009
  var name, arr, length, num;
@@ -1188,7 +1190,7 @@ var render = function () {
1188
1190
  };
1189
1191
  }());
1190
1192
 
1191
- case 87:
1193
+ case 89:
1192
1194
  // console.log(conf.router.config);
1193
1195
 
1194
1196
  conf.shareRule.app = conf.shareRule.app.map(function (ap) {
@@ -1310,7 +1312,7 @@ var render = function () {
1310
1312
 
1311
1313
  return _context2.abrupt('return', { conf: conf });
1312
1314
 
1313
- case 98:
1315
+ case 100:
1314
1316
  case 'end':
1315
1317
  return _context2.stop();
1316
1318
  }