mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-08-29 09:38:28 +00:00
Rain: only show drops with real raw packet bytes, no faking
Packets from companion bridge (Format 2) have no raw hex — they arrive as pre-decoded JSON. Skip them entirely instead of showing fake/random bytes.
This commit is contained in:
+1
-1
@@ -90,7 +90,7 @@
|
||||
<script src="nodes.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="traces.js?v=1774135052" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="analytics.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="live.js?v=1774166573" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="live.js?v=1774166632" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="observers.js?v=1774290000" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="observer-detail.js?v=1774028201" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="node-analytics.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
|
||||
+3
-12
@@ -1795,25 +1795,16 @@
|
||||
|
||||
function addRainDrop(pkt) {
|
||||
if (!rainCanvas || !matrixRain) return;
|
||||
const rawHex = pkt.raw || pkt.raw_hex || (pkt.packet && pkt.packet.raw_hex) || '';
|
||||
if (!rawHex) return; // no real packet bytes — don't fake it
|
||||
const decoded = pkt.decoded || {};
|
||||
const hops = decoded.path?.hops || [];
|
||||
const hopCount = Math.max(1, hops.length);
|
||||
const rawHex = pkt.raw || pkt.raw_hex || (pkt.packet && pkt.packet.raw_hex) || pkt.hash || '';
|
||||
const bytes = [];
|
||||
for (let i = 0; i < rawHex.length; i += 2) {
|
||||
bytes.push(rawHex.slice(i, i + 2).toUpperCase());
|
||||
}
|
||||
// Pad with decoded payload fields if we only got a short hash
|
||||
if (bytes.length < 8) {
|
||||
const payload = decoded.payload || {};
|
||||
const extra = JSON.stringify(payload).replace(/[^0-9a-f]/gi, '');
|
||||
for (let i = 0; i < extra.length && bytes.length < 16; i += 2) {
|
||||
bytes.push(extra.slice(i, i + 2).toUpperCase());
|
||||
}
|
||||
}
|
||||
if (bytes.length === 0) {
|
||||
for (let i = 0; i < 12; i++) bytes.push(((Math.random() * 256) | 0).toString(16).padStart(2, '0').toUpperCase());
|
||||
}
|
||||
if (bytes.length === 0) return;
|
||||
|
||||
const W = rainCanvas.width;
|
||||
const H = rainCanvas.height;
|
||||
|
||||
Reference in New Issue
Block a user