${post.initial}
${post.username}
${post.content}
${post.likes}
${post.replies}
/**
* Socials module — federated social feed aggregator.
*
* Aggregates and displays social media activity across community members.
* Supports ActivityPub, RSS, and manual link sharing.
*/
import { Hono } from "hono";
import { renderShell } from "../../server/shell";
import { getModuleInfoList } from "../../shared/module";
import type { RSpaceModule } from "../../shared/module";
import { renderLanding } from "./landing";
const routes = new Hono();
// ── API: Health ──
routes.get("/api/health", (c) => {
return c.json({ ok: true, module: "rsocials" });
});
// ── API: Info ──
routes.get("/api/info", (c) => {
return c.json({
module: "rsocials",
description: "Federated social feed aggregator for communities",
features: [
"ActivityPub integration",
"RSS feed aggregation",
"Link sharing",
"Community timeline",
],
});
});
// ── API: Feed — community social timeline ──
routes.get("/api/feed", (c) => {
// Demo feed items
return c.json({
items: [
{
id: "demo-1",
type: "post",
author: "Alice",
content: "Just published our community governance proposal!",
source: "fediverse",
timestamp: new Date(Date.now() - 3600_000).toISOString(),
likes: 12,
replies: 3,
},
{
id: "demo-2",
type: "link",
author: "Bob",
content: "Great article on local-first collaboration",
url: "https://example.com/local-first",
source: "shared",
timestamp: new Date(Date.now() - 7200_000).toISOString(),
likes: 8,
replies: 1,
},
{
id: "demo-3",
type: "post",
author: "Carol",
content: "Welcome new members! Check out rSpace's tools in the app switcher above.",
source: "local",
timestamp: new Date(Date.now() - 14400_000).toISOString(),
likes: 24,
replies: 7,
},
],
demo: true,
});
});
// ── Demo feed data (server-rendered, no API calls) ──
const DEMO_FEED = [
{
username: "@alice",
initial: "A",
color: "#6366f1",
content: "Just deployed the new rFunds river view! The enoughness score is such a powerful concept. \u{1F30A}",
timeAgo: "2 hours ago",
likes: 5,
replies: 2,
},
{
username: "@bob",
initial: "B",
color: "#f59e0b",
content: "Workshop recording is up on rTube: 'Introduction to Local-First Data'. Check it out!",
timeAgo: "5 hours ago",
likes: 8,
replies: 4,
},
{
username: "@carol",
initial: "C",
color: "#10b981",
content: "The cosmolocal print network now has 6 providers across 4 countries. Design global, manufacture local! \u{1F30D}",
timeAgo: "1 day ago",
likes: 12,
replies: 3,
},
{
username: "@diana",
initial: "D",
color: "#ec4899",
content: "Reading Elinor Ostrom's 'Governing the Commons' \u2014 so many parallels to what we're building with rSpace governance.",
timeAgo: "1 day ago",
likes: 7,
replies: 5,
},
{
username: "@eve",
initial: "E",
color: "#14b8a6",
content: "New community garden plot assignments are up on rChoices. Vote for your preferred plot by Friday!",
timeAgo: "2 days ago",
likes: 3,
replies: 1,
},
{
username: "@frank",
initial: "F",
color: "#8b5cf6",
content: "Mesh network node #42 is online! Coverage now extends to the community center. \u{1F4E1}",
timeAgo: "3 days ago",
likes: 15,
replies: 6,
},
];
function renderDemoFeedHTML(): string {
const cards = DEMO_FEED.map(
(post) => `