diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-04-29 19:23:21 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-04-29 19:23:21 +0000 |
commit | e23063610f4695ce12f963e06e78154f5ce128d1 (patch) | |
tree | eeab6971022d4ee0e1bfd6a8b603b0e950a6c868 /modules/ngrok.py | |
parent | 22bcc7be428c94e9408f589966c2040187245d81 (diff) | |
parent | cd7f2b19f45a28c8eeb88994c8972c61c8a3c63d (diff) | |
download | stable-diffusion-webui-gfx803-e23063610f4695ce12f963e06e78154f5ce128d1.tar.gz stable-diffusion-webui-gfx803-e23063610f4695ce12f963e06e78154f5ce128d1.tar.bz2 stable-diffusion-webui-gfx803-e23063610f4695ce12f963e06e78154f5ce128d1.zip |
Merge branch 'dev' into release_candidate
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 |