aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ngrok.py
diff options
context:
space:
mode:
author不会画画的中医不是好程序员 <yfszzx@gmail.com>2022-10-11 13:03:41 +0000
committerGitHub <noreply@github.com>2022-10-11 13:03:41 +0000
commita36dea9596c8880609401ce4fa7ab83cf70a9b2b (patch)
treec63a41ad4d2c8b314a526d6e44710391be1426b7 /modules/ngrok.py
parent87d63bbab5c973ac5cec777ef7304d28f1ab3f24 (diff)
parentb0583be0884cd17dafb408fd79b52b2a0a972563 (diff)
downloadstable-diffusion-webui-gfx803-a36dea9596c8880609401ce4fa7ab83cf70a9b2b.tar.gz
stable-diffusion-webui-gfx803-a36dea9596c8880609401ce4fa7ab83cf70a9b2b.tar.bz2
stable-diffusion-webui-gfx803-a36dea9596c8880609401ce4fa7ab83cf70a9b2b.zip
Merge branch 'master' into master
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.')