INNER CODE UNIT · Python

help_page

slive777/OpenAver · web/app.py:757

async def help_page(request: Request):
    """使用說明頁面"""
    context = get_common_context(request)
    context["page"] = "help"
    # 81b-T5 + Codex P2:僅桌面主機(loopback)覆寫成可分享 LAN URL;
    # 遠端裝置走自身 request.base_url(已是可分享位址,nas.local / 反向代理皆保留)。
    lan_ip = context.get("lan_ip")
    from web.lan_listener import lan_listener
    lan_port = lan_listener.lan_port
    client_host = request.client.host if request.client else None  # 純 TCP 對端,不信任 XFF(同 80a 閘門)
    if client_host in _LOOPBACK_HOSTS and lan_ip and lan_port:
        context["base_url"] = f"http://{lan_ip}:{lan_port}"
    else:
        context["base_url"] = str(request.base_url).rstrip("/")

    # TASK-114b-T4(CD-114b-7):agent 區塊渲染條件,與上面 base_url 用的
    # `client_host in _LOOPBACK_HOSTS`(窄)是不同判斷,不合併(plan §1.5)。
    snap = snapshot()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…