diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml index 08e0650d..45d05c25 100644 --- a/.github/workflows/release-candidate.yml +++ b/.github/workflows/release-candidate.yml @@ -26,7 +26,7 @@ jobs: token: ${{ secrets.RELEASE_GH_TOKEN }} - id: version - uses: ArchiveBox/monorepo/.github/actions/prepare-release-version@88995501da28f05fdac2df2fab235cd79cd92a3f + uses: ArchiveBox/monorepo/.github/actions/prepare-release-version@main with: package: archivebox branch: dev diff --git a/archivebox/cli/archivebox_server.py b/archivebox/cli/archivebox_server.py index 69850872..8fa01ba7 100644 --- a/archivebox/cli/archivebox_server.py +++ b/archivebox/cli/archivebox_server.py @@ -11,6 +11,8 @@ from collections.abc import Iterable import rich_click as click from rich import print +from rich.style import Style +from rich.text import Text from archivebox.config import CONSTANTS from archivebox.misc.util import docstring, enforce_types @@ -342,12 +344,15 @@ def server( print("[green][+] Starting ArchiveBox webserver in DEBUG mode...[/green]") else: print("[green][+] Starting ArchiveBox webserver...[/green]") - print( - f" [blink][green]>[/green][/blink] Starting ArchiveBox webserver on [dim]BIND_ADDR[/dim] [deep_sky_blue4][link=http://{host}:{port}]http://{host}:{port}[/link][/deep_sky_blue4]", - ) - print( - f" [green]>[/green] Log in to ArchiveBox Admin UI on [dim]BASE_URL [/dim] [deep_sky_blue3][link={admin_url}]{admin_url}[/link][/deep_sky_blue3]", + bind_url = f"http://{host}:{port}" + bind_message = Text.from_markup( + " [blink][green]>[/green][/blink] Starting ArchiveBox webserver on [dim]BIND_ADDR[/dim] ", ) + bind_message.append(bind_url, style=Style(color="deep_sky_blue4", link=bind_url)) + print(bind_message) + admin_message = Text.from_markup(" [green]>[/green] Log in to ArchiveBox Admin UI on [dim]BASE_URL [/dim] ") + admin_message.append(admin_url, style=Style(color="deep_sky_blue3", link=admin_url)) + print(admin_message) print(" > Writing ArchiveBox error log to ./logs/errors.log") print() @@ -355,7 +360,6 @@ def server( # security-mode + base-url warnings see the effective values. runtime_config = get_config() _print_server_startup_warnings(runtime_config, host, port) - bind_url = f"http://{host}:{port}" command = current_command(Process.TypeChoices.SERVER, data_dir=CONSTANTS.DATA_DIR, url=bind_url) def still_owns_runtime_stack() -> bool: diff --git a/archivebox/tests/test_cli_server.py b/archivebox/tests/test_cli_server.py index 1eee61e6..c8b97ee3 100644 --- a/archivebox/tests/test_cli_server.py +++ b/archivebox/tests/test_cli_server.py @@ -234,6 +234,29 @@ def test_server_help_lists_runtime_options(initialized_archive): assert "--reload" in result.stdout +@pytest.mark.timeout(120) +def test_server_starts_with_legacy_ipv6_listen_host(initialized_archive): + """IPv6 brackets in a legacy LISTEN_HOST must not break the startup banner.""" + + port = get_free_port() + env = cli_env(live=True, BASE_URL="", LISTEN_HOST=f"[::]:{port}") + server = None + try: + server = start_archivebox_server( + initialized_archive, + port=port, + log_name="server-legacy-ipv6-listen-host.log", + env=env, + ) + log_text = server.log_path.read_text(encoding="utf-8", errors="replace") + assert f"http://[::]:{port}/admin/" in log_text + assert "MarkupError" not in log_text + finally: + if server is not None: + stop_archivebox_process(server, signal.SIGTERM) + kill_processes_for_data_dir(initialized_archive) + + def test_runner_worker_uses_active_archivebox_module(): from archivebox.workers.supervisord_util import RUNNER_WORKER, archivebox_cmd