yakuza0 2.21.0-beta.2 → 2.21.0-beta.6

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.
package/cli/index.js CHANGED
@@ -168,6 +168,12 @@ var gi = function () {
168
168
  };
169
169
  }();
170
170
 
171
+ var alias = function alias() {
172
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
173
+
174
+ _server.global.__cln_appName__ = options.appName;
175
+ };
176
+
171
177
  var run = exports.run = function () {
172
178
  var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14(_argv) {
173
179
  return _regenerator2.default.wrap(function _callee14$(_context14) {
@@ -219,7 +225,7 @@ var run = exports.run = function () {
219
225
  }, _callee2, undefined);
220
226
  }));
221
227
 
222
- return function (_x3) {
228
+ return function (_x4) {
223
229
  return _ref5.apply(this, arguments);
224
230
  };
225
231
  }());
@@ -242,10 +248,11 @@ var run = exports.run = function () {
242
248
  while (1) {
243
249
  switch (_context3.prev = _context3.next) {
244
250
  case 0:
245
- _context3.next = 2;
251
+ alias({ appName: key });
252
+ _context3.next = 3;
246
253
  return require(params.serverPath)('dev', key);
247
254
 
248
- case 2:
255
+ case 3:
249
256
  case 'end':
250
257
  return _context3.stop();
251
258
  }
@@ -253,7 +260,7 @@ var run = exports.run = function () {
253
260
  }, _callee3, undefined);
254
261
  }));
255
262
 
256
- return function (_x5) {
263
+ return function (_x6) {
257
264
  return _ref8.apply(this, arguments);
258
265
  };
259
266
  }());
@@ -266,7 +273,7 @@ var run = exports.run = function () {
266
273
  }, _callee4, undefined);
267
274
  }));
268
275
 
269
- return function (_x4) {
276
+ return function (_x5) {
270
277
  return _ref7.apply(this, arguments);
271
278
  };
272
279
  }());
@@ -338,7 +345,7 @@ var run = exports.run = function () {
338
345
  }, _callee5, undefined);
339
346
  }));
340
347
 
341
- return function (_x7, _x8) {
348
+ return function (_x8, _x9) {
342
349
  return _ref12.apply(this, arguments);
343
350
  };
344
351
  }());
@@ -351,7 +358,7 @@ var run = exports.run = function () {
351
358
  }, _callee6, undefined);
352
359
  }));
353
360
 
354
- return function (_x6) {
361
+ return function (_x7) {
355
362
  return _ref10.apply(this, arguments);
356
363
  };
357
364
  }());
@@ -369,10 +376,11 @@ var run = exports.run = function () {
369
376
  process.env.NODE_CMD = 'build';
370
377
  // console.log(app);
371
378
  // gi({app: yk0BuildApp});
372
- _context7.next = 4;
379
+ alias({ appName: cmd });
380
+ _context7.next = 5;
373
381
  return require(params.serverPath)('build', cmd);
374
382
 
375
- case 4:
383
+ case 5:
376
384
  case 'end':
377
385
  return _context7.stop();
378
386
  }
@@ -380,7 +388,7 @@ var run = exports.run = function () {
380
388
  }, _callee7, undefined);
381
389
  }));
382
390
 
383
- return function (_x9) {
391
+ return function (_x10) {
384
392
  return _ref13.apply(this, arguments);
385
393
  };
386
394
  }());
@@ -424,8 +432,9 @@ var run = exports.run = function () {
424
432
  switch (_context9.prev = _context9.next) {
425
433
  case 0:
426
434
  _rimraf2.default.sync(_paths2.default.hardSourceCache);
435
+ _rimraf2.default.sync(_paths2.default.ykRootCacheDir);
427
436
 
428
- case 1:
437
+ case 2:
429
438
  case 'end':
430
439
  return _context9.stop();
431
440
  }
@@ -483,7 +492,7 @@ var run = exports.run = function () {
483
492
  }, _callee10, undefined);
484
493
  }));
485
494
 
486
- return function (_x10, _x11) {
495
+ return function (_x11, _x12) {
487
496
  return _ref17.apply(this, arguments);
488
497
  };
489
498
  }()
@@ -528,33 +537,35 @@ var run = exports.run = function () {
528
537
  apps = _ref20.apps;
529
538
 
530
539
  if (!['start', 'stop', 'restart', 'lite', 'container'].includes(cmd)) {
531
- _context12.next = 20;
540
+ _context12.next = 21;
532
541
  break;
533
542
  }
534
543
 
535
544
  _context12.t0 = cmd;
536
- _context12.next = _context12.t0 === 'lite' ? 13 : 16;
545
+ _context12.next = _context12.t0 === 'lite' ? 13 : 17;
537
546
  break;
538
547
 
539
548
  case 13:
540
- _context12.next = 15;
549
+ alias({ appName: apps[0] });
550
+ _context12.next = 16;
541
551
  return require(params.serverLite)(cmd);
542
552
 
543
- case 15:
544
- return _context12.abrupt('break', 18);
545
-
546
553
  case 16:
547
- _context12.next = 18;
554
+ return _context12.abrupt('break', 19);
555
+
556
+ case 17:
557
+ _context12.next = 19;
548
558
  return _server._.asyncMap(apps, function () {
549
559
  var _ref21 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(key, j) {
550
560
  return _regenerator2.default.wrap(function _callee11$(_context11) {
551
561
  while (1) {
552
562
  switch (_context11.prev = _context11.next) {
553
563
  case 0:
554
- _context11.next = 2;
564
+ alias({ appName: key });
565
+ _context11.next = 3;
555
566
  return require(params.serverPath)(cmd, key, j !== apps.length - 1);
556
567
 
557
- case 2:
568
+ case 3:
558
569
  case 'end':
559
570
  return _context11.stop();
560
571
  }
@@ -562,20 +573,20 @@ var run = exports.run = function () {
562
573
  }, _callee11, undefined);
563
574
  }));
564
575
 
565
- return function (_x14, _x15) {
576
+ return function (_x15, _x16) {
566
577
  return _ref21.apply(this, arguments);
567
578
  };
568
579
  }());
569
580
 
570
- case 18:
571
- _context12.next = 22;
581
+ case 19:
582
+ _context12.next = 23;
572
583
  break;
573
584
 
574
- case 20:
585
+ case 21:
575
586
  console.log('unknown "%s"', cmd);
576
587
  process.exit(2);
577
588
 
578
- case 22:
589
+ case 23:
579
590
  case 'end':
580
591
  return _context12.stop();
581
592
  }
@@ -583,7 +594,7 @@ var run = exports.run = function () {
583
594
  }, _callee12, undefined);
584
595
  }));
585
596
 
586
- return function (_x12, _x13) {
597
+ return function (_x13, _x14) {
587
598
  return _ref19.apply(this, arguments);
588
599
  };
589
600
  }()).on('--help', function () {
@@ -617,7 +628,7 @@ var run = exports.run = function () {
617
628
  }, _callee13, undefined);
618
629
  }));
619
630
 
620
- return function (_x16, _x17) {
631
+ return function (_x17, _x18) {
621
632
  return _ref22.apply(this, arguments);
622
633
  };
623
634
  }());
@@ -637,7 +648,7 @@ var run = exports.run = function () {
637
648
  }, _callee14, undefined);
638
649
  }));
639
650
 
640
- return function run(_x2) {
651
+ return function run(_x3) {
641
652
  return _ref3.apply(this, arguments);
642
653
  };
643
654
  }();
package/config/index.js CHANGED
@@ -4,12 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _extends2 = require('babel-runtime/helpers/extends');
8
+
9
+ var _extends3 = _interopRequireDefault(_extends2);
10
+
7
11
  var _yakuza = require('yakuza1');
8
12
 
9
13
  var _encrypt = require('yakuza1/lib/encrypt');
10
14
 
11
15
  var _conf = require('../utils/conf.js');
12
16
 
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
13
19
  var ec = function ec(cipher) {
14
20
  try {
15
21
  try {
@@ -21,8 +27,30 @@ var ec = function ec(cipher) {
21
27
  return {};
22
28
  };
23
29
 
24
- var safeGet = function safeGet() {
25
- var cj = require('.cache/yakuza0/config.json');
30
+ var safeGet = function safeGet(options) {
31
+ // const cj = require(`.cache/yakuza0/config.json`);
32
+ // if (options.key) {
33
+ //
34
+ // }
35
+ // const
36
+ // console.log(`.cache/yakuza0/app/${options.key}/config.json`, 1122);
37
+ // const cj = require(`.cache/yakuza0/app/${options.key}/config.json`);
38
+ // const cj = require(`.cache/yakuza0/config.json`);
39
+
40
+ var cj = {};
41
+ if ((0, _yakuza.checkServer)()) {
42
+ var paths = require('./paths').default;
43
+ var ycp = paths.ykConfigJsonClient(options.appName);
44
+ var str = paths.read(ycp.conf);
45
+ cj = JSON.parse(str);
46
+ } else {
47
+ var wp = require.context('yakuza0/.cache/', true, /\.json$/);
48
+ wp.keys().forEach(function (key) {
49
+ if (key.indexOf(options.appName) !== -1) {
50
+ cj = wp(key);
51
+ }
52
+ });
53
+ }
26
54
  return ec(cj);
27
55
  };
28
56
 
@@ -45,11 +73,16 @@ var lsSet = function lsSet(key, str) {
45
73
  var ykConfig = function ykConfig() {
46
74
  var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47
75
 
76
+ var options = (0, _extends3.default)({
77
+ appName: _yakuza.global.__cln_appName__
78
+ }, opt);
79
+
48
80
  var config = {};
49
81
  if ((0, _yakuza.checkServer)()) {
50
- config = safeGet();
82
+ config = safeGet(options);
51
83
  } else {
52
84
  var c = ec(_encrypt.mixin.symmetry.CBC.decrypt(_yakuza.global.__cln_init__));
85
+ options.appName = c.appName;
53
86
  if (!c.security.isStupid) {
54
87
  if (!_yakuza.global.__yk_conf_mt__) {
55
88
  var lgc = lsGet(c.key);
@@ -79,7 +112,7 @@ var ykConfig = function ykConfig() {
79
112
  config = _yakuza.global.__yk_conf_mt__;
80
113
  }
81
114
  } else {
82
- config = safeGet();
115
+ config = safeGet(options);
83
116
  }
84
117
  }
85
118
 
package/config/paths.js CHANGED
@@ -94,29 +94,37 @@ var appNodeModules = resolveApp('node_modules');
94
94
  var appGit = resolveApp('../../.git'); // postinstall运行 cwd根目录有差别
95
95
  var gitHooksDir = appGit + (path.sep + 'hooks');
96
96
  var gitHooksCommitMsg = gitHooksDir + (path.sep + 'commit-msg');
97
- var ykRoot = path.join(__dirname, '../');
97
+ // console.log(__dirname, process.cwd(), fs.realpathSync('.'), path.resolve(), path.resolve(path.dirname('')));
98
+ var ykRoot = path.join(process.cwd(), './node_modules/yakuza0/');
99
+ // const ykRoot = path.join(__dirname, '../');
98
100
  var ykLite = ykRoot + ('server' + path.sep + 'mode' + path.sep + 'lite.js');
99
101
  var ykTemplate = ykRoot + ('template' + path.sep);
100
102
  var ykNuxtBuild = ykRoot + ('nuxt' + path.sep + 'build' + path.sep);
101
103
  var ykCert = ykRoot + ('cert' + path.sep);
102
104
  var cacheDir = appNodeModules + (path.sep + '.cache');
103
105
  var ykCacheDir = cacheDir + (path.sep + 'yakuza0');
106
+ var ykRootCacheDir = ykRoot + '.cache';
104
107
  var ykCacheTmpDir = ykCacheDir + (path.sep + 'tmp');
105
108
  var ykCacheAppDir = ykCacheDir + (path.sep + 'app');
106
109
  var ykCacheTmpPub = ykCacheTmpDir + (path.sep + 'pub');
107
110
  var ykConfigJs = appDirectory + (path.sep + 'ykconfig.js');
108
- var ykConfigJson = ykCacheDir + (path.sep + 'config.json');
111
+ // const ykConfigJson = ykCacheDir + `${path.sep}config.json`;
109
112
  var ykCsrfPrivateKey = ykCacheTmpDir + (path.sep + 'csrfPrivate.key');
110
113
  // const ykCsrfPublicKey = ykCacheTmpDir + `${path.sep}public.key`;
111
114
  var ykConfigJsonClient = function ykConfigJsonClient(appName) {
112
- var dir = ykCacheAppDir + ('' + path.sep + appName);
113
- var file = '' + dir + path.sep + 'config_client';
115
+ var dir = ykRootCacheDir + ('' + path.sep + appName);
116
+ var confClient = '' + dir + path.sep + 'config_client';
117
+
118
+ var conf = '' + dir + path.sep + 'config.json';
119
+ var confServer = '' + dir + path.sep + 'config_server';
114
120
  return {
115
121
  dir: dir,
116
- file: file
122
+ conf: conf,
123
+ confClient: confClient,
124
+ confServer: confServer
117
125
  };
118
126
  };
119
- var ykConfigJsonServer = ykCacheDir + (path.sep + 'config_server');
127
+ // const ykConfigJsonServer = ykCacheDir + `${path.sep}config_server`;
120
128
  var interfereFile = ['' + appNodeModules + path.sep + '.package_versions.json', '' + appNodeModules + path.sep + '.recently_updates.txt'];
121
129
 
122
130
  mkdir(cacheDir);
@@ -167,13 +175,14 @@ exports.default = {
167
175
  nuxtConf: appDirectory + (path.sep + 'nuxt.config.js'),
168
176
  appAtSameDir: appDirectory + (path.sep + '..' + path.sep),
169
177
  ykCacheDir: ykCacheDir,
178
+ ykRootCacheDir: ykRootCacheDir,
170
179
  ykCacheTmpDir: ykCacheTmpDir,
171
180
  ykCacheAppDir: ykCacheAppDir,
172
181
  ykCacheTmpPub: ykCacheTmpPub,
173
182
  ykConfigJs: ykConfigJs,
174
- ykConfigJson: ykConfigJson,
183
+ // ykConfigJson,
175
184
  ykConfigJsonClient: ykConfigJsonClient,
176
- ykConfigJsonServer: ykConfigJsonServer,
185
+ // ykConfigJsonServer,
177
186
  // ykMainConf,
178
187
  hardSourceCache: appNodeModules + (path.sep + '.cache'),
179
188
  interfereFile: interfereFile,
package/nuxt/style.js CHANGED
@@ -37,7 +37,7 @@ exports.default = function (config) {
37
37
 
38
38
  config.buildModules = ['@rdc/nuxtjs-style-resources'];
39
39
 
40
- console.warn = function () {};
40
+ // console.warn = () => {};
41
41
  if (stylelint.enabled) {
42
42
  var sm = ['yakuza0/nuxt/buildModules/stylelint', stylelint.options];
43
43
  config.buildModules.push(sm);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yakuza0",
3
- "version": "2.21.0-beta.2",
3
+ "version": "2.21.0-beta.6",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -48,6 +48,7 @@
48
48
  "compression": "^1.7.4",
49
49
  "consola": "^2.10.1",
50
50
  "core-js": "3.10.1",
51
+ "css-loader": "^5.2.7",
51
52
  "download": "^7.1.0",
52
53
  "eslint": "^7.2.0",
53
54
  "eslint-friendly-formatter": "^3.0.0",
@@ -75,6 +76,10 @@
75
76
  "node-ssh": "5",
76
77
  "path-match": "^1.2.4",
77
78
  "pm2": "^4.2.0",
79
+ "postcss": "^8.4.5",
80
+ "postcss-import": "^13.0.0",
81
+ "postcss-loader": "^4.3.0",
82
+ "postcss-url": "^10.1.3",
78
83
  "react-dev-utils": "^11.0.4",
79
84
  "require-from-string": "^2.0.2",
80
85
  "rimraf": "^2.6.3",
@@ -97,12 +102,12 @@
97
102
  "tcp-port-used": "^1.0.1",
98
103
  "ua-parser-js": "^0.7.20",
99
104
  "v8-compile-cache": "^2.0.2",
100
- "yakuza1": "2.6.6"
105
+ "yakuza1": "2.6.7"
101
106
  },
102
107
  "peerDependencies": {
103
108
  "@rdc/nuxt": "2.15.8-0",
104
109
  "core-js": "3.10.1",
105
110
  "eslint": "7.2.0",
106
- "yakuza1": "2.6.6"
111
+ "yakuza1": "2.6.7"
107
112
  }
108
113
  }
@@ -375,43 +375,45 @@ exports.default = function () {
375
375
  // cln init
376
376
  app.use(function () {
377
377
  var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx, next) {
378
- var str, _str;
378
+ var ycp, str, _str;
379
379
 
380
380
  return _regenerator2.default.wrap(function _callee2$(_context2) {
381
381
  while (1) {
382
382
  switch (_context2.prev = _context2.next) {
383
383
  case 0:
384
+ ycp = _paths2.default.ykConfigJsonClient(config.appName);
385
+
384
386
  if (!(ctx.method.toUpperCase() === 'GET' && ctx.path === config.appConf.server.basePathMU + 'cln/init.js')) {
385
- _context2.next = 7;
387
+ _context2.next = 8;
386
388
  break;
387
389
  }
388
390
 
389
391
  (0, _control.noCache)(ctx);
390
- str = _paths2.default.read(_paths2.default.ykConfigJsonClient(config.appName).file);
392
+ str = _paths2.default.read(ycp.confClient);
391
393
 
392
394
  ctx.status = 200;
393
395
  ctx.body = str;
394
- _context2.next = 15;
396
+ _context2.next = 16;
395
397
  break;
396
398
 
397
- case 7:
399
+ case 8:
398
400
  if (!(ctx.method.toUpperCase() === 'POST' && ctx.path === config.appConf.server.basePathMU + 'cln/init')) {
399
- _context2.next = 13;
401
+ _context2.next = 14;
400
402
  break;
401
403
  }
402
404
 
403
- _str = _paths2.default.read(_paths2.default.ykConfigJsonServer);
405
+ _str = _paths2.default.read(ycp.confServer);
404
406
 
405
407
  ctx.status = 200;
406
408
  ctx.body = _str;
407
- _context2.next = 15;
409
+ _context2.next = 16;
408
410
  break;
409
411
 
410
- case 13:
411
- _context2.next = 15;
412
+ case 14:
413
+ _context2.next = 16;
412
414
  return next();
413
415
 
414
- case 15:
416
+ case 16:
415
417
  case 'end':
416
418
  return _context2.stop();
417
419
  }
@@ -185,7 +185,7 @@ var render = function () {
185
185
  ykServerEnv = _ref.ykServerEnv,
186
186
  ykPkg = _ref.pkg;
187
187
 
188
- var _ykConfig, ykConf, processEnv, aliasDir, conf, cspLoop, setConfValue, setConfCSP, setConf, hostname, port, ykServer, orbAddr, appPortUsed, tip, confStr, serverConfCipher, scKey, serverConfStr, serverConfStrTrans;
188
+ var _ykConfig, ykConf, processEnv, aliasDir, conf, cspLoop, setConfValue, setConfCSP, setConf, hostname, port, ykServer, orbAddr, tip;
189
189
 
190
190
  return _regenerator2.default.wrap(function _callee2$(_context2) {
191
191
  while (1) {
@@ -473,7 +473,7 @@ var render = function () {
473
473
  enabled: false,
474
474
  eslint: {
475
475
  enabled: true,
476
- test: ['vue', 'js'],
476
+ test: ['vue'],
477
477
  include: [],
478
478
  exclude: [],
479
479
  autoFixes: false,
@@ -624,44 +624,6 @@ var render = function () {
624
624
 
625
625
  setConf(mainConfFn(), mainConfFn(ykServerEnv), ykConf);
626
626
 
627
- _context2.t0 = conf.dkyMode;
628
- _context2.next = _context2.t0 === "dev" ? 12 : _context2.t0 === "prod" ? 14 : _context2.t0 === "stupid" ? 19 : _context2.t0 === "tire" ? 24 : 29;
629
- break;
630
-
631
- case 12:
632
- // conf.security.encrypt = "none";
633
- // conf.security.stupid = false;
634
- // conf.security.helmet = true;
635
- // conf.server.f5Offline = false;
636
- conf.security.isDev = true;
637
- return _context2.abrupt('break', 29);
638
-
639
- case 14:
640
- conf.security.encrypt = "sm";
641
- conf.security.stupid = false;
642
- conf.security.helmet = true;
643
- // conf.server.f5Offline = false;
644
- conf.security.isProd = true;
645
- return _context2.abrupt('break', 29);
646
-
647
- case 19:
648
- conf.security.encrypt = "sm";
649
- conf.security.stupid = true;
650
- conf.security.helmet = true;
651
- // conf.server.f5Offline = false;
652
- conf.security.isStupid = true;
653
- return _context2.abrupt('break', 29);
654
-
655
- case 24:
656
- conf.security.encrypt = "none";
657
- conf.security.stupid = false;
658
- conf.security.helmet = false;
659
- // conf.server.f5Offline = false;
660
- conf.security.isTire = true;
661
- return _context2.abrupt('break', 29);
662
-
663
- case 29:
664
-
665
627
  if (ykConf.https) {
666
628
  conf.server.protocol = 'https:';
667
629
  }
@@ -714,6 +676,44 @@ var render = function () {
714
676
  }
715
677
  });
716
678
 
679
+ _context2.t0 = conf.dkyMode;
680
+ _context2.next = _context2.t0 === "dev" ? 16 : _context2.t0 === "prod" ? 18 : _context2.t0 === "stupid" ? 23 : _context2.t0 === "tire" ? 28 : 33;
681
+ break;
682
+
683
+ case 16:
684
+ // conf.security.encrypt = "none";
685
+ // conf.security.stupid = false;
686
+ // conf.security.helmet = true;
687
+ // conf.server.f5Offline = false;
688
+ conf.security.isDev = true;
689
+ return _context2.abrupt('break', 33);
690
+
691
+ case 18:
692
+ conf.security.encrypt = "sm";
693
+ conf.security.stupid = false;
694
+ conf.security.helmet = true;
695
+ // conf.server.f5Offline = false;
696
+ conf.security.isProd = true;
697
+ return _context2.abrupt('break', 33);
698
+
699
+ case 23:
700
+ conf.security.encrypt = "sm";
701
+ conf.security.stupid = true;
702
+ conf.security.helmet = true;
703
+ // conf.server.f5Offline = false;
704
+ conf.security.isStupid = true;
705
+ return _context2.abrupt('break', 33);
706
+
707
+ case 28:
708
+ conf.security.encrypt = "none";
709
+ conf.security.stupid = false;
710
+ conf.security.helmet = false;
711
+ // conf.server.f5Offline = false;
712
+ conf.security.isTire = true;
713
+ return _context2.abrupt('break', 33);
714
+
715
+ case 33:
716
+
717
717
  // conf.router.config['app.examples'].enabled = true;
718
718
  if (conf.server.yk4Addr) {
719
719
  conf.server.orbAddr = conf.server.yk4Addr;
@@ -791,8 +791,8 @@ var render = function () {
791
791
 
792
792
  conf.server.csp.imgSrc = _yakuza._.uniq([].concat((0, _toConsumableArray3.default)(conf.server.csp.imgSrc || []), (0, _toConsumableArray3.default)(conf.server.tfs.fastdfs.domain)));
793
793
 
794
- appPortUsed = [];
795
- _context2.next = 51;
794
+ // const appPortUsed = [];
795
+ _context2.next = 50;
796
796
  return _yakuza._.asyncMap(conf.router.config, function () {
797
797
  var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(v, key) {
798
798
  var name, arr, length, num;
@@ -872,44 +872,47 @@ var render = function () {
872
872
  v.port = typeof v.imagePort === 'number' ? v.imagePort : 80;
873
873
  }
874
874
 
875
+ v.proxyServer.ws.key = _yakuza._.trimStart(v.server.basePathMU, "/") + "api-ws";
876
+ // console.log(v.proxyServer.ws.key, key);
877
+ // console.log(v.server.basePathMU, v.proxyServer.ws.key, _.trimStart(v.server.basePathMU, "/"), key);
875
878
  _context.t0 = v.port;
876
879
 
877
880
  if (_context.t0) {
878
- _context.next = 26;
881
+ _context.next = 27;
879
882
  break;
880
883
  }
881
884
 
882
- _context.next = 25;
885
+ _context.next = 26;
883
886
  return (0, _getPort2.default)({ port: pool });
884
887
 
885
- case 25:
888
+ case 26:
886
889
  _context.t0 = _context.sent;
887
890
 
888
- case 26:
891
+ case 27:
889
892
  v.port = _context.t0;
890
893
 
891
894
  pool = _yakuza._.without(pool, v.port);
892
895
 
893
896
  if (!v.server.generate.enabled) {
894
- _context.next = 34;
897
+ _context.next = 35;
895
898
  break;
896
899
  }
897
900
 
898
- _context.next = 31;
901
+ _context.next = 32;
899
902
  return (0, _getPort2.default)({ port: appPool });
900
903
 
901
- case 31:
904
+ case 32:
902
905
  _context.t1 = _context.sent;
903
- _context.next = 35;
906
+ _context.next = 36;
904
907
  break;
905
908
 
906
- case 34:
909
+ case 35:
907
910
  _context.t1 = v.port;
908
911
 
909
- case 35:
912
+ case 36:
910
913
  v.appPort = _context.t1;
911
914
 
912
- appPortUsed.push(v.appPort);
915
+ // appPortUsed.push(v.appPort);
913
916
  appPool = _yakuza._.without(appPool, v.appPort);
914
917
 
915
918
  // console.log(v.appPort);
@@ -938,7 +941,7 @@ var render = function () {
938
941
  }
939
942
  }
940
943
 
941
- conf.router.config[key] = v;
944
+ conf.router.config[key] = _yakuza._.cloneDeep(v);
942
945
 
943
946
  case 41:
944
947
  case 'end':
@@ -953,7 +956,7 @@ var render = function () {
953
956
  };
954
957
  }());
955
958
 
956
- case 51:
959
+ case 50:
957
960
  // console.log(conf.router.config);
958
961
 
959
962
  conf.shareRule.app = conf.shareRule.app.map(function (ap) {
@@ -972,34 +975,6 @@ var render = function () {
972
975
  err = true;
973
976
  _consola2.default.error(_msg.errMsg['name.none']);
974
977
  }
975
- // switch (process.env.NODE_TYPE) {
976
- // case 'publish':
977
- // if (!_.isArray(conf.publish)) {
978
- // conf.publish = [conf.publish];
979
- // }
980
- //
981
- // conf.publish.forEach(publish => {
982
- // if (!publish.remoteDir) {
983
- // consola.error(errMsg['publish.connect.remoteDir']);
984
- // err = true;
985
- // }
986
- // if (!publish.localDir) {
987
- // // consola.info(errMsg['publish.connect.localDir']);
988
- // }
989
- // });
990
- // break;
991
- // default:
992
- // // if (!conf.proxyServer.baseURL) {
993
- // // conf.proxyServer.baseURL = conf.proxyServer.gateway[conf.proxyServer.baseKey];
994
- // // }
995
- //
996
- // if (!conf.name) {
997
- // err = true;
998
- // consola.error(errMsg['name.none']);
999
- // }
1000
- //
1001
- // // conf.proxyServer.services.$ = conf.proxyServer.services.$ || conf.proxyServer.baseURL;
1002
- // }
1003
978
 
1004
979
  if (err) {
1005
980
  process.exit();
@@ -1031,22 +1006,27 @@ var render = function () {
1031
1006
  // const es = mixin.symmetry.ECB.encrypt(JSON.stringify(conf));
1032
1007
  // fs.writeFileSync(ykConfigJson, JSON.stringify({es}), 'utf8');
1033
1008
 
1034
- confStr = (0, _stringify2.default)(conf);
1035
- serverConfCipher = _encrypt.mixin.symmetry.CBC.encrypt(confStr);
1009
+ // const confStr = JSON.stringify(conf);
1010
+ // const serverConfCipher = mixin.symmetry.CBC.encrypt(confStr);
1036
1011
 
1037
1012
  // let omitStr = JSON.stringify(_.omit(conf, ['versionSha', 'cmd']));
1038
1013
  // appPortUsed.forEach(p => {
1039
1014
  // omitStr = omitStr.replace(p.toString(), '');
1040
1015
  // })
1041
-
1042
- scKey = (0, _yakuza.md5)(confStr).substring(2, 8);
1043
-
1016
+ // const scKey = md5(confStr).substring(2, 8);
1044
1017
 
1045
1018
  _yakuza._.forEach(conf.router.config, function (v, k) {
1046
1019
  if (v.enabled) {
1020
+ conf.proxyServer = v.proxyServer;
1021
+ conf.server = v.server;
1022
+ var confStr = (0, _stringify2.default)(conf);
1023
+ var serverConfCipher = _encrypt.mixin.symmetry.CBC.encrypt(confStr);
1024
+ var scKey = (0, _yakuza.md5)(confStr).substring(2, 8);
1025
+
1047
1026
  var clientConfStr = _encrypt.mixin.symmetry.CBC.encrypt((0, _stringify2.default)({
1048
1027
  key: scKey,
1049
1028
  basePathMU: v.server.basePathMU,
1029
+ appName: k,
1050
1030
  security: {
1051
1031
  isStupid: conf.security.isStupid
1052
1032
  }
@@ -1055,15 +1035,19 @@ var render = function () {
1055
1035
  var clientConfStrTrans = _encrypt.mixin.symmetry.CBC.encrypt(clientConfStrCipher);
1056
1036
  var ycp = ykConfigJsonClient(k);
1057
1037
  mkdir(ycp.dir);
1058
- _fs2.default.writeFileSync(ycp.file, 'var __cln_init__ = "' + clientConfStrTrans + '"', 'utf8');
1038
+ _fs2.default.writeFileSync(ycp.confClient, 'var __cln_init__ = "' + clientConfStrTrans + '"', 'utf8');
1039
+
1040
+ var serverConfStr = (0, _stringify2.default)({ es: serverConfCipher });
1041
+ var serverConfStrTrans = _encrypt.mixin.symmetry.CBC.encrypt(serverConfStr, _encrypt.mixin.getKey(scKey));
1042
+ _fs2.default.writeFileSync(ycp.conf, serverConfStr, 'utf8');
1043
+ _fs2.default.writeFileSync(ycp.confServer, serverConfStrTrans, 'utf8');
1059
1044
  }
1060
1045
  });
1061
1046
 
1062
- serverConfStr = (0, _stringify2.default)({ es: serverConfCipher });
1063
- serverConfStrTrans = _encrypt.mixin.symmetry.CBC.encrypt(serverConfStr, _encrypt.mixin.getKey(scKey));
1064
-
1065
- _fs2.default.writeFileSync(ykConfigJson, serverConfStr, 'utf8');
1066
- _fs2.default.writeFileSync(ykConfigJsonServer, serverConfStrTrans, 'utf8');
1047
+ // const serverConfStr = JSON.stringify({es: serverConfCipher})
1048
+ // const serverConfStrTrans = mixin.symmetry.CBC.encrypt(serverConfStr, mixin.getKey(scKey))
1049
+ // fs.writeFileSync(ykConfigJson, serverConfStr, 'utf8');
1050
+ // fs.writeFileSync(ykConfigJsonServer, serverConfStrTrans, 'utf8');
1067
1051
  // await setYk0Conf(orbAddr, scKey, serverConfStrTrans);
1068
1052
 
1069
1053
  // if (conf.https) {
@@ -1072,7 +1056,7 @@ var render = function () {
1072
1056
 
1073
1057
  return _context2.abrupt('return', { conf: conf });
1074
1058
 
1075
- case 65:
1059
+ case 57:
1076
1060
  case 'end':
1077
1061
  return _context2.stop();
1078
1062
  }