weed-cli 1.6.8__tar.gz → 1.7.0__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.8
3
+ Version: 1.7.0
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "weed-cli"
7
- version = "1.6.8"
7
+ version = "1.7.0"
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" }
@@ -565,7 +565,7 @@ class Handler(BaseHTTPRequestHandler):
565
565
  '/api/playlists/delete': self._handle_playlist_delete,
566
566
  '/api/playlists/add': self._handle_playlist_add,
567
567
  '/api/playlists/remove': self._handle_playlist_remove,
568
- '/api/playlists/move': self._handle_playlist_move,
568
+ '/api/playlists/reorder': self._handle_playlist_reorder,
569
569
  }
570
570
  handler = handlers.get(path)
571
571
  if not handler:
@@ -711,25 +711,30 @@ class Handler(BaseHTTPRequestHandler):
711
711
  _save_library()
712
712
  self._json({'playlist': playlist})
713
713
 
714
- def _handle_playlist_move(self, body):
714
+ def _handle_playlist_reorder(self, body):
715
+ """Whole-list reorder (drag-and-drop's own natural shape) rather
716
+ than one-step-at-a-time move -- a real drag can jump an item
717
+ several positions in one gesture, and doing that as N sequential
718
+ up/down calls (the earlier arrow-button UI's own approach) is both
719
+ chattier and racier under Vue's own optimistic local reorder than
720
+ just telling the server the whole new order in one call."""
715
721
  playlist_id = body.get('playlist_id')
716
- content_hash = body.get('content_hash')
717
- direction = body.get('direction')
718
- if not playlist_id or not content_hash or direction not in ('up', 'down'):
719
- return self._json({'error': "playlist_id, content_hash, and direction ('up'|'down') required"},
720
- status=400)
722
+ order = body.get('order')
723
+ if not playlist_id or not isinstance(order, list):
724
+ return self._json({'error': 'playlist_id and order (list of content_hash) required'}, status=400)
721
725
  with _lock:
722
726
  playlist = next((p for p in _library['playlists'] if p['id'] == playlist_id), None)
723
727
  if not playlist:
724
728
  return self._json({'error': 'no such playlist'}, status=404)
725
- items = playlist['items']
726
- idx = next((i for i, it in enumerate(items) if it['content_hash'] == content_hash), None)
727
- if idx is None:
728
- return self._json({'error': 'content_hash not in this playlist'}, status=404)
729
- swap_with = idx - 1 if direction == 'up' else idx + 1
730
- if 0 <= swap_with < len(items):
731
- items[idx], items[swap_with] = items[swap_with], items[idx]
732
- _save_library()
729
+ by_hash = {it['content_hash']: it for it in playlist['items']}
730
+ # order is trusted for *sequence* only, not as the source of
731
+ # truth for membership -- an item order somehow omits (a stale
732
+ # client, a concurrent add from another tab) stays in the
733
+ # playlist, just at the end, rather than silently vanishing
734
+ reordered = [by_hash.pop(h) for h in order if h in by_hash]
735
+ reordered.extend(by_hash.values())
736
+ playlist['items'] = reordered
737
+ _save_library()
733
738
  self._json({'playlist': playlist})
734
739
 
735
740
  def _handle_verify(self, body):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weed-cli
3
- Version: 1.6.8
3
+ Version: 1.7.0
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
File without changes