yakuza0 2.22.34-beta.24 → 2.22.34-beta.26
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/server/proxy/conf.js +3 -1
- package/server/proxy/csrf.js +1 -1
- package/server/proxy/tire.js +4 -2
- package/template/http.plugin.js +7 -6
- package/utils/secret.js +5 -5
package/package.json
CHANGED
package/server/proxy/conf.js
CHANGED
|
@@ -214,5 +214,7 @@ var ng_conf = exports.ng_conf = function ng_conf(_ref6) {
|
|
|
214
214
|
resolver = 'resolver ' + _server._.trimEnd(resolver, ';') + ';';
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
var headers = '\n proxy_set_header ' + _def.variable.projectNameHeader + ' \'' + th[_def.variable.projectNameHeader] + '\';\n proxy_set_header ' + _def.variable.ipHeader + ' \'' + th[_def.variable.ipHeader] + '\';\n proxy_set_header ' + _def.variable.childKeyHeader + ' \'' + th[_def.variable.childKeyHeader] + '\';\n proxy_set_header ' + _def.variable.appCodeHeader + ' \'' + th[_def.variable.appCodeHeader] + '\';\n proxy_set_header ' + _def.variable.appKeyHeader + ' \'' + th[_def.variable.appKeyHeader] + '\';\n proxy_set_header ' + _def.variable.shareRuleHeader + ' \'' + th[_def.variable.shareRuleHeader] + '\';\n proxy_set_header ' + _def.variable.baseURLHeader + ' \'' + th[_def.variable.baseURLHeader] + '\';\n ';
|
|
218
|
+
|
|
219
|
+
return '\n ' + resolver + '\n\n server {\n listen ' + port + ';\n server_name cln-tire.lan;\n include ' + confRoot + '/server.conf;\n\n location ' + basePath + ' {\n proxy_pass ' + appUrl + ';\n }\n\n location ' + basePath + 'apiv1 {\n ' + headers + '\n include ' + confRoot + '/proxy.conf;\n proxy_pass ' + yk4Addr + '/apiv1/' + name + '/client/backend;\n }\n\n location ' + basePath + 'apiv1/feapiv1 {\n ' + headers + '\n include ' + confRoot + '/proxy.conf;\n proxy_pass ' + yk4Addr + '/apiv1/' + name + '/client/feapiv1;\n }\n\n location ' + basePath + 'apiv2 {\n ' + headers + '\n include ' + confRoot + '/proxy.conf;\n proxy_pass ' + yk4Addr + '/apiv2;\n }\n\n location ~ ' + basePath + 'apiv3/cln_.*feapiv1/ {\n rewrite ^' + basePath + 'apiv3/cln_(.*)feapiv1/(.*)$ ' + basePath + 'apiv3/fe/$2 last;\n include ' + confRoot + '/proxy.conf;\n proxy_pass ' + yk4Addr + ';\n }\n location ~ ' + basePath + 'apiv3/cln_[a-z]+/ {\n rewrite ^' + basePath + 'apiv3/cln_[a-z]+/(.*)$ ' + basePath + 'apiv3/backend/$1 last;\n include ' + confRoot + '/proxy.conf;\n proxy_pass ' + yk4Addr + ';\n }\n }\n ';
|
|
218
220
|
};
|
package/server/proxy/csrf.js
CHANGED
|
@@ -744,7 +744,7 @@ exports.default = function () {
|
|
|
744
744
|
break;
|
|
745
745
|
}
|
|
746
746
|
|
|
747
|
-
ctx.cookies.set(_config2.default.server.sslify.openKey, '
|
|
747
|
+
ctx.cookies.set(_config2.default.server.sslify.openKey, '_', {
|
|
748
748
|
signed: false,
|
|
749
749
|
sameSite: _config2.default.server.cookieSameSite
|
|
750
750
|
});
|
package/server/proxy/tire.js
CHANGED
|
@@ -92,7 +92,7 @@ exports.default = function () {
|
|
|
92
92
|
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(_ref) {
|
|
93
93
|
var config = _ref.config;
|
|
94
94
|
|
|
95
|
-
var appConf, guPort, appConfPort, appName, server, pIp, pHost, timeout, commonHeaders, getHeader, isFastDfs, apiVer, getUc, build, baseConfig, app, _th, th, basePath, conf, _pathRewrite;
|
|
95
|
+
var appConf, guPort, appConfPort, appName, server, pIp, pHost, timeout, commonHeaders, getHeader, isFastDfs, apiVer, getUc, build, baseConfig, app, _th, baseURL, th, basePath, conf, _pathRewrite;
|
|
96
96
|
|
|
97
97
|
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
|
98
98
|
while (1) {
|
|
@@ -451,7 +451,8 @@ exports.default = function () {
|
|
|
451
451
|
(0, _child_process.exec)(_config2.default.server.tire.guPath + ' -s stop');
|
|
452
452
|
// spawn(yConf.server.tire.guPath, ['-s', 'stop']);
|
|
453
453
|
} catch (e) {}
|
|
454
|
-
|
|
454
|
+
baseURL = _config2.default.router.config[appName] && _config2.default.router.config[appName].proxyServer.baseURL || _config2.default.proxyServer.baseURL;
|
|
455
|
+
th = (_th = {}, (0, _defineProperty3.default)(_th, _def.variable.projectNameHeader, _config2.default.name), (0, _defineProperty3.default)(_th, _def.variable.ipHeader, '127.0.0.1'), (0, _defineProperty3.default)(_th, _def.variable.childKeyHeader, _config2.default.childKey), (0, _defineProperty3.default)(_th, _def.variable.appCodeHeader, config.appConf.appCode), (0, _defineProperty3.default)(_th, _def.variable.appKeyHeader, config.appKey), (0, _defineProperty3.default)(_th, _def.variable.shareRuleHeader, (0, _stringify2.default)(_config2.default.shareRule)), (0, _defineProperty3.default)(_th, _def.variable.baseURLHeader, baseURL), _th);
|
|
455
456
|
basePath = _server._.bothAddFix(config.appConf.server.basePath, "/");
|
|
456
457
|
|
|
457
458
|
|
|
@@ -477,6 +478,7 @@ exports.default = function () {
|
|
|
477
478
|
})));
|
|
478
479
|
|
|
479
480
|
app.use(basePath + "apiv2", createProxyMiddleware((0, _extends5.default)({}, baseConfig, {
|
|
481
|
+
headers: th,
|
|
480
482
|
target: _config2.default.server.orbProtocol.http + "//" + _config2.default.server.orbHost + ":" + _config2.default.server.orbPort,
|
|
481
483
|
pathRewrite: (0, _defineProperty3.default)({}, "^" + basePath + "apiv2", "/apiv2")
|
|
482
484
|
})));
|
package/template/http.plugin.js
CHANGED
|
@@ -5,6 +5,7 @@ import {variable} from 'yakuza1/lib/config/def';
|
|
|
5
5
|
import {symmetry, asymmetric, abstract} from 'yakuza1/lib/encrypt';
|
|
6
6
|
import urlib from 'yakuza1/lib/http';
|
|
7
7
|
|
|
8
|
+
global.__yk_gu__ = global.__yk_gu__ || {};
|
|
8
9
|
export default (ctx, inject) => {
|
|
9
10
|
const {$yk, req, $utils} = ctx;
|
|
10
11
|
const cookieStr = Cookies.koaGetCookieStr({req});
|
|
@@ -62,12 +63,12 @@ export default (ctx, inject) => {
|
|
|
62
63
|
// defaults.headers[variable.adjoinIpHeader] = getClientIP(req, {stupid: true});
|
|
63
64
|
|
|
64
65
|
if (req.headers) {
|
|
65
|
-
global.
|
|
66
|
-
global.
|
|
67
|
-
global.
|
|
68
|
-
defaults.headers[variable.guRouteGroupHeader] = global.
|
|
69
|
-
defaults.headers[variable.guRouteNameHeader] = global.
|
|
70
|
-
defaults.headers[variable.guRouteVerHeader] = global.
|
|
66
|
+
global.__yk_gu__[variable.guRouteGroupHeader] = req.headers[variable.guRouteGroupHeader] || global.__yk_gu__[variable.guRouteGroupHeader];
|
|
67
|
+
global.__yk_gu__[variable.guRouteNameHeader] = req.headers[variable.guRouteNameHeader] || global.__yk_gu__[variable.guRouteNameHeader];
|
|
68
|
+
global.__yk_gu__[variable.guRouteVerHeader] = req.headers[variable.guRouteVerHeader] || global.__yk_gu__[variable.guRouteVerHeader];
|
|
69
|
+
defaults.headers[variable.guRouteGroupHeader] = global.__yk_gu__[variable.guRouteGroupHeader];
|
|
70
|
+
defaults.headers[variable.guRouteNameHeader] = global.__yk_gu__[variable.guRouteNameHeader];
|
|
71
|
+
defaults.headers[variable.guRouteVerHeader] = global.__yk_gu__[variable.guRouteVerHeader];
|
|
71
72
|
defaults.headers[variable.adjoinIpHeader] = req.headers[variable.adjoinIpHeader];
|
|
72
73
|
defaults.headers[variable.forwardedForHeader] = req.headers[variable.forwardedForHeader];
|
|
73
74
|
}
|
package/utils/secret.js
CHANGED
|
@@ -61,7 +61,7 @@ var secret = {};
|
|
|
61
61
|
// import {mixin} from "yakuza1/lib/encrypt";
|
|
62
62
|
// import {asymmetric, getKey, symmetry} from "yakuza1/lib/encrypt/sm";
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
_yakuza.global.__yk_gu__ = _yakuza.global.__yk_gu__ || {};
|
|
65
65
|
|
|
66
66
|
// const allowHeaders = {
|
|
67
67
|
// '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',
|
|
@@ -273,11 +273,11 @@ var set = exports.set = function set(_ref3) {
|
|
|
273
273
|
// name: h['x-gu-route-name'] || secret_gu['x-gu-route-name'],
|
|
274
274
|
// ver: h['x-gu-route-ver'] || secret_gu['x-gu-route-ver'],
|
|
275
275
|
// };
|
|
276
|
-
[
|
|
277
|
-
|
|
276
|
+
[_def.variable.guRouteVerHeader, _def.variable.guRouteNameHeader, _def.variable.guRouteGroupHeader].forEach(function (v) {
|
|
277
|
+
_yakuza.global.__yk_gu__[v] = h[v] || _yakuza.global.__yk_gu__[v];
|
|
278
278
|
});
|
|
279
|
-
store.dispatch('__yk_init__/setGU',
|
|
280
|
-
$yk.gu =
|
|
279
|
+
store.dispatch('__yk_init__/setGU', _yakuza.global.__yk_gu__);
|
|
280
|
+
$yk.gu = _yakuza.global.__yk_gu__;
|
|
281
281
|
} else {
|
|
282
282
|
$yk.gu = store.state.__yk_init__ && store.state.__yk_init__.gu || {};
|
|
283
283
|
}
|