weed-cli 1.6.2__tar.gz → 1.6.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weed-cli
3
- Version: 1.6.2
3
+ Version: 1.6.7
4
4
  Summary: Censorship-resistant video PoC — discovery/hosting/download over signed relay events, a real Kademlia DHT, or a TLS-capable NAT-traversal tunnel
5
5
  License: MIT
6
6
  Keywords: p2p,video,censorship-resistant,discovery,dht,kademlia,nat-traversal
@@ -174,19 +174,28 @@ blind.
174
174
  ### Docker
175
175
 
176
176
  `Dockerfile.node` + `docker-compose.node.yml` package `web_ui.py` to run
177
- somewhere other than a laptop.
177
+ somewhere other than a laptop — alongside its own local discovery relay
178
+ (`Dockerfile.discovery-relay`), so there's always something real for it
179
+ to announce to and discover from out of the box.
178
180
 
179
181
  ```bash
180
182
  make node # build + run, http://127.0.0.1:8080
181
183
  make node-down # stop it — data persists
184
+ make node-shell # interactive weed shell, same container as the running node
182
185
  WEED_SHARE_DIR=~/Movies make node # mount a real directory of .ott archives at /share
183
- docker compose -f docker-compose.node.yml exec node python3 shell.py # interactive shell, same container
184
186
  docker compose -f docker-compose.node.yml exec node python3 weed.py discover # or a one-off CLI command
185
187
  ```
186
188
 
187
189
  - Identity key, reputation store, and library manifest all persist in a
188
190
  named volume (`node-data`, mounted at `$HOME=/data`) — one node keeps
189
191
  the same pubkey (and everything vouching for it) across restarts.
192
+ - The `relay` service is `node`'s default `WEED_RELAY` (`http://relay:9101`,
193
+ resolved over Compose's own network) — its events persist in their own
194
+ `relay-data` volume, and port 9101 is published to the host too, for
195
+ curling `/events` directly or pointing a non-Docker `weed`/shell session
196
+ at the exact same relay. Override `WEED_RELAY` (shell env or `.env`,
197
+ see `.env.sample`) to point at public infra instead, e.g. for a real
198
+ end-to-end test.
190
199
  - `/share` is a separate *bind* mount, not a named volume, so the actual
191
200
  `.ott` archives you're hosting are real files on the host you can see
192
201
  and manage directly. Point the web UI's Host form at `/share`.
@@ -144,19 +144,28 @@ blind.
144
144
  ### Docker
145
145
 
146
146
  `Dockerfile.node` + `docker-compose.node.yml` package `web_ui.py` to run
147
- somewhere other than a laptop.
147
+ somewhere other than a laptop — alongside its own local discovery relay
148
+ (`Dockerfile.discovery-relay`), so there's always something real for it
149
+ to announce to and discover from out of the box.
148
150
 
149
151
  ```bash
150
152
  make node # build + run, http://127.0.0.1:8080
151
153
  make node-down # stop it — data persists
154
+ make node-shell # interactive weed shell, same container as the running node
152
155
  WEED_SHARE_DIR=~/Movies make node # mount a real directory of .ott archives at /share
153
- docker compose -f docker-compose.node.yml exec node python3 shell.py # interactive shell, same container
154
156
  docker compose -f docker-compose.node.yml exec node python3 weed.py discover # or a one-off CLI command
155
157
  ```
156
158
 
157
159
  - Identity key, reputation store, and library manifest all persist in a
158
160
  named volume (`node-data`, mounted at `$HOME=/data`) — one node keeps
159
161
  the same pubkey (and everything vouching for it) across restarts.
162
+ - The `relay` service is `node`'s default `WEED_RELAY` (`http://relay:9101`,
163
+ resolved over Compose's own network) — its events persist in their own
164
+ `relay-data` volume, and port 9101 is published to the host too, for
165
+ curling `/events` directly or pointing a non-Docker `weed`/shell session
166
+ at the exact same relay. Override `WEED_RELAY` (shell env or `.env`,
167
+ see `.env.sample`) to point at public infra instead, e.g. for a real
168
+ end-to-end test.
160
169
  - `/share` is a separate *bind* mount, not a named volume, so the actual
161
170
  `.ott` archives you're hosting are real files on the host you can see
162
171
  and manage directly. Point the web UI's Host form at `/share`.
@@ -1034,6 +1034,26 @@ def _relay_url_hint(relay_url):
1034
1034
  return None
1035
1035
 
1036
1036
 
1037
+ def _normalize_relay_url(relay_url):
1038
+ """A bare host:port with no scheme (e.g. '127.0.0.1:9101', the most
1039
+ natural way to type a local relay) isn't a URL urllib can parse at
1040
+ all -- everything before the first ':' becomes the *scheme*, so this
1041
+ reads as scheme '127.0.0.1' and raises "unknown url type", not a
1042
+ connection error. That already lands on post_event/fetch_events'
1043
+ existing except clauses (an unreachable relay is routine, not
1044
+ exceptional), which is exactly the trap: hosting against a
1045
+ scheme-less relay used to report status: running with zero actual
1046
+ announcements ever reaching it, and discover against one silently
1047
+ came back empty -- nothing hinted that the URL itself, not the
1048
+ relay, was the problem. Every relay this project actually ships or
1049
+ documents is plain HTTP(S), so defaulting a missing scheme to
1050
+ http:// turns the common typo into the thing the user obviously
1051
+ meant instead of a silent no-op."""
1052
+ if '://' not in relay_url:
1053
+ return 'http://' + relay_url
1054
+ return relay_url
1055
+
1056
+
1037
1057
  _dns_bound_pool = concurrent.futures.ThreadPoolExecutor(max_workers=8, thread_name_prefix='urlopen')
1038
1058
 
1039
1059
 
@@ -1059,6 +1079,7 @@ def post_event(relay_url, event):
1059
1079
  hint = _relay_url_hint(relay_url)
1060
1080
  if hint:
1061
1081
  return {'ok': False, 'error': hint}
1082
+ relay_url = _normalize_relay_url(relay_url)
1062
1083
  req = urllib.request.Request(
1063
1084
  f'{relay_url}/event', data=json.dumps(event).encode(),
1064
1085
  headers={'Content-Type': 'application/json'}, method='POST')
@@ -1082,6 +1103,7 @@ def fetch_events(relay_url, event_type=None):
1082
1103
  if hint:
1083
1104
  print(f" {relay_url}: {hint}")
1084
1105
  return None
1106
+ relay_url = _normalize_relay_url(relay_url)
1085
1107
  url = f'{relay_url}/events' + (f'?type={event_type}' if event_type else '')
1086
1108
  try:
1087
1109
  with _urlopen_bounded(url, timeout=5) as resp:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "weed-cli"
7
- version = "1.6.2"
7
+ version = "1.6.7"
8
8
  description = "Censorship-resistant video PoC — discovery/hosting/download over signed relay events, a real Kademlia DHT, or a TLS-capable NAT-traversal tunnel"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -351,8 +351,21 @@ def _run_host_job(host_id, archive_dir, file_name, port, price, relay_urls, adve
351
351
  for entry in entries:
352
352
  for relay_url in relay_urls:
353
353
  host_addr = f'{advertise_host}:{port}'
354
- node.publish(identity, relay_url, entry['sha256'], entry['name'], host_addr,
355
- tunnel=tunnel, ott_status=ott_status)
354
+ result = node.publish(identity, relay_url, entry['sha256'], entry['name'], host_addr,
355
+ tunnel=tunnel, ott_status=ott_status)
356
+ # publish()/post_event() report a failed announce as a
357
+ # normal {'ok': False, ...} return, not an exception (an
358
+ # unreachable or malformed relay is routine, not
359
+ # exceptional -- see post_event's own docstring) -- which
360
+ # this loop used to just ignore entirely, so a host could
361
+ # sit at status: running, "announced" on a relay it never
362
+ # actually reached, with nothing in the UI to say so.
363
+ # do_host (shell.py) already prints every result
364
+ # unconditionally; this only prints the failures; a
365
+ # working host's log staying free of routine "ok: True"
366
+ # noise matters more here than in a CLI's own scrollback.
367
+ if isinstance(result, dict) and not result.get('ok', True):
368
+ print(f' ✗ announce to {relay_url} failed: {result.get("error")}')
356
369
  announced = relay_urls
357
370
  files = [{'name': e['name'], 'content_hash': e['sha256']} for e in entries]
358
371
  with _lock:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weed-cli
3
- Version: 1.6.2
3
+ Version: 1.6.7
4
4
  Summary: Censorship-resistant video PoC — discovery/hosting/download over signed relay events, a real Kademlia DHT, or a TLS-capable NAT-traversal tunnel
5
5
  License: MIT
6
6
  Keywords: p2p,video,censorship-resistant,discovery,dht,kademlia,nat-traversal
@@ -174,19 +174,28 @@ blind.
174
174
  ### Docker
175
175
 
176
176
  `Dockerfile.node` + `docker-compose.node.yml` package `web_ui.py` to run
177
- somewhere other than a laptop.
177
+ somewhere other than a laptop — alongside its own local discovery relay
178
+ (`Dockerfile.discovery-relay`), so there's always something real for it
179
+ to announce to and discover from out of the box.
178
180
 
179
181
  ```bash
180
182
  make node # build + run, http://127.0.0.1:8080
181
183
  make node-down # stop it — data persists
184
+ make node-shell # interactive weed shell, same container as the running node
182
185
  WEED_SHARE_DIR=~/Movies make node # mount a real directory of .ott archives at /share
183
- docker compose -f docker-compose.node.yml exec node python3 shell.py # interactive shell, same container
184
186
  docker compose -f docker-compose.node.yml exec node python3 weed.py discover # or a one-off CLI command
185
187
  ```
186
188
 
187
189
  - Identity key, reputation store, and library manifest all persist in a
188
190
  named volume (`node-data`, mounted at `$HOME=/data`) — one node keeps
189
191
  the same pubkey (and everything vouching for it) across restarts.
192
+ - The `relay` service is `node`'s default `WEED_RELAY` (`http://relay:9101`,
193
+ resolved over Compose's own network) — its events persist in their own
194
+ `relay-data` volume, and port 9101 is published to the host too, for
195
+ curling `/events` directly or pointing a non-Docker `weed`/shell session
196
+ at the exact same relay. Override `WEED_RELAY` (shell env or `.env`,
197
+ see `.env.sample`) to point at public infra instead, e.g. for a real
198
+ end-to-end test.
190
199
  - `/share` is a separate *bind* mount, not a named volume, so the actual
191
200
  `.ott` archives you're hosting are real files on the host you can see
192
201
  and manage directly. Point the web UI's Host form at `/share`.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes