diff --git a/app/core/background/convert_v3_service.py b/app/core/background/convert_v3_service.py index f950ba7..42f28a1 100644 --- a/app/core/background/convert_v3_service.py +++ b/app/core/background/convert_v3_service.py @@ -376,7 +376,12 @@ async def _pick_pending(limit: int) -> List[Tuple[EncryptedContent, PlainStaging if not staging: peers = (await session.execute(select(KnownNode))).scalars().all() for peer in peers: - base_url = f"http://{peer.ip}:{peer.port}" + meta = peer.meta or {} + public_host = meta.get('public_host') + if not public_host: + last_resp = (meta.get('last_response') or {}).get('node', {}) if isinstance(meta, dict) else {} + public_host = last_resp.get('public_host') + base_url = public_host or f"http://{peer.ip}:{peer.port}" dek = await request_key_from_peer(base_url, ec.encrypted_cid) if not dek: continue diff --git a/app/core/network/key_client.py b/app/core/network/key_client.py index 04fc781..2e03d04 100644 --- a/app/core/network/key_client.py +++ b/app/core/network/key_client.py @@ -1,6 +1,7 @@ from __future__ import annotations import base64 +import json from typing import Optional import httpx