铸渊: 图片工作室部署完成 · 首页入口卡片 + 远程部署脚本 + Nginx配置

This commit is contained in:
铸渊 2026-05-23 00:30:15 +00:00
parent 11c0d78127
commit 6f203ab4d9
3 changed files with 179 additions and 0 deletions

View File

@ -0,0 +1,89 @@
/**
* 在guanghulab.com首页添加图片工作室入口卡片
*/
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 readFile(srv, path) {
const r = await callGK(srv, 'POST', '/file/read', { path })
if (r.status === 200) return r.data.content
return null
}
async function writeFile(srv, path, content) {
return (await callGK(srv, 'POST', '/file/write', { path, content })).status === 200
}
async function main() {
// 读取首页HTML
const html = await readFile(GZ, '/opt/guanghulab-repo/homepage/index.html')
if (!html) {
console.log('❌ 读取失败')
return
}
console.log('当前首页大小:', html.length, '字符')
// 在语料采集系统卡片和架构进度卡片之间插入图片工作室卡片
// 找到语料采集卡片关闭后的位置
// 插入标记:在 语料采集系统card 的 </div> 之后、架构进度的grid之前插入
const marker = '<!-- 架构进度 + 工具链注册表 -->'
const insertIdx = html.indexOf(marker)
if (insertIdx === -1) {
console.log('❌ 找不到插入位置')
return
}
const imageStudioCard = `
<!-- 铸渊图片工作室入口 -->
<div class="card clickable breathe-amber" onclick="window.location.href='/images/'" style="cursor:pointer;border-color:rgba(212,160,48,.25)">
<div class="card-header"><span class="hd amber"></span> <span class="tag" style="color:var(--amber)"></span></div>
<div class="server-entry">
<div class="se-icon" style="border-color:rgba(212,160,48,.25);background:linear-gradient(135deg,rgba(212,160,48,.3),rgba(42,157,191,.25))">
<span>🎨</span>
<div class="pulse-ring" style="border-color:rgba(212,160,48,.15)"></div>
</div>
<div class="se-body">
<div class="se-title">神笔马良 · 你说我画</div>
<div class="se-desc">告诉铸渊内容和场景自动生成小红书/即刻配图海报通知卡片</div>
<div class="se-stats">
<div class="se-stat"><span class="dot" style="background:var(--amber);box-shadow:0 0 8px var(--amber)"></span> · · </div>
<div class="se-stat"><span class="dot" style="background:var(--amber);box-shadow:0 0 8px var(--amber)"></span> · </div>
<div class="se-stat"><span class="dot" style="background:var(--amber);box-shadow:0 0 8px var(--amber)"></span> · 广</div>
</div>
</div>
<div class="se-arrow" style="color:var(--amber)"></div>
</div>
</div>
`
const newHtml = html.slice(0, insertIdx) + imageStudioCard + html.slice(insertIdx)
if (await writeFile(GZ, '/opt/guanghulab-repo/homepage/index.html', newHtml)) {
console.log('✅ 首页更新成功')
console.log('更新后大小:', newHtml.length, '字符')
// 验证
const verify = await readFile(GZ, '/opt/guanghulab-repo/homepage/index.html')
if (verify && verify.includes('图片工作室')) {
console.log('✅ 图片工作室入口已添加到首页')
}
} else {
console.log('❌ 写入失败')
}
}
main().catch(err => console.error('❌', err))

View File

@ -0,0 +1,51 @@
/**
* 查看guanghulab.com首页
*/
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 readFile(srv, path) {
const r = await callGK(srv, 'POST', '/file/read', { path })
if (r.status === 200) return r.data.content
return null
}
async function main() {
// 查看首页目录
console.log('📂 首页目录结构:')
const r1 = await exec(GZ, 'ls -la /opt/guanghulab-repo/homepage/ 2>&1')
console.log(r1.stdout || r1.stderr)
// 读取index.html
console.log('\n📄 index.html:')
const html = await readFile(GZ, '/opt/guanghulab-repo/homepage/index.html')
if (html) console.log(html)
else console.log('(读取失败)')
// 看看子目录
console.log('\n📂 首页子目录:')
const r2 = await exec(GZ, 'find /opt/guanghulab-repo/homepage/ -type f 2>&1')
console.log(r2.stdout || r2.stderr)
// 看首页通过Nginx访问的效果
console.log('\n🔍 首页HTML:')
const r3 = await exec(GZ, `curl -s -k -H "Host: guanghulab.com" https://localhost/ 2>&1 | head -100`)
console.log(r3.stdout || r3.stderr)
}
main().catch(err => console.error('❌', err))

View File

@ -0,0 +1,39 @@
/**
* 验证首页更新
*/
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))