aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ngrok.py
diff options
context:
space:
mode:
authoryfszzx <yfszzx@gmail.com>2022-10-12 12:48:03 +0000
committeryfszzx <yfszzx@gmail.com>2022-10-12 12:48:03 +0000
commit511ca57e37483aac0cf260c89838ad2948509101 (patch)
tree8d6fb6ccd0cfc470460c68cf8d054bfc98dbdb34 /modules/ngrok.py
parente05573e1adc1cde1e3bd7eb651a1ab27c446b3d5 (diff)
parenta36dea9596c8880609401ce4fa7ab83cf70a9b2b (diff)
downloadstable-diffusion-webui-gfx803-511ca57e37483aac0cf260c89838ad2948509101.tar.gz
stable-diffusion-webui-gfx803-511ca57e37483aac0cf260c89838ad2948509101.tar.bz2
stable-diffusion-webui-gfx803-511ca57e37483aac0cf260c89838ad2948509101.zip
Merge branch 'master' of https://github.com/yfszzx/stable-diffusion-webui-plus
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.')