xzwebx-httpfilter 1.1.5 → 1.2.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/HttpFilter.js +353 -0
- package/package.json +1 -1
- package/HttpFilter.bytecode +0 -0
- package/hook-require.js +0 -16
- package/loader.js +0 -71
- package/make-require.js +0 -32
- package/xzwebx-httpfilter.js +0 -20
package/HttpFilter.js
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
const Fs = require('fs')
|
|
2
|
+
const Util = require("util")
|
|
3
|
+
const Path = require('path')
|
|
4
|
+
const Crypto = require('crypto')
|
|
5
|
+
|
|
6
|
+
let ResultCodeMap = {}
|
|
7
|
+
let TipsMap = {}
|
|
8
|
+
let ModuleMap = {}
|
|
9
|
+
let ModuleInterfaceMap = {}
|
|
10
|
+
let FieldMap = {}
|
|
11
|
+
|
|
12
|
+
function decrypt(sign, key, iv) {
|
|
13
|
+
let src = ''
|
|
14
|
+
const cipher = Crypto.createDecipheriv('aes-128-cbc', 'uY4576jBeHGi5ElK', 'Kue76RJhg24WjVet')
|
|
15
|
+
src += cipher.update(sign, 'hex', 'utf8')
|
|
16
|
+
src += cipher.final('utf8')
|
|
17
|
+
return src
|
|
18
|
+
}
|
|
19
|
+
async function response(req, res, next) {
|
|
20
|
+
let retData = {
|
|
21
|
+
codeKey: 'SYSTEM_ERR',
|
|
22
|
+
data: []
|
|
23
|
+
}
|
|
24
|
+
retData.codeKey = 'SUCCESS'
|
|
25
|
+
return res.send(res.Msg(retData))
|
|
26
|
+
}
|
|
27
|
+
function Init(language, resultCodeMap, tipsMap, moduleMap, moduleInterfaceMap, fieldMap) {
|
|
28
|
+
ResultCodeMap = resultCodeMap
|
|
29
|
+
TipsMap = tipsMap[language]
|
|
30
|
+
ModuleMap = moduleMap
|
|
31
|
+
ModuleInterfaceMap = moduleInterfaceMap
|
|
32
|
+
FieldMap = fieldMap
|
|
33
|
+
}
|
|
34
|
+
function MSG(params) {
|
|
35
|
+
let code = ''
|
|
36
|
+
if (ResultCodeMap[params.codeKey]) {
|
|
37
|
+
code = ResultCodeMap[params.codeKey].rstCode
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let msg = ''
|
|
41
|
+
if (!params.msg) {
|
|
42
|
+
if (TipsMap[params.codeKey]) {
|
|
43
|
+
msg = TipsMap[params.codeKey].tips
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
} else {
|
|
47
|
+
if (typeof params.msg == 'string') {
|
|
48
|
+
msg = params.msg
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof params.msg == 'object' && params.msg.length) {
|
|
52
|
+
if (TipsMap[params.msg[0]]) {
|
|
53
|
+
msg = TipsMap[params.msg[0]].tips
|
|
54
|
+
if (params.msg.length > 1) {
|
|
55
|
+
for (let i = 1; i < params.msg.length; i++) {
|
|
56
|
+
msg = Util.format(msg, params.msg[i])
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
msg = params.msg[0]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
code: code,
|
|
67
|
+
msg: msg,
|
|
68
|
+
data: params.data
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function SetRoutes(app, express, projectPath) {
|
|
72
|
+
for (let uri in ModuleMap) {
|
|
73
|
+
let module = ModuleMap[uri]
|
|
74
|
+
let router = express.Router()
|
|
75
|
+
let ModuleHandle = null
|
|
76
|
+
for (let subUri in ModuleInterfaceMap[module.id]) {
|
|
77
|
+
for (let method in ModuleInterfaceMap[module.id][subUri]) {
|
|
78
|
+
let api = ModuleInterfaceMap[module.id][subUri][method]
|
|
79
|
+
let dirname = Path.join(projectPath, '/impls/' + module.filePath + '.js')
|
|
80
|
+
if (Fs.existsSync(dirname)) {
|
|
81
|
+
ModuleHandle = require(dirname)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (subUri[0] != '/') {
|
|
85
|
+
subUri = '/' + subUri
|
|
86
|
+
}
|
|
87
|
+
router[method.toLowerCase()](subUri, ModuleHandle && ModuleHandle[api.moduleFun]? ModuleHandle[api.moduleFun]: response)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (ModuleMap[uri].uri[0] != '/') {
|
|
91
|
+
ModuleMap[uri].uri = '/' + ModuleMap[uri].uri
|
|
92
|
+
}
|
|
93
|
+
app.use(ModuleMap[uri].uri, router)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function CheckReq(req, res, next) {
|
|
97
|
+
res.Msg = MSG
|
|
98
|
+
const baseUrlList = req.url.split('/')
|
|
99
|
+
const subUri = baseUrlList[baseUrlList.length - 1]
|
|
100
|
+
let baseUrl = ''
|
|
101
|
+
for (let idx in baseUrlList) {
|
|
102
|
+
if (idx == baseUrlList.length - 1) {
|
|
103
|
+
break
|
|
104
|
+
}
|
|
105
|
+
if (baseUrlList[idx]) {
|
|
106
|
+
baseUrl += '/' + baseUrlList[idx]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const module = ModuleMap[baseUrl]
|
|
111
|
+
if (!module) {
|
|
112
|
+
return res.send(res.Msg({codeKey: 'SYSTEM_TIPS', msg: ['ERR_URL']}))
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (!ModuleInterfaceMap[module.id] ||
|
|
116
|
+
!ModuleInterfaceMap[module.id][subUri] ||
|
|
117
|
+
!ModuleInterfaceMap[module.id][subUri][req.method.toLowerCase()]) {
|
|
118
|
+
return res.send(res.Msg({codeKey: 'SYSTEM_TIPS', msg: ['ERR_URL']}))
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
req.headers['interfaceInfo'] = ModuleInterfaceMap[module.id][subUri][req.method.toLowerCase()]
|
|
122
|
+
let reqMsgId = ModuleInterfaceMap[module.id][subUri][req.method.toLowerCase()].reqMsgId
|
|
123
|
+
if (!reqMsgId) {
|
|
124
|
+
return next()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
let retMsgData = cycleCheckParams(FieldMap[reqMsgId], req.body)
|
|
128
|
+
if (retMsgData) {
|
|
129
|
+
return res.send(res.Msg({codeKey: 'SYSTEM_TIPS', msg: retMsgData}))
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return next()
|
|
133
|
+
}
|
|
134
|
+
function cycleCheckParams(msgFieldMap, data) {
|
|
135
|
+
let retMsgData = null
|
|
136
|
+
if (!msgFieldMap ||
|
|
137
|
+
!msgFieldMap['__FieldCfg'] ||
|
|
138
|
+
!msgFieldMap['__FieldCfg'].ifMust) {
|
|
139
|
+
return null
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
for (let fieldName in msgFieldMap) {
|
|
143
|
+
let fCfgItem = msgFieldMap[fieldName]
|
|
144
|
+
if (fieldName == '__FieldCfg') {
|
|
145
|
+
if (fCfgItem.ifMust == 'NO' && (data == undefined || data == null || data == '' || (typeof data === 'object' && !data.length && !Object.keys(data).length))) {
|
|
146
|
+
return null
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let retMsgData = ''
|
|
150
|
+
if (fCfgItem.fieldType == 'STR') {
|
|
151
|
+
retMsgData = IsStringOk(fCfgItem, data)
|
|
152
|
+
} else if (fCfgItem.fieldType == 'INT') {
|
|
153
|
+
retMsgData = IsIntOk(fCfgItem, data)
|
|
154
|
+
} else if (fCfgItem.fieldType == 'OBJ') {
|
|
155
|
+
retMsgData = IsObjOk(fCfgItem, data)
|
|
156
|
+
} else if (fCfgItem.fieldType == 'LIST') {
|
|
157
|
+
retMsgData = IsListOk(fCfgItem, data)
|
|
158
|
+
}
|
|
159
|
+
if (retMsgData) {
|
|
160
|
+
return retMsgData
|
|
161
|
+
}
|
|
162
|
+
continue
|
|
163
|
+
}
|
|
164
|
+
let fatherFieldType = msgFieldMap['__FieldCfg'].fieldType
|
|
165
|
+
if (fatherFieldType == 'LIST' || (fatherFieldType == 'OBJ' && msgFieldMap['__FieldCfg'].keyType == 'VOBJ')) {
|
|
166
|
+
for (let idx in data) {
|
|
167
|
+
retMsgData = cycleCheckParams(fCfgItem, data[idx])
|
|
168
|
+
if (retMsgData) {
|
|
169
|
+
return retMsgData
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
retMsgData = cycleCheckParams(fCfgItem, data[fieldName])
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (retMsgData) {
|
|
177
|
+
return retMsgData
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return null
|
|
181
|
+
}
|
|
182
|
+
function IsStringOk(fCfgItem, paramValue) {
|
|
183
|
+
if (!paramValue) {
|
|
184
|
+
return ['NULL_STR_FIELD', fCfgItem.fieldUrl]
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (typeof paramValue != 'string') {
|
|
188
|
+
return ['NOT_STR_VALUE', fCfgItem.fieldUrl]
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
for (let idx in fCfgItem.rules) {
|
|
192
|
+
let rule = fCfgItem.rules[idx]
|
|
193
|
+
if (rule.checkType == 'RANGE') {
|
|
194
|
+
let isPass = false
|
|
195
|
+
if (typeof rule.exprVal[0] == 'object') {
|
|
196
|
+
for (let i in rule.exprVal) {
|
|
197
|
+
if (paramValue.length >= parseInt(rule.exprVal[i][0]) && paramValue.length <= parseInt(rule.exprVal[i][1])) {
|
|
198
|
+
isPass = true
|
|
199
|
+
break
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
if (parseInt(rule.exprVal[0]) <= paramValue.length && parseInt(rule.exprVal[1]) >= paramValue.length) {
|
|
204
|
+
isPass = true
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (!isPass) {
|
|
209
|
+
return ['WRONG_STR_RANGE', fCfgItem.fieldUrl, JSON.stringify(rule.exprVal)]
|
|
210
|
+
}
|
|
211
|
+
} else if (rule.checkType == 'ENU') {
|
|
212
|
+
if (rule.isCaseSensitive == 1) {
|
|
213
|
+
if (rule.exprVal && rule.exprVal.length && !rule.exprVal.includes(paramValue)) {
|
|
214
|
+
return ['WRONG_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
|
|
215
|
+
}
|
|
216
|
+
} else {
|
|
217
|
+
let isPass = false
|
|
218
|
+
for (let k in rule.exprVal) {
|
|
219
|
+
if (rule.exprVal[k].toUpperCase() == paramValue.toUpperCase()) {
|
|
220
|
+
isPass = true
|
|
221
|
+
break
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (!isPass) {
|
|
225
|
+
return ['WRONG_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
} else if (rule.checkType == 'REGEX') {
|
|
229
|
+
let isPass = false
|
|
230
|
+
let exprVal = rule.exprVal + ''
|
|
231
|
+
for (let i in rule.exprVal) {
|
|
232
|
+
let reg = eval(rule.exprVal[i])
|
|
233
|
+
let found = reg.test(paramValue)
|
|
234
|
+
if (rule.matchType == 'AND') {
|
|
235
|
+
if (!found) {
|
|
236
|
+
exprVal = rule.exprVal[i] + ''
|
|
237
|
+
break
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
if (found) {
|
|
241
|
+
isPass = true
|
|
242
|
+
break
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (!isPass) {
|
|
247
|
+
return ['WRONG_REGEX_VALUE', fCfgItem.fieldUrl, exprVal]
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return null
|
|
253
|
+
}
|
|
254
|
+
function IsIntOk(fCfgItem, paramValue) {
|
|
255
|
+
if (paramValue == undefined) {
|
|
256
|
+
return ['NULL_INT_FIELD', fCfgItem.fieldUrl]
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (typeof paramValue != 'number') {
|
|
260
|
+
return ['NOT_INT_VALUE', fCfgItem.fieldUrl]
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
for (let idx in fCfgItem.rules) {
|
|
264
|
+
let rule = fCfgItem.rules[idx]
|
|
265
|
+
if (rule.checkType == 'RANGE') {
|
|
266
|
+
let isPass = false
|
|
267
|
+
if (typeof rule.exprVal[0] == 'object') {
|
|
268
|
+
for (let i in rule.exprVal) {
|
|
269
|
+
if (paramValue >= +rule.exprVal[i][0] && paramValue <= +rule.exprVal[i][1]) {
|
|
270
|
+
isPass = true
|
|
271
|
+
break
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
if (+rule.exprVal[0] <= paramValue && +rule.exprVal[1] >= paramValue) {
|
|
276
|
+
isPass = true
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (!isPass) {
|
|
281
|
+
return ['WRONG_INT_RANGE', fCfgItem.fieldUrl, JSON.stringify(rule.exprVal)]
|
|
282
|
+
}
|
|
283
|
+
} else if (rule.checkType == 'ENU') {
|
|
284
|
+
if (rule.exprVal && rule.exprVal.length && !rule.exprVal.includes(paramValue)) {
|
|
285
|
+
return ['WRONG_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
|
|
286
|
+
}
|
|
287
|
+
} else if (rule.checkType == 'REGEX') {
|
|
288
|
+
let isPass = false
|
|
289
|
+
let exprVal = rule.exprVal + ''
|
|
290
|
+
for (let i in rule.exprVal) {
|
|
291
|
+
let reg = eval(rule.exprVal[i])
|
|
292
|
+
let found = reg.test(paramValue + '')
|
|
293
|
+
if (rule.matchType == 'AND') {
|
|
294
|
+
if (!found) {
|
|
295
|
+
exprVal = rule.exprVal[i] + ''
|
|
296
|
+
break
|
|
297
|
+
}
|
|
298
|
+
} else {
|
|
299
|
+
if (found) {
|
|
300
|
+
isPass = true
|
|
301
|
+
break
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (!isPass) {
|
|
306
|
+
return ['WRONG_REGEX_VALUE', fCfgItem.fieldUrl, exprVal]
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
return null
|
|
312
|
+
}
|
|
313
|
+
function IsObjOk(fCfgItem, paramValue) {
|
|
314
|
+
if (!paramValue) {
|
|
315
|
+
return ['NULL_FIELD', fCfgItem.fieldUrl]
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (paramValue.constructor != Object) {
|
|
319
|
+
return ['WRONG_OBJ_VALUE', fCfgItem.fieldUrl]
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (!Object.keys(paramValue).length) {
|
|
323
|
+
return ['NULL_VALUE', fCfgItem.fieldUrl]
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return null
|
|
327
|
+
}
|
|
328
|
+
function IsListOk(fCfgItem, paramValue) {
|
|
329
|
+
if (!paramValue) {
|
|
330
|
+
return ['NULL_FIELD', fCfgItem.fieldUrl]
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (paramValue.constructor != Array) {
|
|
334
|
+
return ['WRONG_LIST_VALUE', fCfgItem.fieldUrl]
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (!paramValue.length) {
|
|
338
|
+
return ['NULL_VALUE', fCfgItem.fieldUrl]
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return null
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function SetMsg(req, res, next) {
|
|
345
|
+
res.Msg = MSG
|
|
346
|
+
return next()
|
|
347
|
+
}
|
|
348
|
+
module.exports = {
|
|
349
|
+
Init: Init,
|
|
350
|
+
SetRoutes: SetRoutes,
|
|
351
|
+
CheckReq: CheckReq,
|
|
352
|
+
SetMsg: SetMsg,
|
|
353
|
+
}
|
package/package.json
CHANGED
package/HttpFilter.bytecode
DELETED
|
Binary file
|
package/hook-require.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const _module = require('module')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
const makeRequire = require('./make-require')
|
|
4
|
-
const { loadBytecode } = require('./loader')
|
|
5
|
-
|
|
6
|
-
_module._extensions['.bytecode'] = function (module, filename) {
|
|
7
|
-
const script = loadBytecode(filename, false);
|
|
8
|
-
const wrapperFn = script.runInThisContext({
|
|
9
|
-
filename: filename,
|
|
10
|
-
displayErrors: true,
|
|
11
|
-
lineOffset: 0,
|
|
12
|
-
columnOffset: 0,
|
|
13
|
-
})
|
|
14
|
-
const require = makeRequire(module)
|
|
15
|
-
wrapperFn.bind(module.exports)(module.exports, require, module, filename, path.dirname(filename))
|
|
16
|
-
}
|
package/loader.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const vm = require('vm')
|
|
3
|
-
const v8 = require('v8')
|
|
4
|
-
v8.setFlagsFromString('--no-flush-bytecode')
|
|
5
|
-
|
|
6
|
-
const HeaderOffsetMap = {
|
|
7
|
-
'magic': 0,
|
|
8
|
-
'version_hash': 4,
|
|
9
|
-
'source_hash': 8,
|
|
10
|
-
'flag_hash': 12
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
let _flag_buf
|
|
14
|
-
|
|
15
|
-
function getFlagBuf() {
|
|
16
|
-
if (!_flag_buf) {
|
|
17
|
-
const script = new vm.Script("")
|
|
18
|
-
_flag_buf = getHeader(script.createCachedData(), 'flag_hash')
|
|
19
|
-
}
|
|
20
|
-
return _flag_buf
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function getHeader(buffer, type) {
|
|
24
|
-
const offset = HeaderOffsetMap[type]
|
|
25
|
-
return buffer.slice(offset, offset + 4)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function setHeader(buffer, type, vBuffer) {
|
|
29
|
-
vBuffer.copy(buffer, HeaderOffsetMap[type])
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function buf2num(buf) {
|
|
33
|
-
let ret = 0
|
|
34
|
-
ret |= buf[3] << 24
|
|
35
|
-
ret |= buf[2] << 16
|
|
36
|
-
ret |= buf[1] << 8
|
|
37
|
-
ret |= buf[0]
|
|
38
|
-
|
|
39
|
-
return ret
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function loadBytecode(filePath) {
|
|
43
|
-
const bytecode = fs.readFileSync(filePath, null)
|
|
44
|
-
|
|
45
|
-
setHeader(bytecode, 'flag_hash', getFlagBuf())
|
|
46
|
-
|
|
47
|
-
const sourceHash = buf2num(getHeader(bytecode, 'source_hash'))
|
|
48
|
-
const script = new vm.Script(' '.repeat(sourceHash), {
|
|
49
|
-
filename: filePath,
|
|
50
|
-
cachedData: bytecode,
|
|
51
|
-
lineOffset: 0,
|
|
52
|
-
displayErrors: true
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
if (script.cachedDataRejected) {
|
|
56
|
-
throw new Error('something is wrong')
|
|
57
|
-
}
|
|
58
|
-
return script
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (process.mainModule && process.mainModule.filename === __filename) {
|
|
62
|
-
const scirpt = loadBytecode(process.argv[2])
|
|
63
|
-
scirpt.runInThisContext({
|
|
64
|
-
filename: process.argv[2],
|
|
65
|
-
displayErrors: true,
|
|
66
|
-
lineOffset: 0,
|
|
67
|
-
columnOffset: 0,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
module.exports.loadBytecode = loadBytecode
|
package/make-require.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
function validateString(value, name) {
|
|
2
|
-
if (typeof value !== 'string') {
|
|
3
|
-
throw new Error(`${name} is not string`)
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function makeRequireFunction(mod) {
|
|
8
|
-
// see node.js lib/internal/modules/cjs/helpers.js
|
|
9
|
-
const Module = mod.constructor
|
|
10
|
-
|
|
11
|
-
const require = function require(path) {
|
|
12
|
-
return mod.require(path)
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
require.resolve = function resolve(request, options) {
|
|
16
|
-
validateString(request, 'request')
|
|
17
|
-
return Module._resolveFilename(request, mod, false, options)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
require.resolve.paths = function paths(request) {
|
|
21
|
-
validateString(request, 'request')
|
|
22
|
-
return Module._resolveLookupPaths(request, mod)
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
require.main = process.mainModule
|
|
26
|
-
require.extensions = Module._extensions
|
|
27
|
-
require.cache = Module._cache
|
|
28
|
-
|
|
29
|
-
return require
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
module.exports = makeRequireFunction
|
package/xzwebx-httpfilter.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
require('./hook-require')
|
|
2
|
-
const HttpFilter = require('./HttpFilter.bytecode')
|
|
3
|
-
|
|
4
|
-
const H = {}
|
|
5
|
-
H.Init = function(language, data1, data2, data3, data4, data5) {
|
|
6
|
-
HttpFilter.Init(language, data1, data2, data3, data4, data5)
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
H.SetRoutes = function (app, express, projectPath) {
|
|
10
|
-
HttpFilter.SetRoutes(app, express, projectPath)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
H.CheckReq = function (req, res, next) {
|
|
14
|
-
HttpFilter.CheckReq(req, res, next)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
H.SetMsg = function (req, res, next) {
|
|
18
|
-
HttpFilter.SetMsg(req, res, next)
|
|
19
|
-
}
|
|
20
|
-
module.exports = H
|