component
Sunon MF40200V1-1000U-G99 · 5 V tachometer fan
Public Made by Adomby adom
Tachometer fan with factory flying leads, an explicit Adom connector harness and gentle GLB state demonstration.
main
John Lauer
Bundle fan preview data for authenticated wiki rendering without companion fetches
e73bd0e
12d ago
from pathlib import Path
import json,base64
r=Path(__file__).resolve().parents[1];s=(r/'viewer/template.html').read_text();controller=(r/'states/controller.mjs').read_text().replace('export function','function');s=s.replace("import {bindFanMotion} from '../states/controller.js';",controller)
encoded=base64.b64encode((r/'states/fan-animated.glb').read_bytes()).decode();s=s.replace("const imported=await B.SceneLoader.ImportMeshAsync('','../states/','fan-animated.glb',scene);", "const bytes=Uint8Array.from(atob('"+encoded+"'),c=>c.charCodeAt(0));const imported=await B.SceneLoader.ImportMeshAsync('','',bytes,scene,undefined,'.glb');")
s=s.replace("const manifest=await(await fetch('../states.json')).json();",'const manifest='+json.dumps(json.loads((r/'states.json').read_text()),separators=(',',':'))+';')
(r/'viewer/index.html').write_text(s)