From a7c5e1a8c3bb7e39806a7c6c130082c205518867 Mon Sep 17 00:00:00 2001 From: MarekWo Date: Mon, 30 Mar 2026 15:22:34 +0200 Subject: [PATCH] fix(path_hash_mode): echo badge uses echo hash_size, not message path_hash_size For own (sent) messages, path_len is NULL so path_hash_size defaults to 1, causing echo badge to show 1-byte prefixes (D1, 5E) instead of 2-byte (D103, 5E34) when path_hash_mode>0. Now uses hash_size from the first echo record (echo_hash_sizes[0]) which carries the correct value from RX_LOG_DATA parsing. Co-Authored-By: Claude Opus 4.6 --- app/static/js/app.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/static/js/app.js b/app/static/js/app.js index 0a7baf4..9594588 100644 --- a/app/static/js/app.js +++ b/app/static/js/app.js @@ -1099,7 +1099,10 @@ function updateMessageMetaDOM(wrapper, meta) { // Update echo badge if (meta.echo_paths && meta.echo_paths.length > 0) { - const echoPrefixLen = (meta.path_hash_size || 1) * 2; + // For own messages path_hash_size is null — use hash_size from echoes + const echoHashSize = (meta.echo_hash_sizes && meta.echo_hash_sizes.length > 0) + ? meta.echo_hash_sizes[0] : (meta.path_hash_size || 1); + const echoPrefixLen = echoHashSize * 2; const echoPaths = [...new Set(meta.echo_paths.map(p => p.substring(0, echoPrefixLen).toUpperCase()))]; const echoCount = echoPaths.length; const pathDisplay = echoPaths.length > 0 ? ` (${echoPaths.join(', ')})` : ''; @@ -1184,7 +1187,10 @@ function createMessageElement(msg) { if (msg.is_own) { // Own messages: right-aligned, no avatar // Echo badge shows unique repeaters that heard the message + their path codes - const echoPrefixLen2 = (msg.path_hash_size || 1) * 2; + // For own messages path_hash_size is null — use hash_size from echoes + const echoHS = (msg.echo_hash_sizes && msg.echo_hash_sizes.length > 0) + ? msg.echo_hash_sizes[0] : (msg.path_hash_size || 1); + const echoPrefixLen2 = echoHS * 2; const echoPaths = [...new Set((msg.echo_paths || []).map(p => p.substring(0, echoPrefixLen2).toUpperCase()))]; const echoCount = echoPaths.length; const pathDisplay = echoPaths.length > 0 ? ` (${echoPaths.join(', ')})` : '';