mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-08-06 23:19:52 +00:00
fix: node-only search path also resolves name→pubkey + text search
The fast-path for single node filter was bypassing the name resolution, using raw name string on pubkey-indexed byNode map
This commit is contained in:
+15
-1
@@ -134,7 +134,21 @@ class PacketStore {
|
||||
} else if (observer && !type && !route && !region && !hash && !since && !until && !node) {
|
||||
results = this.byObserver.get(observer) || [];
|
||||
} else if (node && !type && !route && !region && !observer && !hash && !since && !until) {
|
||||
results = this.byNode.get(node) || [];
|
||||
// Resolve name to pubkey, then use index + text search
|
||||
let pubkey = node;
|
||||
let nodeName = node;
|
||||
if (!this.byNode.has(node)) {
|
||||
try {
|
||||
const row = this.db.prepare("SELECT public_key, name FROM nodes WHERE public_key = ? OR name = ? LIMIT 1").get(node, node);
|
||||
if (row) { pubkey = row.public_key; nodeName = row.name || node; }
|
||||
} catch {}
|
||||
}
|
||||
const indexed = this.byNode.get(pubkey);
|
||||
const idSet = indexed ? new Set(indexed.map(p => p.id)) : new Set();
|
||||
results = this.packets.filter(p =>
|
||||
idSet.has(p.id) ||
|
||||
(p.decoded_json && (p.decoded_json.includes(nodeName) || p.decoded_json.includes(pubkey)))
|
||||
);
|
||||
} else {
|
||||
// Apply filters sequentially
|
||||
if (type !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user