From a815193233e61361a5936df3dcf9b03905962ff6 Mon Sep 17 00:00:00 2001 From: ElektroVodka <211697683+Elektr0Vodka@users.noreply.github.com> Date: Tue, 1 Dec 2026 22:24:35 +0100 Subject: [PATCH] fix(filter): read hash-only blocked channels, document the 1 December builds `filter channel list` marks entries added with `filter channel add hash` as `#bot (23 hash)`. The toolbox took that whole text as the channel name, so applying, sharing or restoring the filter lost the hash-only mode. - Parse the marker and keep the mode in FilterSettings.hashOnly, with a "Hash only" switch per blocked channel. Support is detected from the usage line of `filter channel`: on older firmware `add hash #bot` blocks a channel named "hash", so it is never sent to a node without it. - Read the last name of a list the firmware cut off with `..`. - Refuse channel names over 31 bytes, as the firmware does since Dutch-MeshCore/MeshCore#61. - Sanitize the filter settings of a restored backup, and repair names that were saved with the marker in them. - CLI Wiki, Filter guide, Filter CLI and changelog (en, nl, de): key matching, rate-limit order, malformed scan, `filter age` in both directions, pull OTA and radio.watchdog. The USB Setup help of the filter panel described options that do not exist; rewritten. --- src/components/config/FilterSettingsForm.tsx | 46 +++++- src/components/config/panelHelpContent.ts | 42 +++--- src/hooks/useSerialDevice.ts | 9 +- src/lib/cli/descriptions.de.ts | 9 +- src/lib/cli/descriptions.nl.ts | 9 +- src/lib/cli/firmwareRegistry.ts | 9 +- src/lib/config/filterCommands.ts | 64 +++++++-- src/pages/ChangelogPage.tsx | 135 ++++++++++++++++++ src/pages/FilterCliPage.tsx | 4 +- src/pages/FilterGuidePage.tsx | 30 ++-- src/styles/globals.css | 10 ++ src/test/filterCommands.test.ts | 141 ++++++++++++++++++- src/test/filterSettingsForm.test.tsx | 68 +++++++++ 13 files changed, 508 insertions(+), 68 deletions(-) create mode 100644 src/test/filterSettingsForm.test.tsx diff --git a/src/components/config/FilterSettingsForm.tsx b/src/components/config/FilterSettingsForm.tsx index 8e4cc61..93f7d42 100644 --- a/src/components/config/FilterSettingsForm.tsx +++ b/src/components/config/FilterSettingsForm.tsx @@ -1,6 +1,6 @@ import { useState } from 'react' import { - PAYLOAD_TYPES, cloneFilterSettings, isValidPathPrefix, ALL_FILTER_FEATURES, + PAYLOAD_TYPES, cloneFilterSettings, isValidChannelName, isValidPathPrefix, ALL_FILTER_FEATURES, FILTER_CHANNEL_MAX, FILTER_PATH_MAX, FILTER_RULE_MAX, FILTER_WATCH_MAX, FILTER_SENDER_LEN, FILTER_TEXT_LEN, FILTER_ADVERT_MAX_HOURS, FILTER_AGE_MAX_MINS, type FilterSettings, type FilterFeatures, type FilterRule, @@ -21,6 +21,9 @@ const copy = { minHash: 'Min path-hash bytes (1–3)', malformed: 'Scan public-channel text for malformed UTF-8', blocked: 'Blocked channels', + hashOnly: 'Hash only', + hashOnlyTitle: 'Block every channel with the same hash byte', + hashOnlyHint: 'A blocked channel matches by its key. "Hash only" blocks every channel that shares its hash byte (about 1 in 256). Firmware without this option would block a channel named "hash" instead: it needs a DMC dev build from 1 December 2026 or newer.', none: 'None', channelPlaceholder: '#channel or Public', add: 'Add', @@ -59,6 +62,9 @@ const copy = { minHash: 'Min. path-hash bytes (1–3)', malformed: 'Scan tekst op publieke kanalen op ongeldige UTF-8', blocked: 'Geblokkeerde kanalen', + hashOnly: 'Alleen hash', + hashOnlyTitle: 'Blokkeer elk kanaal met dezelfde hash-byte', + hashOnlyHint: 'Een geblokkeerd kanaal wordt herkend aan zijn sleutel. "Alleen hash" blokkeert elk kanaal met dezelfde hash-byte (ongeveer 1 op 256). Firmware zonder deze optie zou een kanaal met de naam "hash" blokkeren: er is een DMC-dev-build van 1 december 2026 of nieuwer nodig.', none: 'Geen', channelPlaceholder: '#kanaal of Public', add: 'Toevoegen', @@ -97,6 +103,9 @@ const copy = { minHash: 'Min. Path-Hash-Bytes (1–3)', malformed: 'Text öffentlicher Kanäle auf fehlerhaftes UTF-8 prüfen', blocked: 'Blockierte Kanäle', + hashOnly: 'Nur Hash', + hashOnlyTitle: 'Jeden Kanal mit demselben Hash-Byte blockieren', + hashOnlyHint: 'Ein blockierter Kanal wird an seinem Schlüssel erkannt. "Nur Hash" blockiert jeden Kanal mit demselben Hash-Byte (etwa 1 von 256). Firmware ohne diese Option würde stattdessen einen Kanal namens "hash" blockieren: nötig ist ein DMC-Dev-Build vom 1. Dezember 2026 oder neuer.', none: 'Keine', channelPlaceholder: '#Kanal oder Public', add: 'Hinzufügen', @@ -140,7 +149,7 @@ function clampInt(v: string, min: number, max: number): number { } /** Removable chips plus an add box; `normalize` returns null to reject the input. */ -function ChipList({ label, items, max, placeholder, c, normalize, onChange }: { +function ChipList({ label, items, max, placeholder, c, normalize, onChange, flag }: { label: string items: string[] max: number @@ -148,6 +157,8 @@ function ChipList({ label, items, max, placeholder, c, normalize, onChange }: { c: Copy normalize: (raw: string) => string | null onChange: (next: string[]) => void + /** Optional on/off switch per chip. */ + flag?: { label: string; title: string; items: string[]; toggle: (item: string) => void } }) { const [input, setInput] = useState('') function add() { @@ -163,7 +174,14 @@ function ChipList({ label, items, max, placeholder, c, normalize, onChange }: { {items.length === 0 && {c.none}} {items.map(it => ( - {it} + {it} + {flag && ( + + )}