feat(V0.2): 版本方案落地 —— 前端/外壳解绑, build 标识统一, 外壳版本展示
Docker Build and Push / build-image (push) Successful in 1m5s
Docker Build and Push / build-image (push) Successful in 1m5s
- check-version: 分组校验 (前端 package.json / 外壳 tauri.conf+Cargo), 两组不再要求相等; 分支前缀校验只针对前端版本 - build-ota: build_id 改为 YYYYMMDDHHmmss (北京时间, 与前端 BUILD_ID 同格式); sequence 保持毫秒仅用于判新 - 我的页: 当前版本恢复 v0.2.0 · build <原始BUILD_ID>; 新版本附 OTA build_id; 底部替换为外壳版本 (Tauri getVersion, Web 端 —) - README: 合并遗留 readme 全部内容并按决议重写版本管理章节; 新增 CHANGELOG.md (PATCH 仅明确提出时自增)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import WebSocket from 'ws'
|
||||
const C = JSON.parse((await (await fetch('http://127.0.0.1:9223/json/version')).text()))
|
||||
const ws = new WebSocket(C.webSocketDebuggerUrl, { perMessageDeflate: false })
|
||||
let id = 0; const pending = new Map()
|
||||
const send = (m, p = {}, s) => new Promise((r) => { const i = ++id; pending.set(i, r); ws.send(JSON.stringify({ id: i, method: m, params: p, sessionId: s })) })
|
||||
ws.on('message', (d) => { const m = JSON.parse(d); if (m.id && pending.has(m.id)) { pending.get(m.id)(m.result); pending.delete(m.id) } })
|
||||
await new Promise((r) => ws.on('open', r))
|
||||
const targets = await send('Target.getTargets')
|
||||
const t = targets.targetInfos.find((x) => x.url.includes('dragtest'))
|
||||
const { sessionId } = await send('Target.attachToTarget', { targetId: t.targetId, flatten: true })
|
||||
const S = (m, p) => send(m, p, sessionId)
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms))
|
||||
const ev = async (e) => (await S('Runtime.evaluate', { expression: e, returnByValue: true })).result.value
|
||||
const touch = (type, x, y) => S('Input.dispatchTouchEvent', { type, touchPoints: type === 'touchEnd' ? [] : [{ x, y, id: 1 }] })
|
||||
const r = JSON.parse(await ev(`JSON.stringify(document.querySelector('[data-habit-id="2"] .grip').getBoundingClientRect())`))
|
||||
const x = r.left + r.width / 2, y = r.top + r.height / 2
|
||||
await touch('touchStart', x, y)
|
||||
await sleep(60)
|
||||
const t4 = JSON.parse(await ev(`JSON.stringify(document.querySelector('[data-habit-id="4"]').getBoundingClientRect())`))
|
||||
const fx = t4.left + t4.width / 2, fy = t4.top + t4.height / 2
|
||||
await touch('touchMove', fx, fy)
|
||||
await sleep(150)
|
||||
const scan = await ev(`(() => {
|
||||
const out = []
|
||||
document.querySelectorAll('*').forEach((el) => {
|
||||
const cs = getComputedStyle(el)
|
||||
const b = el.getBoundingClientRect()
|
||||
if (b.width === 0 || b.height === 0) return
|
||||
const bg = cs.backgroundColor
|
||||
// 找带蓝色背景的元素
|
||||
if (/rgb\\((22|2[0-9]|1[0-9]), ?1[0-9]{2}/.test(bg) || bg.includes('22, 119, 255') || bg.includes('0, 149, 255')) {
|
||||
out.push({ tag: el.tagName, cls: el.className && String(el.className).slice(0, 40), bg, rect: [Math.round(b.left), Math.round(b.top), Math.round(b.width), Math.round(b.height)], text: (el.textContent || '').slice(0, 12) })
|
||||
}
|
||||
})
|
||||
return JSON.stringify(out)
|
||||
})()`)
|
||||
console.log('blue elements:', scan)
|
||||
console.log('ghost children:', await ev(`(() => { const g = document.querySelector('.drag-ghost'); return g ? g.children.length + ' kids, inner w ' + g.getBoundingClientRect().width : 'none' })()`))
|
||||
await touch('touchEnd')
|
||||
ws.close()
|
||||
Reference in New Issue
Block a user