remoteRF-server 1.1.0.dev45__py3-none-any.whl → 1.1.0.dev47__py3-none-any.whl

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.
@@ -687,9 +687,21 @@ def _sync_contract(party: dict, peer: str, directory: list[dict]) -> str:
687
687
  return store.show(party["contract_id"], 1)["state"]
688
688
 
689
689
 
690
+ def _event_order(signed_event: str) -> tuple:
691
+ """(occurred_at, actor, actor_sequence) from the unverified payload -- for
692
+ ordering only; the store verifies every event before it counts."""
693
+ try:
694
+ payload = signed_event.split(".")[1]
695
+ claims = json.loads(base64.urlsafe_b64decode(payload + "=" * (-len(payload) % 4)))
696
+ return (int(claims["occurred_at"]), str(claims["iss"]), int(claims["actor_sequence"]))
697
+ except Exception: # noqa: BLE001 - malformed: let the store reject it, last
698
+ return (2**62, "", 0)
699
+
700
+
690
701
  def _import(store: ContractStore, terms: dict, events: list) -> str:
691
702
  """Import a directory entry; a contract already revoked here (an earlier
692
703
  cluster between the same labs) is simply reported as such."""
704
+ events = sorted(events, key=_event_order) # the relay's order is not the actors' order
693
705
  try:
694
706
  store.import_bundle(canonical_json({"protocol_version": "2", "terms": terms, "events": events}))
695
707
  except ContractError as exc:
@@ -27,6 +27,19 @@ from .global_onboarding import invite, lan_endpoint
27
27
  from .user_group_handler import user_group_handler
28
28
 
29
29
 
30
+ def _print_device_choices() -> None:
31
+ """The ids a whitelist can name, so nobody has to guess."""
32
+ from . import device_manager
33
+
34
+ devices = device_manager.get_all_devices_str()
35
+ if not devices:
36
+ print("No devices are configured yet (devices.yml).")
37
+ return
38
+ print("Devices on this server:")
39
+ for gid in sorted(devices):
40
+ print(f" {gid:>4} {devices[gid]}")
41
+
42
+
30
43
  def _invites(rows: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
31
44
  """Add the pasteable `invite` form to code rows (bare for LAN-only groups)."""
32
45
  lan_only = {
@@ -103,7 +116,8 @@ def make_user_group_local(session) -> None:
103
116
  return None
104
117
 
105
118
  if not s or s.lower() in {"all", "*"}:
106
- return [] # unrestricted: every device, including ones added later
119
+ print("List the device ids this group may use, e.g. '0,1,2'.")
120
+ continue
107
121
 
108
122
  # Allow both commas and whitespace
109
123
  parts = [p for p in s.replace(",", " ").split() if p]
@@ -136,7 +150,8 @@ def make_user_group_local(session) -> None:
136
150
  return
137
151
 
138
152
  # ---- Parameters ----
139
- devices_whitelist = _prompt_int_list("Devices whitelist (e.g. 0,1,2) [all] (c to cancel): ")
153
+ _print_device_choices()
154
+ devices_whitelist = _prompt_int_list("Devices whitelist (e.g. 0,1,2) (c to cancel): ")
140
155
  if devices_whitelist is None:
141
156
  return
142
157
 
@@ -157,7 +172,7 @@ def make_user_group_local(session) -> None:
157
172
  lan_only = not _prompt_yes_no("Reachable from outside your network (via Global)? (Y/n): ", default_no=False)
158
173
 
159
174
  # ---- Final confirmation ----
160
- wl_str = ",".join(map(str, devices_whitelist)) or "all"
175
+ wl_str = ",".join(map(str, devices_whitelist))
161
176
  print("\nAbout to create user group with:")
162
177
  print(f" group_name : {group_name}")
163
178
  print(f" devices_whitelist : {wl_str}")
@@ -270,7 +285,8 @@ def edit_user_group_local(session) -> None:
270
285
  if s == "":
271
286
  return "" # unchanged
272
287
  if s.lower() in {"all", "*"}:
273
- return [] # unrestricted: every device
288
+ print("List the device ids this group may use, e.g. '0,1,2'.")
289
+ return _prompt_devices_optional(msg)
274
290
  parts = [p for p in s.replace(",", " ").split() if p]
275
291
  try:
276
292
  vals = [int(p) for p in parts]
@@ -313,8 +329,9 @@ def edit_user_group_local(session) -> None:
313
329
  if group_name == "":
314
330
  group_name = None
315
331
 
332
+ _print_device_choices()
316
333
  devices_whitelist = _prompt_devices_optional(
317
- "New devices whitelist (e.g. 0,1,2 | all | Enter unchanged, c cancel): "
334
+ "New devices whitelist (e.g. 0,1,2 | Enter unchanged, c cancel): "
318
335
  )
319
336
  if devices_whitelist is None:
320
337
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: remoteRF-server
3
- Version: 1.1.0.dev45
3
+ Version: 1.1.0.dev47
4
4
  Summary: RemoteRF server-side control package
5
5
  License: GPL-3.0-or-later
6
6
  Classifier: Programming Language :: Python :: 3
@@ -63,7 +63,7 @@ remoteRF_server/server/grpc_server.py,sha256=91FpJubzN_Wfuk6fW_owIEzNCukd333sAGW
63
63
  remoteRF_server/server/host_dynamic_v2.py,sha256=1rJQwP4knSd0EXkByrSn_ryjLx81f6sp6SNYr_aEass,8105
64
64
  remoteRF_server/server/reservation.py,sha256=BQJLGNVAdKMZu2Lg4DGO9UhuJ0b1GSF8K1DgIOFrYUg,67816
65
65
  remoteRF_server/server/rpc_manager.py,sha256=BDvsTSVRxwNF2ujuMbIb5TYNAUI6AH4xXBuXrb8lltM,17223
66
- remoteRF_server/server/user_group_cli.py,sha256=8W3BV-_Wcy3EKapjwNWow8y6xlZYP-y6Ckb2BA1sdR4,25735
66
+ remoteRF_server/server/user_group_cli.py,sha256=0QbsGfeIqkyU6E1naGwR-i7BxptPMMTQCi1m7yM03JM,26259
67
67
  remoteRF_server/server/user_group_handler.py,sha256=1ax73W_P3H6GDxQS13evwA7G7skIElFVLuS0MFqsFyU,41780
68
68
  remoteRF_server/server/v2_errors.py,sha256=IS3hIhf5tDe7jaOrDAVQPjGBpqAjN7442BlJYgfJo7g,3331
69
69
  remoteRF_server/server/deployment/__init__.py,sha256=YV86uafd8XiGD7sLaqNfO5xxmt5te2R6DUhD-w1lZuY,77
@@ -71,7 +71,7 @@ remoteRF_server/server/deployment/capabilities.py,sha256=20RxmGG03VoQQZnV3jGhc-3
71
71
  remoteRF_server/server/federation/__init__.py,sha256=auqdGiGnEGIKQiXX2jFVt8iWmfyZ-V3w4dUmtWDKAZE,735
72
72
  remoteRF_server/server/federation/admin.py,sha256=t3F17FIytekzclPICmaFJEA4-F5OuWcDx3rgmFga17A,9187
73
73
  remoteRF_server/server/federation/cli.py,sha256=TIPfOdYxYDok7pR5g6COf_jUlcTFcj9o728kkLKcDqs,16351
74
- remoteRF_server/server/federation/cluster.py,sha256=7hFtUPJ6r3ldar2ExaoVKRCguWfnH4yZFKYDG4yyHPo,37828
74
+ remoteRF_server/server/federation/cluster.py,sha256=LunLUF5tk-kOjKV3DIxPTaeGow2zvOZsae2fs1XBSQE,38469
75
75
  remoteRF_server/server/federation/contracts.py,sha256=NYh7lb_9etJHFfzXwevjC4HfSBUypLxg5xGeBgydLF4,29305
76
76
  remoteRF_server/server/federation/destination.py,sha256=XawmGCiVbL_MfNNn8xwV9_bYxUDW1L7efCpL11K2JAc,35909
77
77
  remoteRF_server/server/federation/devices.py,sha256=n5MvnD0UZyl4sFpiekG9ProanWXTYizYq6YchCflLgY,18061
@@ -90,9 +90,9 @@ remoteRF_server/tools/gen_certs.py,sha256=Vbyu8JjRu__UYPVmyCRXt5SOw0Za1HV7g1md3G
90
90
  remoteRF_server/tools/gist_status.py,sha256=SFv2iQgQrIKT9gxKrU-_Dr7S0p0rE4wQM6J3OC6FcoM,4649
91
91
  remoteRF_server/tools/gist_status_testing.py,sha256=IYw7UkPjAUpKDTtIlnYGb5g6SJkwz4TRGUfJJ6f4LhQ,2690
92
92
  remoteRF_server/tools/introspect_uhd.py,sha256=vUpPb0rM9tsHPxWadS3EfMDE-gMd-TvNV0TjrZOQqBY,4531
93
- remoterf_server-1.1.0.dev45.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
94
- remoterf_server-1.1.0.dev45.dist-info/METADATA,sha256=qnArq0jpxUuzWtEecBK8T0hcOH9uoimCAXbmKGINhxk,42069
95
- remoterf_server-1.1.0.dev45.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
96
- remoterf_server-1.1.0.dev45.dist-info/entry_points.txt,sha256=_bbKk65PfYi-n6zUjqOiOwcalf_Ws1TCGATIe1TukxE,136
97
- remoterf_server-1.1.0.dev45.dist-info/top_level.txt,sha256=NuYWe8dSx3qdbxshWBwOgx68EHmJ9I8Zvxam4ARsQ_I,30
98
- remoterf_server-1.1.0.dev45.dist-info/RECORD,,
93
+ remoterf_server-1.1.0.dev47.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
94
+ remoterf_server-1.1.0.dev47.dist-info/METADATA,sha256=jRJsAiJF90sOYqLqwlGY7P7wa5bohJWgoEnoN_KMqnI,42069
95
+ remoterf_server-1.1.0.dev47.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
96
+ remoterf_server-1.1.0.dev47.dist-info/entry_points.txt,sha256=_bbKk65PfYi-n6zUjqOiOwcalf_Ws1TCGATIe1TukxE,136
97
+ remoterf_server-1.1.0.dev47.dist-info/top_level.txt,sha256=NuYWe8dSx3qdbxshWBwOgx68EHmJ9I8Zvxam4ARsQ_I,30
98
+ remoterf_server-1.1.0.dev47.dist-info/RECORD,,