diff --git a/server/api/users/:uuid/index.ts b/server/api/users/:uuid/index.ts index 9bba0b41..19852ed8 100644 --- a/server/api/users/:uuid/index.ts +++ b/server/api/users/:uuid/index.ts @@ -1,5 +1,5 @@ import { applyConfig, handleZodError } from "@/api"; -import { errorResponse, jsonResponse, response } from "@/response"; +import { errorResponse, jsonResponse, redirect, response } from "@/response"; import type { Hono } from "@hono/hono"; import { zValidator } from "@hono/zod-validator"; import { z } from "zod"; @@ -58,6 +58,11 @@ export default (app: Hono) => }); } + // Try to detect a web browser and redirect to the user's profile page + if (context.req.header("user-agent")?.includes("Mozilla")) { + return redirect(user.toApi().url); + } + return jsonResponse(user.toLysand()); }, );