diff options
author | JingShing <JingShingLai@gmail.com> | 2022-11-10 12:39:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-10 12:39:20 +0000 |
commit | 2505f39e28177452a92426f3b60d8edbe6ed1b14 (patch) | |
tree | 532d4535e4290ffe424176a9c3279164fbfb1c3b /modules/ngrok.py | |
parent | ac085628540d0ec6a988fad93f5b8f2154209571 (diff) | |
download | stable-diffusion-webui-gfx803-2505f39e28177452a92426f3b60d8edbe6ed1b14.tar.gz stable-diffusion-webui-gfx803-2505f39e28177452a92426f3b60d8edbe6ed1b14.tar.bz2 stable-diffusion-webui-gfx803-2505f39e28177452a92426f3b60d8edbe6ed1b14.zip |
Add username and password in ngrok.
Diffstat (limited to 'modules/ngrok.py')
-rw-r--r-- | modules/ngrok.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/ngrok.py b/modules/ngrok.py index 5c5f349a..e506accb 100644 --- a/modules/ngrok.py +++ b/modules/ngrok.py @@ -1,14 +1,22 @@ from pyngrok import ngrok, conf, exception - def connect(token, port, region): if token == None: token = 'None' + else: + if ':' in token: + # token = authtoken:username:password + account = token.split(':')[1] + ':' + token.split(':')[-1] + token = token.split(':')[0] + config = conf.PyngrokConfig( auth_token=token, region=region ) try: - public_url = ngrok.connect(port, pyngrok_config=config).public_url + if account: + public_url = ngrok.connect(port, pyngrok_config=config, auth=account).public_url + else: + public_url = ngrok.connect(port, pyngrok_config=config).public_url except exception.PyngrokNgrokError: print(f'Invalid ngrok authtoken, ngrok connection aborted.\n' f'Your token: {token}, get the right one on https://dashboard.ngrok.com/get-started/your-authtoken') |