diff options
author | papuSpartan <30642826+papuSpartan@users.noreply.github.com> | 2023-05-03 07:21:50 +0000 |
---|---|---|
committer | papuSpartan <30642826+papuSpartan@users.noreply.github.com> | 2023-05-03 07:21:50 +0000 |
commit | f08ae961157d33051b5cd09ba5c77b779096ef69 (patch) | |
tree | 038e0f511d51816c0a971d6093da0420b5677ae0 /modules/ngrok.py | |
parent | dff60e2e74964a8b02b75ecd8cf8007ef67a9712 (diff) | |
parent | 335428c2c8139dfe07ba096a6defa75036660244 (diff) | |
download | stable-diffusion-webui-gfx803-f08ae961157d33051b5cd09ba5c77b779096ef69.tar.gz stable-diffusion-webui-gfx803-f08ae961157d33051b5cd09ba5c77b779096ef69.tar.bz2 stable-diffusion-webui-gfx803-f08ae961157d33051b5cd09ba5c77b779096ef69.zip |
resolve merge conflicts and swap to dev branch for now
Diffstat (limited to 'modules/ngrok.py')
-rw-r--r-- | modules/ngrok.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/ngrok.py b/modules/ngrok.py index 3df2c06b..1ad7989b 100644 --- a/modules/ngrok.py +++ b/modules/ngrok.py @@ -13,6 +13,18 @@ def connect(token, port, region): config = conf.PyngrokConfig( auth_token=token, region=region ) + + # Guard for existing tunnels + existing = ngrok.get_tunnels(pyngrok_config=config) + if existing: + for established in existing: + # Extra configuration in the case that the user is also using ngrok for other tunnels + if established.config['addr'][-4:] == str(port): + public_url = existing[0].public_url + print(f'ngrok has already been connected to localhost:{port}! URL: {public_url}\n' + 'You can use this link after the launch is complete.') + return + try: if account is None: public_url = ngrok.connect(port, pyngrok_config=config, bind_tls=True).public_url |