/** * 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, }); }); // ── Page route ── routes.get("/", (c) => { const space = c.req.param("space") || "demo"; return c.html( renderShell({ title: `${space} — Socials | rSpace`, moduleId: "rsocials", spaceSlug: space, modules: getModuleInfoList(), theme: "dark", body: `

Community Feed

Social activity across your community

Loading feed…
`, styles: ``, }), ); }); export const socialsModule: RSpaceModule = { id: "rsocials", name: "rSocials", icon: "📢", description: "Federated social feed aggregator for communities", routes, standaloneDomain: "rsocials.online", landingPage: renderLanding, feeds: [ { id: "social-feed", name: "Social Feed", kind: "data", description: "Community social timeline — posts, links, and activity from connected platforms", }, ], acceptsFeeds: ["data", "trust"], };