From 6cbe7dc9f2ff714625d5d41a951c0016355e8aab Mon Sep 17 00:00:00 2001 From: mwiegand Date: Tue, 12 May 2026 22:51:50 +0200 Subject: [PATCH] feat(live-state): link player cards to their Steam profile Wraps avatar + persona name in an a[href=steamcommunity.com/profiles/] in both the Current and Recent blocks. Steam auto-redirects to the user's vanity URL on follow, so we don't need to store profileurl separately. target=_blank + rel=noopener noreferrer to keep the dashboard page in place when a link is followed. Co-Authored-By: Claude Sonnet 4.6 --- l4d2web/templates/_live_state.html | 32 +++++++++++++++++++----------- l4d2web/tests/test_servers.py | 3 +++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/l4d2web/templates/_live_state.html b/l4d2web/templates/_live_state.html index a2d0071..32476d6 100644 --- a/l4d2web/templates/_live_state.html +++ b/l4d2web/templates/_live_state.html @@ -21,12 +21,16 @@
    {% for session, profile in current_players %}
  • - {% if profile and profile.avatar_url %} - - {% else %} - - {% endif %} - {{ (profile and profile.persona_name) or session.name_at_join }} + + {% if profile and profile.avatar_url %} + + {% else %} + + {% endif %} + {{ (profile and profile.persona_name) or session.name_at_join }} + joined {{ ((now - session.joined_at).total_seconds() // 60) | int }}m ago · ping {{ session.min_ping }}-{{ session.max_ping }}ms @@ -41,12 +45,16 @@
      {% for row in recent_players %}
    • - {% if row.avatar_url %} - - {% else %} - - {% endif %} - {{ row.persona_name or row.name_at_join }} + + {% if row.avatar_url %} + + {% else %} + + {% endif %} + {{ row.persona_name or row.name_at_join }} + last seen {{ ((now - row.last_seen).total_seconds() // 60) | int }}m ago diff --git a/l4d2web/tests/test_servers.py b/l4d2web/tests/test_servers.py index b8c0e4c..4b71166 100644 --- a/l4d2web/tests/test_servers.py +++ b/l4d2web/tests/test_servers.py @@ -566,6 +566,9 @@ def test_live_state_fragment_renders_current_and_recent(user_client_with_bluepri # Recent block — only OldPlayer, not MrCool42 assert "OldPersona" in html assert "old_medium.jpg" in html + # Steam profile links — one for the current player, one for the recent. + assert "steamcommunity.com/profiles/76561197960828710" in html + assert "steamcommunity.com/profiles/76561198021234567" in html def test_reset_operation_enqueues_job_and_stops_desired_state(user_client_with_blueprints) -> None: