mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-12 11:52:07 +10:00
add clamp for path length
This commit is contained in:
@@ -2798,9 +2798,10 @@ class MeshCoreConnector extends ChangeNotifier {
|
|||||||
if (!isConnected) return;
|
if (!isConnected) return;
|
||||||
|
|
||||||
final mode = _pathHashByteWidth - 1;
|
final mode = _pathHashByteWidth - 1;
|
||||||
final encodedPathLen = (pathLen >= 0 && pathLen != 0xFF)
|
if (pathLen < 0 || pathLen > 0x3F) {
|
||||||
? (pathLen | (mode << 6))
|
return;
|
||||||
: pathLen;
|
}
|
||||||
|
final encodedPathLen = pathLen | (mode << 6);
|
||||||
await sendFrame(
|
await sendFrame(
|
||||||
buildUpdateContactPathFrame(
|
buildUpdateContactPathFrame(
|
||||||
contact.publicKey,
|
contact.publicKey,
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _pathHashModeSubtitle(int pathHashByteWidth) {
|
String _pathHashModeSubtitle(int pathHashByteWidth) {
|
||||||
final width = pathHashByteWidth.clamp(1, 3).toInt();
|
final width = pathHashByteWidth.clamp(1, 4).toInt();
|
||||||
final mode = width - 1;
|
final mode = width - 1;
|
||||||
final unit = width == 1 ? 'byte' : 'bytes';
|
final unit = width == 1 ? 'byte' : 'bytes';
|
||||||
return 'Mode $mode - $width $unit per hop';
|
return 'Mode $mode - $width $unit per hop';
|
||||||
|
|||||||
@@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user