INNER CODE UNIT · Python

_external_host

iLearn-Lab/NovelClaw · apps/auth-portal/local_web_portal/app/main.py:80

def _external_host(request: Request) -> str:
    host = request.url.hostname or "localhost"
    if host in {"0.0.0.0", "::"}:
        host = "localhost"
    if ":" in host and not host.startswith("["):
        return f"[{host}]"
    return host


def _workspace_url(request: Request, configured_url: str, port: str, path: str) -> str:
    configured = (configured_url or "").strip()
    if configured:
        return configured
    safe_path = path if path.startswith("/") else f"/{path}"
    return urlunsplit((request.url.scheme, f"{_external_host(request)}:{port}", safe_path, "", ""))


def _ensure_preview_user(request: Request, db: Session) -> User:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…