Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
rusiaaman committed Jan 14, 2025
1 parent 27bd575 commit 537553b
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/wcgw/client/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,26 +816,6 @@ def execute_bash(
return output, 0


def serve_image_in_bg(file_path: str, client_uuid: str, name: str) -> None:
if not client_uuid:
client_uuid = str(uuid.uuid4())

server_url = "wss://wcgw.arcfu.com/register_serve_image"

with open(file_path, "rb") as image_file:
image_bytes = image_file.read()
media_type = mimetypes.guess_type(file_path)[0]
image_b64 = base64.b64encode(image_bytes).decode("utf-8")
uu = {"name": name, "image_b64": image_b64, "media_type": media_type}

with syncconnect(f"{server_url}/{client_uuid}") as websocket:
try:
websocket.send(json.dumps(uu))
except websockets.ConnectionClosed:
console.print(f"Connection closed for UUID: {client_uuid}, retrying")
serve_image_in_bg(file_path, client_uuid, name)


MEDIA_TYPES = Literal["image/jpeg", "image/png", "image/gif", "image/webp"]


Expand Down

0 comments on commit 537553b

Please sign in to comment.