diff options
author | Nathanael Santoso <73165142+nart4hire@users.noreply.github.com> | 2023-04-04 06:50:29 +0000 |
---|---|---|
committer | Nathanael Santoso <73165142+nart4hire@users.noreply.github.com> | 2023-04-04 06:50:29 +0000 |
commit | 5ebe3b25044efac959c4d8f208dd17d6f1e5ce8a (patch) | |
tree | 6f223d657edc6b9713d2f8eaf81f1186acfc915c /modules | |
parent | 22bcc7be428c94e9408f589966c2040187245d81 (diff) | |
download | stable-diffusion-webui-gfx803-5ebe3b25044efac959c4d8f208dd17d6f1e5ce8a.tar.gz stable-diffusion-webui-gfx803-5ebe3b25044efac959c4d8f208dd17d6f1e5ce8a.tar.bz2 stable-diffusion-webui-gfx803-5ebe3b25044efac959c4d8f208dd17d6f1e5ce8a.zip |
Added guard clause to prevent multiple tunnel creations
Diffstat (limited to 'modules')
-rw-r--r-- | modules/ngrok.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/ngrok.py b/modules/ngrok.py index 3df2c06b..90268bf1 100644 --- a/modules/ngrok.py +++ b/modules/ngrok.py @@ -1,6 +1,14 @@ from pyngrok import ngrok, conf, exception def connect(token, port, region): + # Guard for existing tunnels + existing = ngrok.get_tunnels() + if existing: + public_url = existing[0].public_url + print(f'ngrok connected to localhost:{port}! URL: {public_url}\n' + 'You can use this link after the launch is complete.') + return + account = None if token is None: token = 'None' |