Install ReUI (MCP, skill, @reui registry, Tailwind v4, shadcn base-nova) and move the shared UI onto it: Button, Tag, Check, Input/Textarea, Segmented, Alert, Panel, Dialog, Tooltip, Menu and Select (Popover), Toast (sonner), the Table frame (DataGrid), the Dashboard KPI strip, the shnt Ops palette, Geist and the type scale. Design only: behaviour, texts and roles are unchanged. Tests that asserted the old DOM were updated; the tests now format numbers in English wherever they run. docs/reui-migration-plan.md records the plan and its decisions. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
31 lines
967 B
TypeScript
31 lines
967 B
TypeScript
/*
|
|
Builds the DNS query a client would POST, for the tests. With `arcount` 1 it
|
|
appends an empty OPT record, because Technitium sends one with every query.
|
|
*/
|
|
export function encodeQuery(name: string, type: number, id = 0, rd = true, arcount = 0): Uint8Array<ArrayBuffer> {
|
|
const labels = name.split('.').filter((l) => l.length > 0)
|
|
const qname = labels.reduce((n, l) => n + 1 + l.length, 1)
|
|
const opt = arcount === 1 ? 11 : 0
|
|
const out = new Uint8Array(12 + qname + 4 + opt)
|
|
const view = new DataView(out.buffer)
|
|
view.setUint16(0, id)
|
|
view.setUint16(2, rd ? 0x0100 : 0)
|
|
view.setUint16(4, 1)
|
|
view.setUint16(10, arcount)
|
|
let at = 12
|
|
for (const label of labels) {
|
|
out[at++] = label.length
|
|
for (const ch of label) out[at++] = ch.charCodeAt(0)
|
|
}
|
|
out[at++] = 0
|
|
view.setUint16(at, type)
|
|
view.setUint16(at + 2, 1)
|
|
at += 4
|
|
if (opt) {
|
|
out[at] = 0
|
|
view.setUint16(at + 1, 41)
|
|
view.setUint16(at + 3, 1232)
|
|
}
|
|
return out
|
|
}
|