weed-cli 1.2.2__tar.gz → 1.2.5__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.2.2
3
+ Version: 1.2.5
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
@@ -825,7 +825,26 @@ def download_with_auction(content_hash, relay_urls, out_path=None, k=3, use_ligh
825
825
 
826
826
  # ── discovery + social signals ──────────────────────────────────────────
827
827
 
828
+ def _relay_url_hint(relay_url):
829
+ """Relays are plain HTTP(S) endpoints, hit via urllib -- tls:// is a
830
+ completely different, unrelated convention that only means something
831
+ to --tunnel (a hand-rolled raw-TCP-plus-TLS protocol, see
832
+ _connect_tunnel_socket/connect_via_tunnel). Easy to mix up since both
833
+ flags take a host:port-shaped value and this same tool uses tls://
834
+ for the other one; without this check the failure is just urllib's
835
+ raw 'unknown url type: tls' with no hint about why."""
836
+ if relay_url.startswith('tls://'):
837
+ return (f"{relay_url!r} looks like a --tunnel address, not a relay URL — "
838
+ f"relays are plain HTTP(S) endpoints, try "
839
+ f"'https://{relay_url[len('tls://'):]}' for --relay instead "
840
+ f"(tls:// only means something to --tunnel)")
841
+ return None
842
+
843
+
828
844
  def post_event(relay_url, event):
845
+ hint = _relay_url_hint(relay_url)
846
+ if hint:
847
+ return {'ok': False, 'error': hint}
829
848
  req = urllib.request.Request(
830
849
  f'{relay_url}/event', data=json.dumps(event).encode(),
831
850
  headers={'Content-Type': 'application/json'}, method='POST')
@@ -845,6 +864,10 @@ def post_event(relay_url, event):
845
864
 
846
865
 
847
866
  def fetch_events(relay_url, event_type=None):
867
+ hint = _relay_url_hint(relay_url)
868
+ if hint:
869
+ print(f" {relay_url}: {hint}")
870
+ return None
848
871
  url = f'{relay_url}/events' + (f'?type={event_type}' if event_type else '')
849
872
  try:
850
873
  with urllib.request.urlopen(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.2.2"
7
+ version = "1.2.5"
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" }
@@ -137,7 +137,7 @@ def _rehydrate_jobs_from_library():
137
137
  'status': 'done', 'idx': 0, 'n_chunks': None,
138
138
  'content_hash': content_hash, 'path': rec['path'],
139
139
  'title': rec.get('title'), 'size': rec.get('size'), 'bps': rec.get('bps'),
140
- 'signer_pubkey': rec.get('signer_pubkey'), 'error': None,
140
+ 'error': None,
141
141
  }
142
142
  _lan_url = None # set once in run_web_ui() -- the base URL a phone on the
143
143
  # same LAN can actually reach this server at, or None if
@@ -211,8 +211,7 @@ def _run_host_job(host_id, archive_dir, file_name, port, price, relay_urls, adve
211
211
  _hosts[host_id].update(status='error', error=f'{type(e).__name__}: {e}')
212
212
 
213
213
 
214
- def _run_download_job(job_id, content_hash, relay_urls, out_path, k, use_lightning, title=None,
215
- signer_pubkey=None):
214
+ def _run_download_job(job_id, content_hash, relay_urls, out_path, k, use_lightning, title=None):
216
215
  def on_progress(idx, n_chunks):
217
216
  with _lock:
218
217
  _jobs[job_id].update(idx=idx, n_chunks=n_chunks)
@@ -230,7 +229,6 @@ def _run_download_job(job_id, content_hash, relay_urls, out_path, k, use_lightni
230
229
  _library['downloads'][content_hash] = {
231
230
  'content_hash': content_hash, 'job_id': job_id, 'path': path,
232
231
  'title': title, 'downloaded_at': time.time(), 'size': size, 'bps': bps,
233
- 'signer_pubkey': signer_pubkey,
234
232
  }
235
233
  _save_library()
236
234
  except SystemExit as e:
@@ -358,16 +356,13 @@ class Handler(BaseHTTPRequestHandler):
358
356
  k = int(body.get('k') or 3)
359
357
  use_lightning = bool(body.get('lightning'))
360
358
  title = body.get('title')
361
- signer_pubkey = body.get('signer_pubkey')
362
359
 
363
360
  job_id = uuid.uuid4().hex[:12]
364
361
  with _lock:
365
362
  _jobs[job_id] = {'status': 'running', 'idx': 0, 'n_chunks': None,
366
- 'content_hash': content_hash, 'path': None, 'title': title,
367
- 'signer_pubkey': signer_pubkey, 'error': None}
363
+ 'content_hash': content_hash, 'path': None, 'title': title, 'error': None}
368
364
  threading.Thread(target=_run_download_job,
369
- args=(job_id, content_hash, relay_urls, out_path, k, use_lightning, title,
370
- signer_pubkey),
365
+ args=(job_id, content_hash, relay_urls, out_path, k, use_lightning, title),
371
366
  daemon=True).start()
372
367
  self._json({'job_id': job_id})
373
368
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weed-cli
3
- Version: 1.2.2
3
+ Version: 1.2.5
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
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
File without changes