INNER CODE UNIT · Python

build_publish_url

iamlukethedev/Hermes3D · plugins/hermes3d-office-bridge/__init__.py:73

def build_publish_url(*, host: str, port: int, channel: str, token: str) -> str:
    """URL for the dashboard publisher endpoint.

    ``/api/pub`` accepts ``?token=`` only on an ungated (loopback) bind, which
    is the topology this plugin targets — it always publishes to the local
    backend, never across a network.
    """
    return (
        f"ws://{host}:{int(port)}/api/pub"
        f"?channel={quote(channel, safe='')}&token={quote(token, safe='')}"
    )


def _default_home_token(key: str) -> str:
    """Read ``key`` out of the default home's ``.env``.

    Profiles each get their own ``HERMES_HOME`` and their own ``.env``, so a
    profile-scoped process never sees a token pinned in the default home. That

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…