fix(frontend): give the embed snippet somewhere to paste.

The result screen ended at the snippet and a copy button. GitHub only
renders a profile README from the repo named exactly after the account,
and 15 of 23 arrivals did not have that repo, so the copy button was a
dead end for most people. Add two links under the snippet: open the
README, or create the repo.

Also serve a placeholder card instead of a JSON 400 when someone pastes
the README snippet without swapping YOUR_USERNAME for their own name,
and show a live example card in the README.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
This commit is contained in:
shay
2026-08-25 08:10:32 -07:00
co-authored by Claude Opus 5
parent 27645048f1
commit a25ae33f29
6 changed files with 42 additions and 1 deletions
+14
View File
@@ -458,6 +458,20 @@ def test_data_unknown_user_enrolls_when_under_both_caps(client, monkeypatch):
assert dbmod.get_settings("testuser") is not None
# ---- README snippet pasted without substituting the username ----
@pytest.mark.parametrize("name", ["YOUR_USERNAME", "your_username", "yourusername", "username"])
def test_unsubstituted_placeholder_returns_card_not_400(client, name):
"""The README snippet uses YOUR_USERNAME. People paste it as-is, which
renders a broken image on their profile. Serve instructions instead."""
r = client.get(f"/api/{name}")
assert r.status_code == 200
assert r.mimetype == "image/svg+xml"
assert r.headers["X-Widget-Status"] == "unsubstituted"
assert b"Replace YOUR_USERNAME" in r.data
# ---- /api/top-langs compat shim for upstream github-readme-stats URLs ----