feat: custom bore url

main v23.5.0
Bingsu 2023-05-05 19:25:07 +09:00
parent bed377f04f
commit b41aaa3284
4 changed files with 27 additions and 2 deletions

View File

@ -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

View File

@ -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"
)

View File

@ -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"},

View File

@ -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)