From 201363d83ef537dc0c8ade14261ee9378d0054aa Mon Sep 17 00:00:00 2001 From: ILG2021 <> Date: Tue, 19 Dec 2023 18:59:57 +1000 Subject: [PATCH 1/3] support for open a url --- eel/browsers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eel/browsers.py b/eel/browsers.py index d555b2d9..beaa441c 100644 --- a/eel/browsers.py +++ b/eel/browsers.py @@ -30,7 +30,10 @@ def _build_url_from_string(page: str, options: OptionsDictT) -> str: if not isinstance(options['port'], (int, str)): raise TypeError("'port' option must be an integer") base_url = 'http://%s:%d/' % (options['host'], int(options['port'])) - return base_url + page + if "http" in page: + return page + else: + return base_url + page def _build_urls(start_pages: Iterable[Union[str, Dict[str, str]]], options: OptionsDictT) -> List[str]: From a3fc468814b74ed68942e793a532fbe68301cd8b Mon Sep 17 00:00:00 2001 From: luke <> Date: Mon, 21 Oct 2024 11:55:19 +1000 Subject: [PATCH 2/3] Fix bug : websocket can not be created successfully in eel.js when run react app in develop mode --- eel/eel.js | 2 +- examples/07 - CreateReactApp/eel_CRA.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/eel/eel.js b/eel/eel.js index cc824206..8f8f3e10 100644 --- a/eel/eel.js +++ b/eel/eel.js @@ -1,5 +1,5 @@ eel = { - _host: window.location.origin, + _host: new URL(document.currentScript.src).origin, set_host: function (hostname) { eel._host = hostname diff --git a/examples/07 - CreateReactApp/eel_CRA.py b/examples/07 - CreateReactApp/eel_CRA.py index 504256c0..a8e256c9 100644 --- a/examples/07 - CreateReactApp/eel_CRA.py +++ b/examples/07 - CreateReactApp/eel_CRA.py @@ -61,6 +61,7 @@ def start_eel(develop): host='localhost', port=8080, size=(1280, 800), + shutdown_delay=60 # Prevent disconnect when webpack hot refresh ) try: eel.start(page, mode=app, **eel_kwargs) From 2b1b09b330b8133578fcc5c565e2fc52614cc251 Mon Sep 17 00:00:00 2001 From: luke Date: Sun, 26 Apr 2026 18:41:56 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=E5=90=8E=E7=AB=AF=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=A4=A7=E6=96=87=E4=BB=B6=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=EF=BC=8C=E5=A6=82=E6=9E=9C=E8=BF=98=E6=9C=89=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E8=AF=B7=E6=B1=82=E8=BF=94=E5=9B=9E=E4=BA=86=EF=BC=8C?= =?UTF-8?q?websocket=E4=BC=A0=E9=80=81=E4=BC=9A=E5=BC=82=E5=B8=B8=E3=80=82?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E8=BF=99=E4=B8=AAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eel/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/eel/__init__.py b/eel/__init__.py index 34fc7ce1..76f82938 100644 --- a/eel/__init__.py +++ b/eel/__init__.py @@ -527,13 +527,17 @@ def _safe_json(obj: Any) -> str: return jsn.dumps(obj, default=lambda o: None) +import gevent.lock +_ws_send_lock = gvt.lock.BoundedSemaphore(1) + def _repeated_send(ws: WebSocketT, msg: str) -> None: - for attempt in range(100): - try: - ws.send(msg) - break - except Exception: - sleep(0.001) + with _ws_send_lock: # ← 加这一行 + for attempt in range(100): + try: + ws.send(msg) + break + except Exception: + sleep(0.001) def _process_message(message: Dict[str, Any], ws: WebSocketT) -> None: