@lark-apaas/fullstack-nestjs-core 1.1.12-alpha.3 → 1.1.12-alpha.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/dist/index.cjs +13 -18
- package/dist/index.js +13 -18
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -172,43 +172,38 @@ var import_common3 = require("@nestjs/common");
|
|
|
172
172
|
var import_nestjs_common = require("@lark-apaas/nestjs-common");
|
|
173
173
|
|
|
174
174
|
// src/utils/safe-stringify.ts
|
|
175
|
-
function
|
|
176
|
-
const json = JSON.stringify(obj);
|
|
177
|
-
return safeEscape(json);
|
|
178
|
-
}
|
|
179
|
-
__name(safeStringify, "safeStringify");
|
|
180
|
-
function safeEscape(s) {
|
|
175
|
+
function normalEscape(s) {
|
|
181
176
|
return s.replace(/[<>&='\u2028\u2029]/g, function(c) {
|
|
182
177
|
switch (c.charCodeAt(0)) {
|
|
183
178
|
case 60:
|
|
184
|
-
return "
|
|
179
|
+
return "<";
|
|
185
180
|
// <
|
|
186
181
|
case 62:
|
|
187
|
-
return "
|
|
182
|
+
return ">";
|
|
188
183
|
// >
|
|
189
184
|
case 38:
|
|
190
|
-
return "
|
|
185
|
+
return "&";
|
|
191
186
|
// &
|
|
192
187
|
case 61:
|
|
193
|
-
return "
|
|
188
|
+
return "=";
|
|
194
189
|
// =
|
|
195
190
|
case 39:
|
|
196
|
-
return "
|
|
191
|
+
return "'";
|
|
197
192
|
// '
|
|
198
193
|
// 正常来说用户无法输入这几个字符, 现代浏览器也修复了这个问题
|
|
199
194
|
// https://zhuanlan.zhihu.com/p/29958439
|
|
200
195
|
case 8232:
|
|
201
|
-
return "
|
|
196
|
+
return "\u2028";
|
|
202
197
|
// 行分隔符
|
|
203
198
|
case 8233:
|
|
204
|
-
return "
|
|
199
|
+
return "\u2029";
|
|
205
200
|
// 段落分隔符
|
|
206
201
|
default:
|
|
207
202
|
return c;
|
|
208
203
|
}
|
|
209
204
|
});
|
|
210
205
|
}
|
|
211
|
-
__name(
|
|
206
|
+
__name(normalEscape, "normalEscape");
|
|
212
207
|
|
|
213
208
|
// src/middlewares/view-context/index.ts
|
|
214
209
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
@@ -266,9 +261,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
266
261
|
csrfToken: csrfToken ?? "",
|
|
267
262
|
userId: userId ?? "",
|
|
268
263
|
appId: appId ?? "",
|
|
269
|
-
appName:
|
|
264
|
+
appName: normalEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
270
265
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
271
|
-
appDescription:
|
|
266
|
+
appDescription: normalEscape(appInfo?.app_description ?? ""),
|
|
272
267
|
tenantId
|
|
273
268
|
};
|
|
274
269
|
res.locals = {
|
|
@@ -277,9 +272,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
277
272
|
userId: userId ?? "",
|
|
278
273
|
tenantId: tenantId ?? "",
|
|
279
274
|
appId: appId ?? "",
|
|
280
|
-
appName:
|
|
275
|
+
appName: normalEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
281
276
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
282
|
-
appDescription:
|
|
277
|
+
appDescription: normalEscape(appInfo?.app_description ?? "")
|
|
283
278
|
};
|
|
284
279
|
next();
|
|
285
280
|
}
|
package/dist/index.js
CHANGED
|
@@ -130,43 +130,38 @@ import { Inject, Injectable as Injectable3, Logger } from "@nestjs/common";
|
|
|
130
130
|
import { PLATFORM_HTTP_CLIENT } from "@lark-apaas/nestjs-common";
|
|
131
131
|
|
|
132
132
|
// src/utils/safe-stringify.ts
|
|
133
|
-
function
|
|
134
|
-
const json = JSON.stringify(obj);
|
|
135
|
-
return safeEscape(json);
|
|
136
|
-
}
|
|
137
|
-
__name(safeStringify, "safeStringify");
|
|
138
|
-
function safeEscape(s) {
|
|
133
|
+
function normalEscape(s) {
|
|
139
134
|
return s.replace(/[<>&='\u2028\u2029]/g, function(c) {
|
|
140
135
|
switch (c.charCodeAt(0)) {
|
|
141
136
|
case 60:
|
|
142
|
-
return "
|
|
137
|
+
return "<";
|
|
143
138
|
// <
|
|
144
139
|
case 62:
|
|
145
|
-
return "
|
|
140
|
+
return ">";
|
|
146
141
|
// >
|
|
147
142
|
case 38:
|
|
148
|
-
return "
|
|
143
|
+
return "&";
|
|
149
144
|
// &
|
|
150
145
|
case 61:
|
|
151
|
-
return "
|
|
146
|
+
return "=";
|
|
152
147
|
// =
|
|
153
148
|
case 39:
|
|
154
|
-
return "
|
|
149
|
+
return "'";
|
|
155
150
|
// '
|
|
156
151
|
// 正常来说用户无法输入这几个字符, 现代浏览器也修复了这个问题
|
|
157
152
|
// https://zhuanlan.zhihu.com/p/29958439
|
|
158
153
|
case 8232:
|
|
159
|
-
return "
|
|
154
|
+
return "\u2028";
|
|
160
155
|
// 行分隔符
|
|
161
156
|
case 8233:
|
|
162
|
-
return "
|
|
157
|
+
return "\u2029";
|
|
163
158
|
// 段落分隔符
|
|
164
159
|
default:
|
|
165
160
|
return c;
|
|
166
161
|
}
|
|
167
162
|
});
|
|
168
163
|
}
|
|
169
|
-
__name(
|
|
164
|
+
__name(normalEscape, "normalEscape");
|
|
170
165
|
|
|
171
166
|
// src/middlewares/view-context/index.ts
|
|
172
167
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
@@ -224,9 +219,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
224
219
|
csrfToken: csrfToken ?? "",
|
|
225
220
|
userId: userId ?? "",
|
|
226
221
|
appId: appId ?? "",
|
|
227
|
-
appName:
|
|
222
|
+
appName: normalEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
228
223
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
229
|
-
appDescription:
|
|
224
|
+
appDescription: normalEscape(appInfo?.app_description ?? ""),
|
|
230
225
|
tenantId
|
|
231
226
|
};
|
|
232
227
|
res.locals = {
|
|
@@ -235,9 +230,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
235
230
|
userId: userId ?? "",
|
|
236
231
|
tenantId: tenantId ?? "",
|
|
237
232
|
appId: appId ?? "",
|
|
238
|
-
appName:
|
|
233
|
+
appName: normalEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
239
234
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
240
|
-
appDescription:
|
|
235
|
+
appDescription: normalEscape(appInfo?.app_description ?? "")
|
|
241
236
|
};
|
|
242
237
|
next();
|
|
243
238
|
}
|