From 201363d83ef537dc0c8ade14261ee9378d0054aa Mon Sep 17 00:00:00 2001 From: ILG2021 <> Date: Tue, 19 Dec 2023 18:59:57 +1000 Subject: [PATCH 1/2] 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/2] 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)