40 lines
1.6 KiB
JavaScript
40 lines
1.6 KiB
JavaScript
/**
|
|
* 验证首页更新
|
|
*/
|
|
|
|
const GZ = { ip: '43.139.217.141', port: 3910, key: 'zy_gtw_4a155446b7acc09fe46a2a29972c0ca5d9954da19c35dc23' }
|
|
|
|
async function callGK(srv, method, path, body = null) {
|
|
const url = `http://${srv.ip}:${srv.port}${path}`
|
|
const opts = { method, headers: { 'Authorization': `Bearer ${srv.key}`, 'Content-Type': 'application/json' } }
|
|
if (body) opts.body = JSON.stringify(body)
|
|
const res = await fetch(url, opts)
|
|
const text = await res.text()
|
|
try { return { status: res.status, data: JSON.parse(text) } }
|
|
catch { return { status: res.status, data: { raw: text } } }
|
|
}
|
|
|
|
async function exec(srv, cmd) {
|
|
const r = await callGK(srv, 'POST', '/exec', { cmd })
|
|
return r.data
|
|
}
|
|
|
|
async function main() {
|
|
// 查看首页的图片工作室相关部分
|
|
const r1 = await exec(GZ, `grep -n -A15 "图片工作室" /opt/guanghulab-repo/homepage/index.html`)
|
|
console.log('=== 图片工作室入口卡片 ===')
|
|
console.log(r1.stdout || r1.stderr)
|
|
|
|
// 通过Nginx验证
|
|
console.log('\n=== Nginx渲染验证 ===')
|
|
const r2 = await exec(GZ, `curl -s -k -H "Host: guanghulab.com" https://localhost/ 2>&1 | grep -o '图片工作室\|神笔马良\|/images/' | head -5`)
|
|
console.log('首页包含:', (r2.stdout || r2.stderr || '(无)').replace(/\n/g, ' · '))
|
|
|
|
// 确认图片工作室可访问
|
|
console.log('\n=== 点击跳转验证 ===')
|
|
const r3 = await exec(GZ, `curl -s -k --connect-timeout 5 -H "Host: guanghulab.com" -w "\\nHTTP:%{http_code}" https://localhost/images/ 2>&1 | tail -3`)
|
|
console.log('/images/ 可访问:', (r3.stdout || '').slice(0, 100))
|
|
}
|
|
|
|
main().catch(err => console.error('❌', err))
|