@yorha2b-lab/autodev 3.1.2 → 3.1.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/config.js +1 -1
- package/package.json +1 -1
- package/src/core/react-compiler.js +2 -1
- package/src/services/proxy-tower.js +43 -45
package/config.js
CHANGED
package/package.json
CHANGED
|
@@ -46,6 +46,7 @@ const index = ({ config, fileName, indexTpl, pageConfig }) => {
|
|
|
46
46
|
const hasTabs = pageConfig.tabs?.length > 0
|
|
47
47
|
const hasFormItems = pageConfig.formItems?.length > 0
|
|
48
48
|
const hasOperate = pageConfig.table.operation?.length > 0
|
|
49
|
+
const pageStruct = pageConfig.pageStruct?.filter(item => item.toLowerCase() !== 'tabs') || []
|
|
49
50
|
const functionButtons = pageConfig.functionButton?.filter(item => !['查询', '重置'].includes(item.btn)) || []
|
|
50
51
|
const hasFunctionButtons = functionButtons.length > 0
|
|
51
52
|
|
|
@@ -69,7 +70,7 @@ const index = ({ config, fileName, indexTpl, pageConfig }) => {
|
|
|
69
70
|
operations: pageConfig.table.operation || [],
|
|
70
71
|
hasRowSelection: pageConfig.table.rowSelection,
|
|
71
72
|
formItems: hasFormItems ? (hasTabs ? 'formItems[activeKey]' : 'formItems') : '[]',
|
|
72
|
-
pageStruct: hasFunctionButtons ?
|
|
73
|
+
pageStruct: hasFunctionButtons ? pageStruct : pageStruct.filter(item => item !== 'FunctionButtonsBlock'),
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
if (viewData.hasOperate) {
|
|
@@ -24,57 +24,55 @@ module.exports = () => {
|
|
|
24
24
|
return Object.keys(Array.isArray(obj) ? (obj[0] || {}) : obj).sort().join(',')
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
// 💡 物理监控:劫持响应流
|
|
28
|
+
proxy.on('proxyRes', function (proxyRes, req, res) {
|
|
29
|
+
let body = []
|
|
30
|
+
proxyRes.on('data', chunk => body.push(chunk))
|
|
31
|
+
proxyRes.on('end', async () => {
|
|
32
|
+
const buffer = Buffer.concat(body)
|
|
33
|
+
const encoding = proxyRes.headers['content-encoding']
|
|
34
|
+
try {
|
|
35
|
+
const rawBody = encoding === 'gzip' ? zlib.gunzipSync(buffer) : buffer
|
|
36
|
+
const json = JSON.parse(rawBody.toString())
|
|
37
|
+
|
|
38
|
+
const coreData = unwrapSignal(json) // 先脱水
|
|
39
|
+
|
|
40
|
+
// 💡 这一步就是地堡的“火控系统”
|
|
41
|
+
if (!isQuerySignal(req, json, coreData)) {
|
|
42
|
+
return // 增删改信号,直接丢弃,保持静默
|
|
43
|
+
}
|
|
28
44
|
|
|
29
|
-
|
|
45
|
+
const referer = req.headers.referer || ''
|
|
46
|
+
const fileName = referer.split('?')[0].split('/').filter(Boolean).at(-1)
|
|
47
|
+
|
|
48
|
+
const fingerprint = getJsonFingerprint(unwrapSignal(json)) // 获取数据指纹
|
|
49
|
+
const lastFingerprint = hackedRegistry.get(fileName)
|
|
50
|
+
|
|
51
|
+
// 如果指纹没变,说明字段结构是一样的,无需再次骇入
|
|
52
|
+
if (lastFingerprint === fingerprint) {
|
|
53
|
+
return
|
|
54
|
+
}
|
|
30
55
|
|
|
56
|
+
console.log(chalk.cyan(language(
|
|
57
|
+
`\n📡 Pod 153: 截获运行时信号 [${fileName}]。执行自动对齐协议...`,
|
|
58
|
+
`\n📡 Pod 153: Captured runtime signal [${fileName}]. Executing semantic alignment protocol...`
|
|
59
|
+
)))
|
|
60
|
+
// 💡 直接调用 api-handler 物理更新 resource.js
|
|
61
|
+
await apiHandler(null, { fileName, data: json })
|
|
62
|
+
hackedRegistry.set(fileName, fingerprint)
|
|
63
|
+
} catch (e) {
|
|
64
|
+
console.log(e)
|
|
65
|
+
// 非 JSON 信号,保持静默
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const server = http.createServer((req, res) => {
|
|
71
|
+
const target = config.proxyTarget
|
|
31
72
|
if (!target) {
|
|
32
73
|
// 静默模式:如果不配置 proxyTarget,拦截塔只转发不处理(或报错提示)
|
|
33
74
|
return
|
|
34
75
|
}
|
|
35
|
-
|
|
36
|
-
// 💡 物理监控:劫持响应流
|
|
37
|
-
proxy.on('proxyRes', function (proxyRes, req, res) {
|
|
38
|
-
let body = []
|
|
39
|
-
proxyRes.on('data', chunk => body.push(chunk))
|
|
40
|
-
proxyRes.on('end', async () => {
|
|
41
|
-
const buffer = Buffer.concat(body)
|
|
42
|
-
const encoding = proxyRes.headers['content-encoding']
|
|
43
|
-
try {
|
|
44
|
-
const rawBody = encoding === 'gzip' ? zlib.gunzipSync(buffer) : buffer
|
|
45
|
-
const json = JSON.parse(rawBody.toString())
|
|
46
|
-
|
|
47
|
-
const coreData = unwrapSignal(json) // 先脱水
|
|
48
|
-
|
|
49
|
-
// 💡 这一步就是地堡的“火控系统”
|
|
50
|
-
if (!isQuerySignal(req, json, coreData)) {
|
|
51
|
-
return // 增删改信号,直接丢弃,保持静默
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const referer = req.headers.referer || ''
|
|
55
|
-
const fileName = referer.split('?')[0].split('/').filter(Boolean).at(-1)
|
|
56
|
-
|
|
57
|
-
const fingerprint = getJsonFingerprint(unwrapSignal(json)) // 获取数据指纹
|
|
58
|
-
const lastFingerprint = hackedRegistry.get(fileName)
|
|
59
|
-
|
|
60
|
-
// 如果指纹没变,说明字段结构是一样的,无需再次骇入
|
|
61
|
-
if (lastFingerprint === fingerprint) {
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
console.log(chalk.cyan(language(
|
|
66
|
-
`\n📡 Pod 153: 截获运行时信号 [${fileName}]。执行自动对齐协议...`,
|
|
67
|
-
`\n📡 Pod 153: Captured runtime signal [${fileName}]. Executing semantic alignment protocol...`
|
|
68
|
-
)))
|
|
69
|
-
// 💡 直接调用 api-handler 物理更新 resource.js
|
|
70
|
-
await apiHandler(null, { fileName, data: json })
|
|
71
|
-
hackedRegistry.set(fileName, fingerprint)
|
|
72
|
-
} catch (e) {
|
|
73
|
-
console.log(e)
|
|
74
|
-
// 非 JSON 信号,保持静默
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
})
|
|
78
76
|
// 转发至真实后端
|
|
79
77
|
proxy.web(req, res, { target, changeOrigin: true })
|
|
80
78
|
})
|