chore: init qmt_bridge repo (HTTP+WS bridge, MCP endpoint, docs, references)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
# fetch_apifox_doc.ps1 - runs OUTSIDE the sandbox via UAC elevation
|
||||
# Fetches the Apifox openapi doc page and saves it to a temp file.
|
||||
$ErrorActionPreference = "Stop"
|
||||
$url = "https://apifox-openapi.apifox.cn/api-173409873"
|
||||
$out = "C:\Users\Docker\AppData\Local\Temp\apifox_doc_fetched.html"
|
||||
$log = "C:\Users\Docker\AppData\Local\Temp\apifox_fetch_log.txt"
|
||||
|
||||
try {
|
||||
# bypass SSL validation for IP-based access if needed
|
||||
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
|
||||
|
||||
$resp = Invoke-WebRequest -Uri $url -TimeoutSec 30 -UseBasicParsing -Headers @{
|
||||
"User-Agent" = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
|
||||
}
|
||||
[System.IO.File]::WriteAllText($out, $resp.Content, [System.Text.Encoding]::UTF8)
|
||||
"HTTP $($resp.StatusCode) len=$($resp.Content.Length) -> saved to $out" | Out-File $log -Encoding utf8
|
||||
} catch {
|
||||
"ERROR: $($_.Exception.Message)" | Out-File $log -Encoding utf8
|
||||
# try IP-based with host header as fallback
|
||||
try {
|
||||
$ip = "8.136.114.212"
|
||||
$req = [System.Net.HttpWebRequest]::Create("https://$ip/api-173409873")
|
||||
$req.Host = "apifox-openapi.apifox.cn"
|
||||
$req.UserAgent = "Mozilla/5.0"
|
||||
$req.Timeout = 30000
|
||||
$req.ServerCertificateValidationCallback = { $true }
|
||||
$resp = $req.GetResponse()
|
||||
$reader = New-Object System.IO.StreamReader($resp.GetResponseStream())
|
||||
$content = $reader.ReadToEnd()
|
||||
[System.IO.File]::WriteAllText($out, $content, [System.Text.Encoding]::UTF8)
|
||||
"FALLBACK HTTP $([int]$resp.StatusCode) len=$($content.Length)" | Out-File $log -Encoding utf8
|
||||
} catch {
|
||||
"FALLBACK ERROR: $($_.Exception.Message)" | Out-File $log -Encoding utf8
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user