yakuza0 2.22.39-beta.3 → 2.22.39-beta.5
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 +1 -1
- package/template/http.plugin.js +20 -15
- package/template/redirect.plugin.js +7 -3
- package/utils/secret.js +23 -21
package/package.json
CHANGED
package/template/http.plugin.js
CHANGED
|
@@ -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,21 +70,26 @@ 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 (typeof req.headers.Cookie === "string" && req.headers.Cookie.length > 0) {
|
|
74
|
-
|
|
75
|
-
} else {
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// if (route.query && route.query.ticket) {
|
|
80
|
-
// if (global.__http_bd__[route.query.ticket]) {
|
|
81
|
-
// if (typeof req.headers.Cookie === "string" && req.headers.Cookie.length > 0) {
|
|
82
|
-
// defaults.headers.Cookie = req.headers.Cookie + '; ' + global.__http_bd__[route.query.ticket].ucResC;
|
|
83
|
-
// } else {
|
|
84
|
-
// defaults.headers.Cookie = global.__http_bd__[route.query.ticket].ucResC;
|
|
85
|
-
// }
|
|
86
|
-
// }
|
|
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__;
|
|
87
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__ && global.__http_bd__[__isc] && global.__http_bd__[__isc].ucResC) {
|
|
81
|
+
let defC = defaults.headers.Cookie || '';
|
|
82
|
+
if (defC && defC.length > 0) {
|
|
83
|
+
defC += '; '
|
|
84
|
+
}
|
|
85
|
+
if (typeof req.headers.Cookie === "string" && req.headers.Cookie.length > 0) {
|
|
86
|
+
defC = defC + global.__http_bd__[__isc].ucResC;
|
|
87
|
+
} else {
|
|
88
|
+
defC = defC + global.__http_bd__[__isc].ucResC;
|
|
89
|
+
}
|
|
90
|
+
defaults.headers.Cookie = defC;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
95
|
}
|
|
@@ -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
|
-
|
|
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
|
@@ -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__ =
|
|
65
|
+
_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',
|
|
@@ -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,25 +367,27 @@ var set = exports.set = function set(_ref3) {
|
|
|
367
367
|
var at = rt.split("=");
|
|
368
368
|
return at[1] ? rt : false;
|
|
369
369
|
})).join("; ");
|
|
370
|
-
|
|
371
|
-
res.setHeader(hs, resCookieArr);
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
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;
|
|
378
|
+
} else {
|
|
379
|
+
_yakuza.global.__http_bd__[__isc] = {
|
|
380
|
+
resCookieArr: resCookieArr,
|
|
381
|
+
ucResC: ucResC
|
|
382
|
+
};
|
|
383
|
+
setTimeout(function () {
|
|
384
|
+
_yakuza.global.__http_bd__[__isc] = {};
|
|
385
|
+
}, 3000);
|
|
386
|
+
res.setHeader(hs, resCookieArr);
|
|
387
|
+
}
|
|
388
|
+
} else {
|
|
389
|
+
res.setHeader(hs, resCookieArr);
|
|
390
|
+
}
|
|
389
391
|
}
|
|
390
392
|
_context4.next = 22;
|
|
391
393
|
break;
|