feat: v2 rewrite — hexagonal arch, ActivityPub federation, NATS, deployment-ready #1

Merged
GKaszewski merged 334 commits from v2 into master 2026-05-16 09:42:43 +00:00
2 changed files with 17 additions and 4 deletions
Showing only changes of commit 4b20bfd369 - Show all commits

View File

@@ -1,7 +1,7 @@
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { cookies } from "next/headers";
import { getMe, lookupRemoteActor, getRemoteActorPosts, Me } from "@/lib/api";
import { getMe, getRemoteFollowing, lookupRemoteActor, getRemoteActorPosts, Me } from "@/lib/api";
import { RemoteUserProfile } from "@/components/remote-user-profile";
interface RemoteActorPageProps {
@@ -53,10 +53,11 @@ export default async function RemoteActorPage({
const token = (await cookies()).get("auth_token")?.value ?? null;
const [actorResult, postsResult, meResult] = await Promise.allSettled([
const [actorResult, postsResult, meResult, followingResult] = await Promise.allSettled([
lookupRemoteActor(handle, token),
getRemoteActorPosts(handle, 1, token),
token ? getMe(token) : Promise.resolve(null),
token ? getRemoteFollowing(token) : Promise.resolve([]),
]);
if (actorResult.status === "rejected") {
@@ -68,6 +69,16 @@ export default async function RemoteActorPage({
postsResult.status === "fulfilled" ? postsResult.value.items : [];
const me =
meResult.status === "fulfilled" ? (meResult.value as Me | null) : null;
const following =
followingResult.status === "fulfilled" ? followingResult.value : [];
const initialFollowed = following.some((f) => f.url === actor.url);
return <RemoteUserProfile actor={actor} initialPosts={posts} me={me} />;
return (
<RemoteUserProfile
actor={actor}
initialPosts={posts}
me={me}
initialFollowed={initialFollowed}
/>
);
}

View File

@@ -17,14 +17,16 @@ interface RemoteUserProfileProps {
actor: RemoteActor;
initialPosts: Thought[];
me: Me | null;
initialFollowed?: boolean;
}
export function RemoteUserProfile({
actor,
initialPosts,
me,
initialFollowed = false,
}: RemoteUserProfileProps) {
const [followed, setFollowed] = useState(false);
const [followed, setFollowed] = useState(initialFollowed);
const [loading, setLoading] = useState(false);
const { token } = useAuth();