yakuza0 2.22.39-beta.0 → 2.22.39-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yakuza0",
3
- "version": "2.22.39-beta.0",
3
+ "version": "2.22.39-beta.2",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -7,7 +7,7 @@ import urlib from 'yakuza1/lib/http';
7
7
 
8
8
  global.__yk_gu__ = global.__yk_gu__ || {};
9
9
  export default (ctx, inject) => {
10
- const {$yk, req, $utils} = ctx;
10
+ const {$yk, req, $utils, route} = ctx;
11
11
  const cookieStr = Cookies.koaGetCookieStr({req});
12
12
  const options = JSON.parse('<%= options %>');
13
13
 
@@ -70,7 +70,15 @@ export default (ctx, inject) => {
70
70
  defaults.headers[variable.forwardedForHeader] = req.headers[variable.forwardedForHeader];
71
71
 
72
72
  if (!req.headers.Cookie || (typeof req.headers.Cookie === "string" && req.headers.Cookie.indexOf(variable.csrfCookie) === -1)) {
73
- defaults.headers.Cookie = global.__http_bd__;
73
+ if (route.query && route.query.ticket) {
74
+ if (global.__http_bd__[route.query.ticket]) {
75
+ if (typeof req.headers.Cookie === "string" && req.headers.Cookie.length > 0) {
76
+ defaults.headers.Cookie = req.headers.Cookie + '; ' + global.__http_bd__[route.query.ticket].ucResC;
77
+ } else {
78
+ defaults.headers.Cookie = global.__http_bd__[route.query.ticket].ucResC;
79
+ }
80
+ }
81
+ }
74
82
  }
75
83
  }
76
84
  }
package/utils/secret.js CHANGED
@@ -62,7 +62,7 @@ var secret = {};
62
62
  // import {asymmetric, getKey, symmetry} from "yakuza1/lib/encrypt/sm";
63
63
 
64
64
  _yakuza.global.__yk_gu__ = _yakuza.global.__yk_gu__ || {};
65
- _yakuza.global.__http_bd__ = _yakuza.global.__http_bd__ || '';
65
+ _yakuza.global.__http_bd__ = _yakuza.global.__http_bd__ || {};
66
66
 
67
67
  // const allowHeaders = {
68
68
  // 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36',
@@ -311,7 +311,7 @@ var set = exports.set = function set(_ref3) {
311
311
  switch (_context4.prev = _context4.next) {
312
312
  case 0:
313
313
  if (!((0, _yakuza.checkServer)() || !$yk.appConf.ssr)) {
314
- _context4.next = 23;
314
+ _context4.next = 22;
315
315
  break;
316
316
  }
317
317
 
@@ -347,57 +347,54 @@ var set = exports.set = function set(_ref3) {
347
347
  Cookie: Cookie
348
348
  }, _def.variable.clientKeyHeader, mixin.symmetry.CBC.encrypt((0, _yakuza.md5)((0, _yakuza.uuid)())));
349
349
  _context4.prev = 11;
350
-
351
- _yakuza.global.__http_bd__ = '';
352
350
  hs = "Set-Cookie";
353
- _context4.next = 16;
351
+ _context4.next = 15;
354
352
  return _universal2.default.post(($yk.appConf.ssr ? $yk.origin + '/' : $yk.server.basePathMU) + "apiv2/support/svc/uc", {
355
353
  body: bodyStr,
356
354
  headers: ucHeaders,
357
355
  timeout: timeout
358
356
  });
359
357
 
360
- case 16:
358
+ case 15:
361
359
  rs = _context4.sent;
362
360
  resCookie = rs.headers.get(hs);
363
361
 
364
362
  if (resCookie) {
365
- ucResC = _yakuza._.compact(resCookie.split(',').map(function (r) {
363
+ resCookieArr = resCookie.split(',');
364
+
365
+ ucResC = _yakuza._.compact(resCookieArr.map(function (r) {
366
366
  var rt = r.substring(0, r.indexOf(";"));
367
367
  var at = rt.split("=");
368
368
  return at[1] ? rt : false;
369
- })).join(";");
370
- resCookieArr = resCookie.split(',');
371
-
372
-
373
- resCookieArr.forEach(function (r) {
374
- var single_rc = r.split(';');
375
- if (single_rc.length > 0) {
376
- var single_bd = single_rc[0].split(_def.variable.csrfCookie)[1];
377
- if (single_bd.length > 2) {
378
- if (_yakuza.global.__http_bd__) {
379
- _yakuza.global.__http_bd__ += '; ';
380
- }
381
-
382
- _yakuza.global.__http_bd__ += _yakuza._.trim(single_rc[0]);
383
- }
369
+ })).join("; ");
370
+ if (route.query && route.query.ticket) {
371
+ if (_yakuza.global.__http_bd__[route.query.ticket]) {
372
+ res.setHeader(hs, _yakuza.global.__http_bd__[route.query.ticket].resCookieArr);
373
+ ucResC = _yakuza.global.__http_bd__[route.query.ticket].ucResC;
374
+ } else {
375
+ _yakuza.global.__http_bd__[route.query.ticket] = {
376
+ resCookieArr: resCookieArr,
377
+ ucResC: ucResC
378
+ };
379
+ res.setHeader(hs, resCookieArr);
384
380
  }
385
- });
386
- res.setHeader(hs, resCookieArr);
381
+ } else {
382
+ res.setHeader(hs, resCookieArr);
383
+ }
387
384
  }
388
- _context4.next = 23;
385
+ _context4.next = 22;
389
386
  break;
390
387
 
391
- case 21:
392
- _context4.prev = 21;
388
+ case 20:
389
+ _context4.prev = 20;
393
390
  _context4.t0 = _context4["catch"](11);
394
391
 
395
- case 23:
392
+ case 22:
396
393
  case "end":
397
394
  return _context4.stop();
398
395
  }
399
396
  }
400
- }, _callee4, undefined, [[11, 21]]);
397
+ }, _callee4, undefined, [[11, 20]]);
401
398
  }));
402
399
 
403
400
  return function getUc() {