aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ngrok.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-10-12 07:35:42 +0000
committerGitHub <noreply@github.com>2022-10-12 07:35:42 +0000
commitdc1432e0dd2b826bbf5aee3e87d8270c151e4912 (patch)
tree276c27910e8ec38a1a054df02c67f73a84cb35df /modules/ngrok.py
parent1d64976dbc5a0f3124567b91fadd5014a9d93c5f (diff)
parentca5efc316b9431746ff886d259275310f63f95fb (diff)
downloadstable-diffusion-webui-gfx803-dc1432e0dd2b826bbf5aee3e87d8270c151e4912.tar.gz
stable-diffusion-webui-gfx803-dc1432e0dd2b826bbf5aee3e87d8270c151e4912.tar.bz2
stable-diffusion-webui-gfx803-dc1432e0dd2b826bbf5aee3e87d8270c151e4912.zip
Merge branch 'master' into feature/scale_to
Diffstat (limited to 'modules/ngrok.py')
-rw-r--r--modules/ngrok.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/ngrok.py b/modules/ngrok.py
new file mode 100644
index 00000000..7d03a6df
--- /dev/null
+++ b/modules/ngrok.py
@@ -0,0 +1,15 @@
+from pyngrok import ngrok, conf, exception
+
+
+def connect(token, port):
+ if token == None:
+ token = 'None'
+ conf.get_default().auth_token = token
+ try:
+ public_url = ngrok.connect(port).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')
+ else:
+ print(f'ngrok connected to localhost:{port}! URL: {public_url}\n'
+ 'You can use this link after the launch is complete.')