log-search: Fix URLs for non-zulipchat.com hosts.

This commit is contained in:
Alex Vandiver 2022-05-05 14:11:17 -07:00 committed by Tim Abbott
parent e3a65b1528
commit b1749259d4
1 changed files with 14 additions and 3 deletions

View File

@ -11,6 +11,15 @@ from typing import Callable, TextIO
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(ZULIP_PATH) sys.path.append(ZULIP_PATH)
from scripts.lib.setup_path import setup_path
setup_path()
os.environ["DJANGO_SETTINGS_MODULE"] = "zproject.settings"
from django.conf import settings
from scripts.lib.zulip_tools import BOLD, CYAN, ENDC, FAIL, GRAY, OKBLUE from scripts.lib.zulip_tools import BOLD, CYAN, ENDC, FAIL, GRAY, OKBLUE
@ -314,12 +323,14 @@ def print_line(
if filter_type != FilterType.HOSTNAME: if filter_type != FilterType.HOSTNAME:
hostname = match["hostname"] hostname = match["hostname"]
if hostname is None: if hostname is None:
hostname = "???.zulipchat.com" hostname = "???." + settings.EXTERNAL_HOST
elif not args.nginx: elif not args.nginx:
if hostname == "root": if hostname != "root":
hostname += "." + settings.EXTERNAL_HOST
elif settings.EXTERNAL_HOST == "zulipchat.com":
hostname = "zulip.com" hostname = "zulip.com"
else: else:
hostname += ".zulipchat.com" hostname = settings.EXTERNAL_HOST
url = "https://" + hostname + url url = "https://" + hostname + url
user_id = "" user_id = ""