meshcore-cli 1.5.5__tar.gz → 1.5.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {meshcore_cli-1.5.5 → meshcore_cli-1.5.7}/PKG-INFO +2 -2
- {meshcore_cli-1.5.5 → meshcore_cli-1.5.7}/flake.nix +2 -2
- {meshcore_cli-1.5.5 → meshcore_cli-1.5.7}/pyproject.toml +2 -2
- {meshcore_cli-1.5.5 → meshcore_cli-1.5.7}/src/meshcore_cli/meshcore_cli.py +57 -33
- {meshcore_cli-1.5.5 → meshcore_cli-1.5.7}/.gitignore +0 -0
- {meshcore_cli-1.5.5 → meshcore_cli-1.5.7}/LICENSE +0 -0
- {meshcore_cli-1.5.5 → meshcore_cli-1.5.7}/README.md +0 -0
- {meshcore_cli-1.5.5 → meshcore_cli-1.5.7}/REPEATER_COMMANDS.md +0 -0
- {meshcore_cli-1.5.5 → meshcore_cli-1.5.7}/flake.lock +0 -0
- {meshcore_cli-1.5.5 → meshcore_cli-1.5.7}/src/meshcore_cli/__init__.py +0 -0
- {meshcore_cli-1.5.5 → meshcore_cli-1.5.7}/src/meshcore_cli/__main__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshcore-cli
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.7
|
|
4
4
|
Summary: Command line interface to meshcore companion radios and repeaters
|
|
5
5
|
Project-URL: Homepage, https://github.com/fdlamotte/meshcore-cli
|
|
6
6
|
Project-URL: Issues, https://github.com/fdlamotte/meshcore-cli/issues
|
|
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: >=3.10
|
|
13
13
|
Requires-Dist: bleak>=0.22
|
|
14
|
-
Requires-Dist: meshcore>=2.3.
|
|
14
|
+
Requires-Dist: meshcore>=2.3.7
|
|
15
15
|
Requires-Dist: prompt-toolkit>=3.0.50
|
|
16
16
|
Requires-Dist: requests>=2.28.0
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
meshcore = python3Packages.buildPythonPackage rec {
|
|
19
19
|
pname = "meshcore";
|
|
20
|
-
version = "2.3.
|
|
20
|
+
version = "2.3.6";
|
|
21
21
|
pyproject = true;
|
|
22
22
|
|
|
23
23
|
src = python3Packages.fetchPypi {
|
|
24
24
|
inherit pname version;
|
|
25
|
-
sha256 = "sha256-
|
|
25
|
+
sha256 = "sha256-l9/wDgRfzPSZGIt+tIUITs/mf/AeEIMDN9DXAbMSzSs=";
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
build-system = [ python3Packages.hatchling ];
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "meshcore-cli"
|
|
7
|
-
version = "1.5.
|
|
7
|
+
version = "1.5.7"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
|
10
10
|
]
|
|
@@ -17,7 +17,7 @@ classifiers = [
|
|
|
17
17
|
]
|
|
18
18
|
license = "MIT"
|
|
19
19
|
license-files = ["LICEN[CS]E*"]
|
|
20
|
-
dependencies = [ "meshcore >= 2.3.
|
|
20
|
+
dependencies = [ "meshcore >= 2.3.7",
|
|
21
21
|
"bleak >= 0.22",
|
|
22
22
|
"prompt_toolkit >= 3.0.50",
|
|
23
23
|
"requests >= 2.28.0" ]
|
|
@@ -35,7 +35,7 @@ import re
|
|
|
35
35
|
from meshcore import MeshCore, EventType, logger
|
|
36
36
|
|
|
37
37
|
# Version
|
|
38
|
-
VERSION = "v1.5.
|
|
38
|
+
VERSION = "v1.5.7"
|
|
39
39
|
|
|
40
40
|
# default ble address is stored in a config file
|
|
41
41
|
MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
|
|
@@ -586,6 +586,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
|
|
|
586
586
|
"max_flood_attempts" : None,
|
|
587
587
|
"flood_after" : None,
|
|
588
588
|
"path_hash_mode": None,
|
|
589
|
+
"default_scope": None,
|
|
589
590
|
},
|
|
590
591
|
"get" : {"name":None,
|
|
591
592
|
"bat":None,
|
|
@@ -627,6 +628,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
|
|
|
627
628
|
"stats_packets":None,
|
|
628
629
|
"allowed_repeat_freq":None,
|
|
629
630
|
"path_hash_mode":None,
|
|
631
|
+
"default_scope":None,
|
|
630
632
|
},
|
|
631
633
|
"?get":None,
|
|
632
634
|
"?set":None,
|
|
@@ -1809,16 +1811,12 @@ async def print_trace_to (mc, contact):
|
|
|
1809
1811
|
|
|
1810
1812
|
async def discover_path(mc, contact):
|
|
1811
1813
|
await mc.ensure_contacts()
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
res
|
|
1818
|
-
if res is None:
|
|
1819
|
-
return {"error": "timeout"}
|
|
1820
|
-
else :
|
|
1821
|
-
return res.payload
|
|
1814
|
+
timeout = 0 if not "timeout" in contact else contact["timeout"]
|
|
1815
|
+
res = await mc.commands.send_path_discovery_sync(contact, timeout)
|
|
1816
|
+
if res is None:
|
|
1817
|
+
return {"error": "timeout"}
|
|
1818
|
+
else :
|
|
1819
|
+
return res.payload
|
|
1822
1820
|
|
|
1823
1821
|
async def print_disc_trace_to (mc, contact):
|
|
1824
1822
|
p = await discover_path(mc, contact)
|
|
@@ -2247,7 +2245,12 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
2247
2245
|
print(f"Error : {res}")
|
|
2248
2246
|
else:
|
|
2249
2247
|
print(f"Policy for adv_loc: {policy}")
|
|
2250
|
-
|
|
2248
|
+
case "default_scope":
|
|
2249
|
+
res = await mc.commands.set_default_flood_scope(cmds[2])
|
|
2250
|
+
if res.type == EventType.ERROR:
|
|
2251
|
+
print(f"Error : {res}")
|
|
2252
|
+
else:
|
|
2253
|
+
print("Default scope set")
|
|
2251
2254
|
case _: # custom var
|
|
2252
2255
|
if cmds[1].startswith("_") :
|
|
2253
2256
|
vname = cmds[1][1:]
|
|
@@ -2538,6 +2541,9 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
2538
2541
|
case "allowed_repeat_freq" :
|
|
2539
2542
|
res = await mc.commands.get_allowed_repeat_freq()
|
|
2540
2543
|
print(json.dumps(res.payload))
|
|
2544
|
+
case "default_scope" :
|
|
2545
|
+
res = await mc.commands.get_default_flood_scope()
|
|
2546
|
+
print(json.dumps(res.payload))
|
|
2541
2547
|
case _ :
|
|
2542
2548
|
res = await mc.commands.get_custom_vars()
|
|
2543
2549
|
logger.debug(res)
|
|
@@ -2789,29 +2795,21 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
2789
2795
|
sess = PromptSession("Password: ", is_password=True)
|
|
2790
2796
|
password = await sess.prompt_async()
|
|
2791
2797
|
|
|
2792
|
-
|
|
2798
|
+
timeout = 0 if not "timeout" in contact else contact["timeout"]
|
|
2799
|
+
res = await mc.commands.send_login_sync(contact, password, timeout = timeout)
|
|
2793
2800
|
logger.debug(res)
|
|
2794
|
-
if res
|
|
2795
|
-
|
|
2796
|
-
|
|
2801
|
+
if res is None:
|
|
2802
|
+
print("Login failed : Error or Timeout waiting response")
|
|
2803
|
+
elif json_output :
|
|
2804
|
+
if res.type == EventType.LOGIN_SUCCESS:
|
|
2805
|
+
print(json.dumps({"login_success" : True}, indent=4))
|
|
2797
2806
|
else:
|
|
2798
|
-
print(
|
|
2799
|
-
else:
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
logger.debug(res)
|
|
2803
|
-
if res is None:
|
|
2804
|
-
print("Login failed : Timeout waiting response")
|
|
2805
|
-
elif json_output :
|
|
2806
|
-
if res.type == EventType.LOGIN_SUCCESS:
|
|
2807
|
-
print(json.dumps({"login_success" : True}, indent=4))
|
|
2808
|
-
else:
|
|
2809
|
-
print(json.dumps({"login_success" : False, "error" : "login failed"}, indent=4))
|
|
2807
|
+
print(json.dumps({"login_success" : False, "error" : "login failed"}, indent=4))
|
|
2808
|
+
else:
|
|
2809
|
+
if res.type == EventType.LOGIN_SUCCESS:
|
|
2810
|
+
print("Login success")
|
|
2810
2811
|
else:
|
|
2811
|
-
|
|
2812
|
-
print("Login success")
|
|
2813
|
-
else:
|
|
2814
|
-
print("Login failed")
|
|
2812
|
+
print("Login failed")
|
|
2815
2813
|
|
|
2816
2814
|
case "logout" :
|
|
2817
2815
|
argnum = 1
|
|
@@ -3281,6 +3279,30 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
3281
3279
|
else:
|
|
3282
3280
|
print(json.dumps(contact, indent=4))
|
|
3283
3281
|
|
|
3282
|
+
case "add_contact" :
|
|
3283
|
+
argnum = 3 # key type name
|
|
3284
|
+
contact = {
|
|
3285
|
+
"public_key": cmds[1],
|
|
3286
|
+
"type" : int (cmds[2]),
|
|
3287
|
+
"flags" : 0,
|
|
3288
|
+
"out_path_len" : 0,
|
|
3289
|
+
"out_path" : "",
|
|
3290
|
+
"out_path_hash_mode" : 0,
|
|
3291
|
+
"adv_name" : cmds[3],
|
|
3292
|
+
"adv_lat" : 0,
|
|
3293
|
+
"adv_lon" : 0,
|
|
3294
|
+
"last_advert" : 0,
|
|
3295
|
+
}
|
|
3296
|
+
try:
|
|
3297
|
+
res = await mc.commands.update_contact(contact)
|
|
3298
|
+
logger.debug(res)
|
|
3299
|
+
if res.type == EventType.ERROR:
|
|
3300
|
+
print(f"Error adding contact: {res}")
|
|
3301
|
+
elif json_output :
|
|
3302
|
+
print(json.dumps(res.payload, indent=4))
|
|
3303
|
+
except ValueError:
|
|
3304
|
+
print(f"Error ! Command format add_contact key type namez")
|
|
3305
|
+
|
|
3284
3306
|
case "change_path" | "cp":
|
|
3285
3307
|
argnum = 2
|
|
3286
3308
|
contact = await get_contact_from_arg(mc, cmds[1])
|
|
@@ -3594,7 +3616,7 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
3594
3616
|
case "script" :
|
|
3595
3617
|
if len(cmds) > 1:
|
|
3596
3618
|
argnum = 1
|
|
3597
|
-
|
|
3619
|
+
file_name = cmds[1]
|
|
3598
3620
|
else:
|
|
3599
3621
|
file_name = await prompt_for_file()
|
|
3600
3622
|
if not file_name is None:
|
|
@@ -3863,6 +3885,8 @@ Managing Flood Scope in interactive mode
|
|
|
3863
3885
|
When entering chat mode, scope will be reset to *, meaning classic flood.
|
|
3864
3886
|
You can switch scope using the scope command, or postfixing the to command with %<scope>.
|
|
3865
3887
|
Scope can also be applied to a command using % before the scope name. For instance login%#Morbihan will limit diffusion of the login command (which is usually sent flood to get the path to a repeater) to the #Morbihan region.
|
|
3888
|
+
|
|
3889
|
+
default_scope for the device can be set/get by using set default_scope and get default_scope, if set, the scope will revert to this default.
|
|
3866
3890
|
""")
|
|
3867
3891
|
|
|
3868
3892
|
elif cmdname == "contact_info":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|