yakuza0 2.22.39-beta.2 → 2.22.39-beta.4

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.2",
3
+ "version": "2.22.39-beta.4",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  import KY from 'yakuza1/lib/ky/universal'
2
- import {_, FormData as FD, checkServer, jsUrl, qs, Cookies, global} from 'yakuza1';
2
+ import {_, FormData as FD, checkServer, jsUrl, qs, Cookies, global, md5} from 'yakuza1';
3
3
  import {verifyHeaders, explainUrl, apiDec, apiEnc, splitFD} from 'yakuza1/lib/safe';
4
4
  import {variable} from 'yakuza1/lib/config/def';
5
5
  import {symmetry, asymmetric, abstract} from 'yakuza1/lib/encrypt';
@@ -70,12 +70,18 @@ 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
- if (route.query && route.query.ticket) {
74
- if (global.__http_bd__[route.query.ticket]) {
73
+ // if (typeof req.headers.Cookie === "string" && req.headers.Cookie.length > 0) {
74
+ // defaults.headers.Cookie = req.headers.Cookie + '; ' + global.__http_bd__;
75
+ // } else {
76
+ // defaults.headers.Cookie = global.__http_bd__;
77
+ // }
78
+ if (route.query.ticket || route.query.__isc) {
79
+ const __isc = route.query.ticket ? md5(route.query.ticket).substring(0, 6) : route.query.__isc
80
+ if (global.__http_bd__[__isc]) {
75
81
  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;
82
+ defaults.headers.Cookie = req.headers.Cookie + '; ' + global.__http_bd__[__isc].ucResC;
77
83
  } else {
78
- defaults.headers.Cookie = global.__http_bd__[route.query.ticket].ucResC;
84
+ defaults.headers.Cookie = global.__http_bd__[__isc].ucResC;
79
85
  }
80
86
  }
81
87
  }
@@ -1,4 +1,4 @@
1
- import {jsUrl, _, checkServer, qs, Cookies} from 'yakuza1';
1
+ import {jsUrl, _, checkServer, qs, Cookies, md5} from 'yakuza1';
2
2
  import yConf from 'yakuza0/config';
3
3
 
4
4
  const setCookie = (key, value, options) => {
@@ -22,7 +22,7 @@ const setCookie = (key, value, options) => {
22
22
  }
23
23
 
24
24
  export default async (ctx, inject) => {
25
- const {redirect, $yk, req, res} = ctx
25
+ const {redirect, $yk, req, res, route} = ctx
26
26
  const appName = $yk.appName;
27
27
 
28
28
  const matchLocal = (url) => {
@@ -117,7 +117,11 @@ export default async (ctx, inject) => {
117
117
  }
118
118
  }
119
119
  } else {
120
- redirect(url)
120
+ const q = jsUrl('?', url) || {};
121
+ if (route.query.ticket || route.query.__isc) {
122
+ q.__isc = route.query.ticket ? md5(route.query.ticket).substring(0, 6) : route.query.__isc
123
+ }
124
+ redirect(url, q)
121
125
  }
122
126
  }
123
127
 
package/utils/secret.js CHANGED
@@ -304,7 +304,7 @@ var set = exports.set = function set(_ref3) {
304
304
 
305
305
  getUc = function () {
306
306
  var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4() {
307
- var ucBody, _spi, _spiQuery, _spiSecret, defDomain, bodyStr, Cookie, ucHeaders, hs, rs, resCookie, resCookieArr;
307
+ var ucBody, _spi, _spiQuery, _spiSecret, defDomain, bodyStr, Cookie, ucHeaders, hs, rs, resCookie, resCookieArr, __isc;
308
308
 
309
309
  return _regenerator2.default.wrap(function _callee4$(_context4) {
310
310
  while (1) {
@@ -367,15 +367,22 @@ var set = exports.set = function set(_ref3) {
367
367
  var at = rt.split("=");
368
368
  return at[1] ? rt : false;
369
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;
370
+ // global.__http_bd__ = ucResC;
371
+ // res.setHeader(hs, resCookieArr);
372
+ if (route.query.ticket || route.query.__isc) {
373
+ __isc = route.query.ticket ? (0, _yakuza.md5)(route.query.ticket).substring(0, 6) : route.query.__isc;
374
+
375
+ if (_yakuza.global.__http_bd__[__isc] && _yakuza.global.__http_bd__[__isc].resCookieArr) {
376
+ res.setHeader(hs, _yakuza.global.__http_bd__[__isc].resCookieArr);
377
+ ucResC = _yakuza.global.__http_bd__[__isc].ucResC;
374
378
  } else {
375
- _yakuza.global.__http_bd__[route.query.ticket] = {
379
+ _yakuza.global.__http_bd__[__isc] = {
376
380
  resCookieArr: resCookieArr,
377
381
  ucResC: ucResC
378
382
  };
383
+ setTimeout(function () {
384
+ _yakuza.global.__http_bd__[__isc] = {};
385
+ }, 3000);
379
386
  res.setHeader(hs, resCookieArr);
380
387
  }
381
388
  } else {