From 6e81fdfd465b103c0bd83d2f5edb29da24eca522 Mon Sep 17 00:00:00 2001 From: PacoX Date: Wed, 27 May 2026 08:32:16 +0200 Subject: [PATCH] add clamp for path length --- lib/connector/meshcore_connector.dart | 7 +- lib/screens/settings_screen.dart | 2 +- untranslated.json | 120 ++++++++++++++++++++++++++ 3 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 untranslated.json diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 8b1f21df..b21bd3ed 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -2798,9 +2798,10 @@ class MeshCoreConnector extends ChangeNotifier { if (!isConnected) return; final mode = _pathHashByteWidth - 1; - final encodedPathLen = (pathLen >= 0 && pathLen != 0xFF) - ? (pathLen | (mode << 6)) - : pathLen; + if (pathLen < 0 || pathLen > 0x3F) { + return; + } + final encodedPathLen = pathLen | (mode << 6); await sendFrame( buildUpdateContactPathFrame( contact.publicKey, diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 04086126..3294546f 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -348,7 +348,7 @@ class _SettingsScreenState extends State { } String _pathHashModeSubtitle(int pathHashByteWidth) { - final width = pathHashByteWidth.clamp(1, 3).toInt(); + final width = pathHashByteWidth.clamp(1, 4).toInt(); final mode = width - 1; final unit = width == 1 ? 'byte' : 'bytes'; return 'Mode $mode - $width $unit per hop'; diff --git a/untranslated.json b/untranslated.json new file mode 100644 index 00000000..dd0a7e15 --- /dev/null +++ b/untranslated.json @@ -0,0 +1,120 @@ +{ + "bg": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "de": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "es": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "fr": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "hu": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "it": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "ja": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "ko": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "nl": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "pl": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "pt": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "ru": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "sk": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "sl": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "sv": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "uk": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ], + + "zh": [ + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3" + ] +}