change localhost -> 127.0.0.1

This commit is contained in:
w-okada 2023-08-04 06:53:57 +09:00
parent 7ac8a9497d
commit 7b82f021d8

View File

@ -205,20 +205,20 @@ if __name__ == "__main__":
printMessage("In many cases, it will launch when you access any of the following URLs.", level=2) printMessage("In many cases, it will launch when you access any of the following URLs.", level=2)
if "EX_PORT" in locals() and "EX_IP" in locals(): # シェルスクリプト経由起動(docker) if "EX_PORT" in locals() and "EX_IP" in locals(): # シェルスクリプト経由起動(docker)
if args.https == 1: if args.https == 1:
printMessage(f"https://localhost:{EX_PORT}/", level=1) printMessage(f"https://127.0.0.1:{EX_PORT}/", level=1)
for ip in EX_IP.strip().split(" "): for ip in EX_IP.strip().split(" "):
printMessage(f"https://{ip}:{EX_PORT}/", level=1) printMessage(f"https://{ip}:{EX_PORT}/", level=1)
else: else:
printMessage(f"http://localhost:{EX_PORT}/", level=1) printMessage(f"http://127.0.0.1:{EX_PORT}/", level=1)
else: # 直接python起動 else: # 直接python起動
if args.https == 1: if args.https == 1:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((args.test_connect, 80)) s.connect((args.test_connect, 80))
hostname = s.getsockname()[0] hostname = s.getsockname()[0]
printMessage(f"https://localhost:{PORT}/", level=1) printMessage(f"https://127.0.0.1:{PORT}/", level=1)
printMessage(f"https://{hostname}:{PORT}/", level=1) printMessage(f"https://{hostname}:{PORT}/", level=1)
else: else:
printMessage(f"http://localhost:{PORT}/", level=1) printMessage(f"http://127.0.0.1:{PORT}/", level=1)
# サーバ起動 # サーバ起動
if args.https: if args.https:
@ -241,12 +241,12 @@ if __name__ == "__main__":
p.start() p.start()
try: try:
if sys.platform.startswith("win"): if sys.platform.startswith("win"):
process = subprocess.Popen([NATIVE_CLIENT_FILE_WIN, "--disable-gpu", "-u", f"http://localhost:{PORT}/"]) process = subprocess.Popen([NATIVE_CLIENT_FILE_WIN, "--disable-gpu", "-u", f"http://127.0.0.1:{PORT}/"])
return_code = process.wait() return_code = process.wait()
logger.info("client closed.") logger.info("client closed.")
p.terminate() p.terminate()
elif sys.platform.startswith("darwin"): elif sys.platform.startswith("darwin"):
process = subprocess.Popen([NATIVE_CLIENT_FILE_MAC, "--disable-gpu", "-u", f"http://localhost:{PORT}/"]) process = subprocess.Popen([NATIVE_CLIENT_FILE_MAC, "--disable-gpu", "-u", f"http://127.0.0.1:{PORT}/"])
return_code = process.wait() return_code = process.wait()
logger.info("client closed.") logger.info("client closed.")
p.terminate() p.terminate()