# retoor <retoor@molodetz.nl>

from fastapi import Request

from devplacepy.utils import get_current_user


def owner_for(request: Request) -> tuple[str, str]:
    user = get_current_user(request)
    if user:
        return "user", user["uid"]
    ip = request.headers.get("X-Real-IP") or (
        request.client.host if request.client else "anon"
    )
    return "guest", ip
