Files
mantle-ai-trader/skills/web-shader-extractor/references/config-extraction.md
2026-06-06 05:21:10 +00:00

51 lines
1.2 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 配置参数提取
配置值必须从源站提取,不猜测。(猜错实例:颜色差 60x、图案完全不同
## 来源(按优先级)
### 1. 公开 REST API
```bash
# 在 JS bundle 中搜索 API 端点
grep -oE 'api/(presets|shaders|collections)[^"]*' /tmp/*.js
# 直接调用
curl -s -L --compressed 'https://example.com/api/collections/slug/uuid'
```
API 返回可能是编码的 → 见 `encoded-definitions.md`
### 2. Nuxt.js Payload
```bash
grep -oE '_payload\.json[^"]*' /tmp/page.html # payload URL
grep -oE 'public:\{[^}]*\}' /tmp/page.html # runtime config可能含密钥
```
### 3. Next.js
```bash
# App Router (RSC)
grep -oE '"(scene|glass|postProcessing)":\{' /tmp/page.html
# Pages Router
grep -o '<script id="__NEXT_DATA__"[^>]*>[^<]*' /tmp/page.html | sed 's/.*>//'
```
### 4. 内联 JSON / window 全局变量
```bash
grep -oE 'window\.__CONFIG__\s*=\s*\{[^;]+' /tmp/page.html
```
### 5. JS Bundle 默认值(最后手段)
```bash
grep -oE '(config|options|settings)\s*=\s*\{' /tmp/entry-chunk.js
```
## 验证
- 颜色范围0-1 还是 0-255
- resolution像素值还是比例系数
- 布尔值:`false` 是否跳过整个渲染 pass