diff --git a/README.md b/README.md index 51c6517..2d20b6f 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ You can get a token [here](https://jprq.io/auth). add `--bore` to commandline options. +add `--bore_url "URL"` for custom bore url. url without 'http://' and (optional) port. example: myboreserver.com or myboreserver.com:12345 + ----- ### Discord webhook diff --git a/preload.py b/preload.py index eebd41a..eb7455f 100644 --- a/preload.py +++ b/preload.py @@ -32,6 +32,12 @@ def preload(parser: argparse.ArgumentParser): help="use bore, alternative to gradio --share", ) + parser.add_argument( + "--bore_url", + type=str, + help="custom bore url. url without 'http://' and (optional) port. example: myboreserver.com or myboreserver.com:12345", + ) + parser.add_argument( "--tunnel-webhook", type=str, help="discord webhook to send tunnel url to" ) diff --git a/pyproject.toml b/pyproject.toml index 07b5fad..55405a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "sd-webui-tunnels" -version = "23.4.2" +version = "23.5.0" description = "Tunneling extension for automatic1111 sd-webui" authors = [ {name = "dowon", email = "ks2515@naver.com"}, diff --git a/scripts/tntn_tunnel.py b/scripts/tntn_tunnel.py index 1b43c19..d45a03a 100644 --- a/scripts/tntn_tunnel.py +++ b/scripts/tntn_tunnel.py @@ -4,6 +4,17 @@ from tntn import bore, jprq from discord_webhook import send_to_discord from modules.shared import cmd_opts + +def bore_url(s: str): + if ":" in s: + host, port = s.split(":") + port = int(port) + else: + host = s + port = None + return host, port + + port = cmd_opts.port if cmd_opts.port else 7860 if cmd_opts.jprq: @@ -19,7 +30,13 @@ if cmd_opts.jprq: script_callbacks.on_app_started(jprq_callback) if cmd_opts.bore: - bore_urls = bore(port) + host, bore_port = bore_url(cmd_opts.bore_url) if cmd_opts.bore_url else (None, None) + kwargs = {} + if host is not None: + kwargs["bore_url"] = host + if bore_port is not None: + kwargs["bore_port"] = bore_port + bore_urls = bore(port, **kwargs) if cmd_opts.tunnel_webhook: send_to_discord(bore_urls.tunnel, cmd_opts.tunnel_webhook)