yakuza0 2.23.6-beta.3 → 2.23.6-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/nuxt/modules/clientIp.js +19 -0
- package/nuxt/modules/index.js +1 -1
- package/package.json +1 -1
- package/server/proxy/web.js +14 -3
- package/template/clientIp.plugin.js +9 -0
- package/utils/clientIp.js +97 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
exports.default = function (moduleOptions) {
|
|
8
|
+
this.addPlugin({
|
|
9
|
+
src: _paths2.default.ykTemplate + 'clientIp.plugin.js'
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
var _paths = require('../../config/paths');
|
|
14
|
+
|
|
15
|
+
var _paths2 = _interopRequireDefault(_paths);
|
|
16
|
+
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
|
|
19
|
+
module.exports = exports['default'];
|
package/nuxt/modules/index.js
CHANGED
|
@@ -48,7 +48,7 @@ exports.default = function (config) {
|
|
|
48
48
|
// '@nuxtjs/style-resources',
|
|
49
49
|
// 'nuxt-polyfill',
|
|
50
50
|
// ['nuxt-svg-sprite-loader', {symbolId: 'icon-[name]'}],
|
|
51
|
-
_paths2.default.path.resolve(__dirname, './md.js'), _paths2.default.path.resolve(__dirname, './tfs.js'), _paths2.default.path.resolve(__dirname, './services.js'), _paths2.default.path.resolve(__dirname, './storage.js'), _paths2.default.path.resolve(__dirname, './log.js'), _paths2.default.path.resolve(__dirname, './ws.js'), _paths2.default.path.resolve(__dirname, './http.js'), _paths2.default.path.resolve(__dirname, './console.js'), _paths2.default.path.resolve(__dirname, './init.js'), _paths2.default.path.resolve(__dirname, './redirect.js'), _paths2.default.path.resolve(__dirname, './utils.js'), _paths2.default.path.resolve(__dirname, './yk.js'), _paths2.default.path.resolve(__dirname, './first.js')]);
|
|
51
|
+
_paths2.default.path.resolve(__dirname, './clientIp.js'), _paths2.default.path.resolve(__dirname, './md.js'), _paths2.default.path.resolve(__dirname, './tfs.js'), _paths2.default.path.resolve(__dirname, './services.js'), _paths2.default.path.resolve(__dirname, './storage.js'), _paths2.default.path.resolve(__dirname, './log.js'), _paths2.default.path.resolve(__dirname, './ws.js'), _paths2.default.path.resolve(__dirname, './http.js'), _paths2.default.path.resolve(__dirname, './console.js'), _paths2.default.path.resolve(__dirname, './init.js'), _paths2.default.path.resolve(__dirname, './redirect.js'), _paths2.default.path.resolve(__dirname, './utils.js'), _paths2.default.path.resolve(__dirname, './yk.js'), _paths2.default.path.resolve(__dirname, './first.js')]);
|
|
52
52
|
|
|
53
53
|
// if (yConf.pkg.yk.nuxt.mds.svg) {
|
|
54
54
|
// mds.push(['nuxt-svg-sprite-loader', {symbolId: 'icon-[name]'}]);
|
package/package.json
CHANGED
package/server/proxy/web.js
CHANGED
|
@@ -123,7 +123,9 @@ exports.default = function () {
|
|
|
123
123
|
while (1) {
|
|
124
124
|
switch (_context3.prev = _context3.next) {
|
|
125
125
|
case 0:
|
|
126
|
-
_server._.forEach(proxyConf, function (
|
|
126
|
+
_server._.forEach(proxyConf, function (proxyOpts, key) {
|
|
127
|
+
var baseUrl = typeof proxyOpts === "string" ? proxyOpts : proxyOpts && proxyOpts.target || '';
|
|
128
|
+
var proxyOptions = typeof proxyOpts !== "string" ? proxyOpts : {};
|
|
127
129
|
var local = _config2.default.proxyServer.apiKey === key;
|
|
128
130
|
if (local) {
|
|
129
131
|
app.use(function (ctx, next) {
|
|
@@ -165,8 +167,7 @@ exports.default = function () {
|
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
return path;
|
|
168
|
-
}
|
|
169
|
-
}))(ctx, next);
|
|
170
|
+
} }, proxyOptions))(ctx, next);
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
173
|
});
|
|
@@ -248,6 +249,16 @@ exports.default = function () {
|
|
|
248
249
|
});
|
|
249
250
|
}
|
|
250
251
|
});
|
|
252
|
+
// _.forEach(yConf.proxyServer.proxyOptions, dt => {
|
|
253
|
+
// if (dt.match && minimatch(key, dt.match)) {
|
|
254
|
+
// if (dt.pathRewrite === true) {
|
|
255
|
+
// console.log(proxyReq, 11);
|
|
256
|
+
// }
|
|
257
|
+
// _.forEach(dt.headers, (v, k) => {
|
|
258
|
+
// proxyReq.setHeader(k, v);
|
|
259
|
+
// })
|
|
260
|
+
// }
|
|
261
|
+
// })
|
|
251
262
|
|
|
252
263
|
// proxyReq.setHeader('host', proxyReq.host);
|
|
253
264
|
// proxyReq.setHeader('host', proxyReq.host);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.clientIp = undefined;
|
|
7
|
+
|
|
8
|
+
var _regenerator = require('babel-runtime/regenerator');
|
|
9
|
+
|
|
10
|
+
var _regenerator2 = _interopRequireDefault(_regenerator);
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
|
15
|
+
|
|
16
|
+
var _ws = require('yakuza1/lib/ws');
|
|
17
|
+
|
|
18
|
+
var _config = require('../config');
|
|
19
|
+
|
|
20
|
+
var _config2 = _interopRequireDefault(_config);
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
var clientIp = exports.clientIp = function () {
|
|
25
|
+
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(_ref) {
|
|
26
|
+
var ctx = _ref.ctx;
|
|
27
|
+
var $http, $utils;
|
|
28
|
+
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
|
29
|
+
while (1) {
|
|
30
|
+
switch (_context2.prev = _context2.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
$http = ctx.$http, $utils = ctx.$utils;
|
|
33
|
+
return _context2.abrupt('return', (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
|
|
34
|
+
var result;
|
|
35
|
+
return _regenerator2.default.wrap(function _callee$(_context) {
|
|
36
|
+
while (1) {
|
|
37
|
+
switch (_context.prev = _context.next) {
|
|
38
|
+
case 0:
|
|
39
|
+
if (_config2.default.standAlone) {
|
|
40
|
+
_context.next = 18;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!($utils.checkServer() || !_config2.default.server.heartbeat.enabled)) {
|
|
45
|
+
_context.next = 8;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_context.next = 4;
|
|
50
|
+
return $http.post('$/feapiv1/func/clientIp', {
|
|
51
|
+
hasHook: []
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
case 4:
|
|
55
|
+
result = _context.sent;
|
|
56
|
+
return _context.abrupt('return', result && result.data);
|
|
57
|
+
|
|
58
|
+
case 8:
|
|
59
|
+
_context.prev = 8;
|
|
60
|
+
_context.next = 11;
|
|
61
|
+
return (0, _ws.connect)();
|
|
62
|
+
|
|
63
|
+
case 11:
|
|
64
|
+
_context.next = 15;
|
|
65
|
+
break;
|
|
66
|
+
|
|
67
|
+
case 13:
|
|
68
|
+
_context.prev = 13;
|
|
69
|
+
_context.t0 = _context['catch'](8);
|
|
70
|
+
|
|
71
|
+
case 15:
|
|
72
|
+
_context.next = 17;
|
|
73
|
+
return (0, _ws.req)('yk0/func/clientIp');
|
|
74
|
+
|
|
75
|
+
case 17:
|
|
76
|
+
return _context.abrupt('return', _context.sent);
|
|
77
|
+
|
|
78
|
+
case 18:
|
|
79
|
+
case 'end':
|
|
80
|
+
return _context.stop();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, _callee, undefined, [[8, 13]]);
|
|
84
|
+
})));
|
|
85
|
+
|
|
86
|
+
case 2:
|
|
87
|
+
case 'end':
|
|
88
|
+
return _context2.stop();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, _callee2, undefined);
|
|
92
|
+
}));
|
|
93
|
+
|
|
94
|
+
return function clientIp(_x) {
|
|
95
|
+
return _ref2.apply(this, arguments);
|
|
96
|
+
};
|
|
97
|
+
}();
|