abse/smartwatch-flex-top-only
Three-panel flex smartwatch with two parallel R3.9 bends, all components flat-top, low-profile JST connector harnesses, split heartbeat optical windows and screw-retained PCB mounting. Modeled 39 × 50.5 × 14.5mm prototype; 100% routing, zero native DRC and shorts. Hardware qualification pending.
- Version
- 0.2.20
- License
- unset
- Stars
- 0
scripts/restore-cloud-transports.mjs
import fs from 'node:fs'
import crypto from 'node:crypto'
import {cacheText} from '../routing/final/cache-data.ts'
const sha=b=>crypto.createHash('sha256').update(b).digest('hex')
export function restoreCloudTransports(){
const cache=JSON.parse(fs.readFileSync('routing/final/cache-transport.json','utf8'))
if(sha(Buffer.from(cacheText))!==cache.sha256)throw Error('Routing transport changed')
if(fs.existsSync('routing/final/cache.json')&&sha(fs.readFileSync('routing/final/cache.json'))!==cache.sha256)throw Error('Existing cache differs from exact transported data')
fs.writeFileSync('routing/final/cache.json',cacheText)
const model=JSON.parse(fs.readFileSync('preview/display-up/transport.json','utf8'))
const data=Buffer.concat(model.parts.map(p=>fs.readFileSync(p)))
if(data.length!==model.bytes||sha(data)!==model.sha256)throw Error('Model transport changed')
if(fs.existsSync(model.path)&&sha(fs.readFileSync(model.path))!==model.sha256)throw Error('Existing model differs from transported data')
fs.writeFileSync(model.path,data)
console.log('Restored byte-identical routing cache and display-up model from small transport files')
}