yakuza0 2.22.30 → 2.22.32-beta.0

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.30",
3
+ "version": "2.22.32-beta.0",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -274,7 +274,7 @@ exports.default = function () {
274
274
  // referrerPolicy: { policy: "strict-origin-when-cross-origin" },
275
275
  // referrerPolicy: yConf.stupid.referrerPolicy.policy,
276
276
  // referrerPolicy: { policy: "origin-when-crossorigin" },
277
- // referrerPolicy: yConf.server.stupid.referrerPolicy,
277
+ referrerPolicy: _config2.default.server.stupid.referrerPolicy
278
278
  // crossOriginResourcePolicy: yConf.server.hm.crossOriginEmbedderPolicy,
279
279
  // crossOriginEmbedderPolicy: true,
280
280
  // crossOriginResourcePolicy: { policy: "cross-origin" },
@@ -300,7 +300,6 @@ exports.default = function () {
300
300
  }
301
301
 
302
302
  if (_config2.default.security.isStupid) {
303
- // helmetOptions.referrerPolicy = yConf.server.stupid.referrerPolicy;
304
303
  // helmetOptions.crossOriginResourcePolicy = yConf.server.stupid.crossOriginResourcePolicy;
305
304
  }
306
305
 
@@ -418,7 +418,7 @@ exports.default = function () {
418
418
 
419
419
  app.use(basePath + "apiv1", createProxyMiddleware((0, _extends5.default)({}, baseConfig, {
420
420
  target: _config2.default.server.orbProtocol.http + "//" + _config2.default.server.orbHost + ":" + _config2.default.server.orbPort,
421
- headers: (_headers = {}, (0, _defineProperty3.default)(_headers, _def.variable.ipHeader, '127.0.0.1'), (0, _defineProperty3.default)(_headers, _def.variable.childKeyHeader, _config2.default.childKey), (0, _defineProperty3.default)(_headers, _def.variable.appCodeHeader, config.appConf.appCode), (0, _defineProperty3.default)(_headers, _def.variable.appKeyHeader, config.appKey), _headers),
421
+ headers: (_headers = {}, (0, _defineProperty3.default)(_headers, _def.variable.ipHeader, '127.0.0.1'), (0, _defineProperty3.default)(_headers, _def.variable.childKeyHeader, _config2.default.childKey), (0, _defineProperty3.default)(_headers, _def.variable.appCodeHeader, config.appConf.appCode), (0, _defineProperty3.default)(_headers, _def.variable.appKeyHeader, config.appKey), (0, _defineProperty3.default)(_headers, _def.variable.shareRuleHeader, (0, _stringify2.default)(config.shareRule)), _headers),
422
422
  pathRewrite: (0, _defineProperty3.default)({}, "^" + basePath + "apiv1", "/" + _config2.default.proxyServer.apiKey + "/" + _config2.default.name + "/client/backend")
423
423
  })));
424
424
 
@@ -432,10 +432,10 @@ exports.default = function () {
432
432
  // let clientPath = `${main}/dist/client`;
433
433
  // app.use(`/_nuxt`, express.static(clientPath))
434
434
  // app.use(`${_.bothAddFix(server.basePath, "/")}_nuxt`, express.static(clientPath))
435
-
436
435
  app.use('/', createProxyMiddleware((0, _extends5.default)({}, baseConfig, {
437
436
  target: "http://127.0.0.1:" + config.appConf.appPort,
438
437
  ws: true,
438
+ // pathRewrite: {['^/' + server.basePath + '/api-ws'] : '/api-ws'},
439
439
  onProxyRes: function onProxyRes(proxyRes, req, res) {
440
440
  var isDoc = ['text/html; charset=utf-8'].includes((proxyRes.headers['content-type'] || '').toLowerCase());
441
441
 
@@ -4,10 +4,12 @@ import {shtml} from 'yakuza1/lib/xss';
4
4
  import yConf from 'yakuza0/config';
5
5
  import {connect, req} from 'yakuza1/lib/ws';
6
6
 
7
- const oToStr = (obj) => {
7
+ const shtmlFilterGet = (obj, options) => {
8
8
  if (obj && typeof obj !== "string") {
9
9
  try {
10
- return JSON.stringify(obj);
10
+ const str = JSON.stringify(obj);
11
+ const filter = shtml(str, options);
12
+ return JSON.parse(filter)
11
13
  } catch (e) {
12
14
  return obj
13
15
  }
@@ -16,6 +18,18 @@ const oToStr = (obj) => {
16
18
  return obj
17
19
  }
18
20
 
21
+ const shtmlFilterSet = (obj, options) => {
22
+ if (obj && typeof obj !== "string") {
23
+ try {
24
+ obj = JSON.stringify(obj);
25
+ } catch (e) {
26
+ return obj
27
+ }
28
+ }
29
+
30
+ return shtml(obj, options);
31
+ }
32
+
19
33
  export default async (ctx, inject) => {
20
34
  const { $http, $utils, $yk } = ctx;
21
35
  const event = {
@@ -40,7 +54,7 @@ export default async (ctx, inject) => {
40
54
  [key, data] = args;
41
55
  break;
42
56
  }
43
- data = shtml(data, options);
57
+ data = shtmlFilterSet(data, options);
44
58
 
45
59
  const result = await $http.post('$/feapiv1/storage/set', {
46
60
  key,
@@ -63,7 +77,7 @@ export default async (ctx, inject) => {
63
77
  })
64
78
 
65
79
  if ($yk.security.stupid) {
66
- return shtml(oToStr(result && result.data));
80
+ return shtmlFilterGet(result && result.data, options);
67
81
  }
68
82
 
69
83
  return result && result.data
@@ -100,7 +114,7 @@ export default async (ctx, inject) => {
100
114
  break;
101
115
  }
102
116
 
103
- data = shtml(data, options);
117
+ data = shtmlFilterSet(data, options);
104
118
 
105
119
  return await req('storage/set', {
106
120
  body: {
@@ -120,7 +134,7 @@ export default async (ctx, inject) => {
120
134
  })
121
135
 
122
136
  if ($yk.security.stupid) {
123
- return shtml(oToStr(data));
137
+ return shtmlFilterGet(data, options);
124
138
  }
125
139
 
126
140
  return data;