yakuza0 2.22.30-beta.3 → 2.22.30-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.22.30-beta.3",
3
+ "version": "2.22.30-beta.4",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,6 +4,18 @@ 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) => {
8
+ if (obj && typeof obj !== "string") {
9
+ try {
10
+ return JSON.stringify(obj);
11
+ } catch (e) {
12
+ return obj
13
+ }
14
+ }
15
+
16
+ return obj
17
+ }
18
+
7
19
  export default async (ctx, inject) => {
8
20
  const { $http, $utils, $yk } = ctx;
9
21
  const event = {
@@ -51,7 +63,7 @@ export default async (ctx, inject) => {
51
63
  })
52
64
 
53
65
  if ($yk.security.stupid) {
54
- return shtml(result && result.data);
66
+ return shtml(oToStr(result && result.data));
55
67
  }
56
68
 
57
69
  return result && result.data
@@ -108,7 +120,7 @@ export default async (ctx, inject) => {
108
120
  })
109
121
 
110
122
  if ($yk.security.stupid) {
111
- return shtml(data);
123
+ return shtml(oToStr(data));
112
124
  }
113
125
 
114
126
  return data;