>;
- const posts =
- postsResult.status === "fulfilled" ? postsResult.value.items : [];
- const me =
- meResult.status === "fulfilled" ? (meResult.value as Me | null) : null;
-
- return ;
- }
-
const userProfilePromise = getUserProfile(username, token);
const thoughtsPromise = getUserThoughts(username, token);
const mePromise = token ? getMe(token) : Promise.resolve(null);
diff --git a/thoughts-frontend/components/remote-user-card.tsx b/thoughts-frontend/components/remote-user-card.tsx
index 1b199b0..a07f5e9 100644
--- a/thoughts-frontend/components/remote-user-card.tsx
+++ b/thoughts-frontend/components/remote-user-card.tsx
@@ -38,7 +38,7 @@ export function RemoteUserCard({ actor }: RemoteUserCardProps) {
return (
diff --git a/thoughts-frontend/middleware.ts b/thoughts-frontend/middleware.ts
new file mode 100644
index 0000000..c6d0186
--- /dev/null
+++ b/thoughts-frontend/middleware.ts
@@ -0,0 +1,23 @@
+import { NextResponse } from "next/server";
+import type { NextRequest } from "next/server";
+
+export function middleware(request: NextRequest) {
+ const parts = request.nextUrl.pathname.split("/");
+
+ // /users/@user@instance or /users/%40user%40instance
+ if (parts.length === 3 && parts[1] === "users") {
+ const decoded = decodeURIComponent(parts[2]);
+ if (decoded.startsWith("@") && decoded.indexOf("@", 1) !== -1) {
+ const url = request.nextUrl.clone();
+ url.pathname = "/remote-actor";
+ url.searchParams.set("handle", decoded);
+ return NextResponse.rewrite(url);
+ }
+ }
+
+ return NextResponse.next();
+}
+
+export const config = {
+ matcher: "/users/:path*",
+};