diff --git a/src/main.py b/src/main.py index 37d62a4..0ced9be 100644 --- a/src/main.py +++ b/src/main.py @@ -63,6 +63,7 @@ async def page_profile(atid: str): if did is None: return render_template("error.html", message="did not found"), 404 elif is_valid_did(atid): + handle = None did = atid else: return render_template("error.html", message="invalid did or handle"), 400 @@ -85,7 +86,14 @@ async def page_profile(atid: str): return redirect(request.path) athref = f"at://{did}/at.ligo.actor.links/self" - return render_template("profile.html", profile=profile, links=links, athref=athref) + canonical = f"https://ligo.at/{f'@{handle}' if handle else did}" + return render_template( + "profile.html", + profile=profile, + links=links, + canonical=canonical, + athref=athref, + ) @app.get("/login") diff --git a/src/templates/login.html b/src/templates/login.html index 6f949ef..f97f775 100644 --- a/src/templates/login.html +++ b/src/templates/login.html @@ -24,7 +24,10 @@ Use your AT Protocol handle to log in. - If you're unsure you can log in with Bluesky. + If you're unsure you can + + log in with Bluesky + . diff --git a/src/templates/profile.html b/src/templates/profile.html index 48c92ec..15c5825 100644 --- a/src/templates/profile.html +++ b/src/templates/profile.html @@ -10,7 +10,8 @@ - + {% if canonical %}{% endif %} + {% if athref %}{% endif %}