yakuza0 2.23.26-beta.2 → 2.23.26-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.23.26-beta.2",
3
+ "version": "2.23.26-beta.4",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -179,13 +179,13 @@ var ssrReqAllow = function ssrReqAllow(ctx) {
179
179
  var ddos = {};
180
180
 
181
181
  exports.default = function () {
182
- var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(_ref2) {
182
+ var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14(_ref2) {
183
183
  var app = _ref2.app,
184
184
  config = _ref2.config;
185
185
  var cspConnectSrcVerify, appCp, appCpApiV1, jwtVerC, omConf, helmetOptions, cm;
186
- return _regenerator2.default.wrap(function _callee13$(_context13) {
186
+ return _regenerator2.default.wrap(function _callee14$(_context14) {
187
187
  while (1) {
188
- switch (_context13.prev = _context13.next) {
188
+ switch (_context14.prev = _context14.next) {
189
189
  case 0:
190
190
  // if (yConf.security.isTire) {
191
191
  // const proxy = httpProxy.createServer({
@@ -850,6 +850,40 @@ exports.default = function () {
850
850
 
851
851
  app.use((0, _koaCompress2.default)(_config2.default.server.compress));
852
852
 
853
+ if (!_config2.default.security.isDev) {
854
+ app.use(function () {
855
+ var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx, next) {
856
+ return _regenerator2.default.wrap(function _callee10$(_context10) {
857
+ while (1) {
858
+ switch (_context10.prev = _context10.next) {
859
+ case 0:
860
+ if (!ctx.path.endsWith('.map')) {
861
+ _context10.next = 4;
862
+ break;
863
+ }
864
+
865
+ ctx.status = 404;
866
+ ctx.body = '';
867
+ return _context10.abrupt('return');
868
+
869
+ case 4:
870
+ _context10.next = 6;
871
+ return next();
872
+
873
+ case 6:
874
+ case 'end':
875
+ return _context10.stop();
876
+ }
877
+ }
878
+ }, _callee10, undefined);
879
+ }));
880
+
881
+ return function (_x21, _x22) {
882
+ return _ref13.apply(this, arguments);
883
+ };
884
+ }());
885
+ }
886
+
853
887
  if (_config2.default.server.cacheControl.enabled && !_config2.default.security.stupid && !_config2.default.dev) {
854
888
  app.use((0, _control2.default)((0, _extends3.default)({}, _config2.default.server.cacheControl, {
855
889
  exclude: [_config2.default.server.identity.path].concat((0, _toConsumableArray3.default)(_config2.default.server.cacheControl.exclude))
@@ -861,11 +895,11 @@ exports.default = function () {
861
895
 
862
896
  if (_config2.default.security.isStupid) {
863
897
  appCpApiV1(function () {
864
- var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx, next) {
898
+ var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(ctx, next) {
865
899
  var isNext, rHost, rOrigin, rReferer, Cookie;
866
- return _regenerator2.default.wrap(function _callee10$(_context10) {
900
+ return _regenerator2.default.wrap(function _callee11$(_context11) {
867
901
  while (1) {
868
- switch (_context10.prev = _context10.next) {
902
+ switch (_context11.prev = _context11.next) {
869
903
  case 0:
870
904
  isNext = true;
871
905
  rHost = (0, _server.jsUrl)('hostname', ctx.get('host'));
@@ -878,12 +912,12 @@ exports.default = function () {
878
912
  Cookie = _server.Cookies.koaGetCookieStr({ req: ctx.req });
879
913
 
880
914
  if (!Cookie) {
881
- _context10.next = 15;
915
+ _context11.next = 15;
882
916
  break;
883
917
  }
884
918
 
885
- _context10.prev = 7;
886
- _context10.next = 10;
919
+ _context11.prev = 7;
920
+ _context11.next = 10;
887
921
  return _universal2.default.post(_config2.default.server.orbAddr + '/apiv2/cln/verify/ck', {
888
922
  headers: {
889
923
  Cookie: Cookie
@@ -892,26 +926,26 @@ exports.default = function () {
892
926
  });
893
927
 
894
928
  case 10:
895
- _context10.next = 15;
929
+ _context11.next = 15;
896
930
  break;
897
931
 
898
932
  case 12:
899
- _context10.prev = 12;
900
- _context10.t0 = _context10['catch'](7);
933
+ _context11.prev = 12;
934
+ _context11.t0 = _context11['catch'](7);
901
935
 
902
936
  isNext = false;
903
937
 
904
938
  case 15:
905
939
  if (!isNext) {
906
- _context10.next = 20;
940
+ _context11.next = 20;
907
941
  break;
908
942
  }
909
943
 
910
- _context10.next = 18;
944
+ _context11.next = 18;
911
945
  return next();
912
946
 
913
947
  case 18:
914
- _context10.next = 21;
948
+ _context11.next = 21;
915
949
  break;
916
950
 
917
951
  case 20:
@@ -922,14 +956,14 @@ exports.default = function () {
922
956
 
923
957
  case 21:
924
958
  case 'end':
925
- return _context10.stop();
959
+ return _context11.stop();
926
960
  }
927
961
  }
928
- }, _callee10, undefined, [[7, 12]]);
962
+ }, _callee11, undefined, [[7, 12]]);
929
963
  }));
930
964
 
931
- return function (_x21, _x22) {
932
- return _ref13.apply(this, arguments);
965
+ return function (_x23, _x24) {
966
+ return _ref14.apply(this, arguments);
933
967
  };
934
968
  }()
935
969
  // if (ctx.method === 'GET' || ctx.method === 'POST' || jwtVerC(ctx.path)) {
@@ -943,29 +977,29 @@ exports.default = function () {
943
977
  );
944
978
 
945
979
  app.use(function () {
946
- var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(ctx, next) {
947
- return _regenerator2.default.wrap(function _callee11$(_context11) {
980
+ var _ref15 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(ctx, next) {
981
+ return _regenerator2.default.wrap(function _callee12$(_context12) {
948
982
  while (1) {
949
- switch (_context11.prev = _context11.next) {
983
+ switch (_context12.prev = _context12.next) {
950
984
  case 0:
951
985
  // ctx.set('Surrogate-Control', 'no-store');
952
986
  // ctx.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
953
987
  // ctx.set('Pragma', 'no-cache');
954
988
  // ctx.set('Expires', '0');
955
989
  (0, _control.noCache)(ctx);
956
- _context11.next = 3;
990
+ _context12.next = 3;
957
991
  return next();
958
992
 
959
993
  case 3:
960
994
  case 'end':
961
- return _context11.stop();
995
+ return _context12.stop();
962
996
  }
963
997
  }
964
- }, _callee11, undefined);
998
+ }, _callee12, undefined);
965
999
  }));
966
1000
 
967
- return function (_x23, _x24) {
968
- return _ref14.apply(this, arguments);
1001
+ return function (_x25, _x26) {
1002
+ return _ref15.apply(this, arguments);
969
1003
  };
970
1004
  }());
971
1005
  }
@@ -979,10 +1013,10 @@ exports.default = function () {
979
1013
  }
980
1014
 
981
1015
  app.use(function () {
982
- var _ref15 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(ctx, next) {
983
- return _regenerator2.default.wrap(function _callee12$(_context12) {
1016
+ var _ref16 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(ctx, next) {
1017
+ return _regenerator2.default.wrap(function _callee13$(_context13) {
984
1018
  while (1) {
985
- switch (_context12.prev = _context12.next) {
1019
+ switch (_context13.prev = _context13.next) {
986
1020
  case 0:
987
1021
  // const csrfCookie = ctx.cookies.get(variable.csrfCookie, {signed: false});
988
1022
  // console.log(ctx.path, ctx.req.headers.cookie, 111);
@@ -998,28 +1032,28 @@ exports.default = function () {
998
1032
  cookieDomain: config.appConf.cookieDomain || _server.Cookies.getDefCookieDomain(ctx.hostname)
999
1033
  }, ctx.req.crossParams);
1000
1034
 
1001
- _context12.next = 3;
1035
+ _context13.next = 3;
1002
1036
  return next();
1003
1037
 
1004
1038
  case 3:
1005
1039
  case 'end':
1006
- return _context12.stop();
1040
+ return _context13.stop();
1007
1041
  }
1008
1042
  }
1009
- }, _callee12, undefined);
1043
+ }, _callee13, undefined);
1010
1044
  }));
1011
1045
 
1012
- return function (_x25, _x26) {
1013
- return _ref15.apply(this, arguments);
1046
+ return function (_x27, _x28) {
1047
+ return _ref16.apply(this, arguments);
1014
1048
  };
1015
1049
  }());
1016
1050
 
1017
- case 21:
1051
+ case 22:
1018
1052
  case 'end':
1019
- return _context13.stop();
1053
+ return _context14.stop();
1020
1054
  }
1021
1055
  }
1022
- }, _callee13, undefined);
1056
+ }, _callee14, undefined);
1023
1057
  }));
1024
1058
 
1025
1059
  return function (_x) {
@@ -55,7 +55,8 @@ export default async (ctx, inject) => {
55
55
  svcKey: appConf.svcKey,
56
56
  f5Offline: conf.server && conf.server.f5Offline,
57
57
  tfs,
58
- extendHeaders: {}
58
+ extendHeaders: {},
59
+ geo: {},
59
60
  },
60
61
  api: {v3: {}},
61
62
  encrypt: conf.security && conf.security.encrypt,
package/utils/secret.js CHANGED
@@ -177,7 +177,7 @@ var set = exports.set = function set(_ref3) {
177
177
 
178
178
  return new _promise2.default(function () {
179
179
  var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(resolve, reject) {
180
- var w, mixin, yc, hostname, spiData, clientIp, spi, spiQuery, spiSecret, parser, setUniversal, ucResC, timeout, universalBody, getUc, getSvcInSsrWithServer, getSvc;
180
+ var w, mixin, yc, hostname, spiData, clientIp, geo, spi, spiQuery, spiSecret, parser, setUniversal, ucResC, timeout, universalBody, getUc, getSvcInSsrWithServer, getSvc;
181
181
  return _regenerator2.default.wrap(function _callee9$(_context9) {
182
182
  while (1) {
183
183
  switch (_context9.prev = _context9.next) {
@@ -206,7 +206,7 @@ var set = exports.set = function set(_ref3) {
206
206
  break;
207
207
  }
208
208
 
209
- hostname = {}, spiData = {}, clientIp = {};
209
+ hostname = {}, spiData = {}, clientIp = {}, geo = {};
210
210
  spi = $yk.appConf.spi;
211
211
 
212
212
  $yk.api.v3.ready = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3() {
@@ -250,6 +250,10 @@ var set = exports.set = function set(_ref3) {
250
250
  writable: true
251
251
  });
252
252
 
253
+ _yakuza._.readOnly($yk.server, 'geo', geo, {
254
+ writable: true
255
+ });
256
+
253
257
  var result = parser.getResult();
254
258
  $yk.browser = (0, _extends3.default)({}, $yk.browser, {
255
259
  type: result.browser.name + parseInt(result.browser.version, 10)
@@ -579,6 +583,9 @@ var set = exports.set = function set(_ref3) {
579
583
  if (_yakuza._.isPlainObject(secretData.ClientIp)) {
580
584
  clientIp = secretData.ClientIp;
581
585
  }
586
+ if (_yakuza._.isPlainObject(secretData.IPGeoInfo)) {
587
+ geo = secretData.IPGeoInfo;
588
+ }
582
589
  _yakuza._.readOnly(_yakuza.global, '__enc__', secretData.Encryption === 1, {
583
590
  writable: opt.writable
584
591
  });