Loading doc/home.md +4 −0 Original line number Diff line number Diff line Loading @@ -11,3 +11,7 @@ title: Fediverse Events API It is primarily designed for third-party app developers to add event details to the UI Events can be [automatically authenticated to](./authentication.md), but implementing that is optional # Endpoints * `https://test-api.fediverse.events/v1` test endpoint * `https://api.fediverse.events/v1` production No newline at end of file src/index.ts +36 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,9 @@ import { HandoffProvider } from "./providers/HandoffProvider"; import { Event } from "./controller/Event"; import { DemoDataManager } from "./demo-data/DemoDataManager"; import cors from "cors"; import { prisma } from "./providers/PrismaProvider"; import type { Event as DBEvent } from "./generated/prisma"; import type { InputJsonValue } from "@prisma/client/runtime/library"; if (process.env.DEMO_MODE) { DemoDataManager.get().initialize(); Loading @@ -22,6 +25,39 @@ app.get("/", (req, res) => { res.send("fediverse.events-api"); }); app.get("/_internal/sync", async (req, res) => { if ( !process.env.ADMIN_TOKEN || req.headers.authorization !== process.env.ADMIN_TOKEN ) { res.status(401).send("do not"); return; } const event_2025: Omit<DBEvent, "createdAt" | "updatedAt" | "endpoints"> & { endpoints: InputJsonValue; } = { id: "CANVAS-2025", name: "Canvas 2025", start: new Date("2025-07-12T04:00:00.000Z"), // 7/12/2025 4am UTC end: new Date("2025-07-14T04:00:00.000Z"), endpoints: { open: "https://2025.canvas.fediverse.events", more_info: "https://fediverse.events/canvas", }, }; await prisma.event.upsert({ where: { id: event_2025.id, }, create: event_2025, update: event_2025, }); res.send("ok"); }); const v1 = openapiRouter(); app.use("/v1", v1.router); Loading Loading
doc/home.md +4 −0 Original line number Diff line number Diff line Loading @@ -11,3 +11,7 @@ title: Fediverse Events API It is primarily designed for third-party app developers to add event details to the UI Events can be [automatically authenticated to](./authentication.md), but implementing that is optional # Endpoints * `https://test-api.fediverse.events/v1` test endpoint * `https://api.fediverse.events/v1` production No newline at end of file
src/index.ts +36 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,9 @@ import { HandoffProvider } from "./providers/HandoffProvider"; import { Event } from "./controller/Event"; import { DemoDataManager } from "./demo-data/DemoDataManager"; import cors from "cors"; import { prisma } from "./providers/PrismaProvider"; import type { Event as DBEvent } from "./generated/prisma"; import type { InputJsonValue } from "@prisma/client/runtime/library"; if (process.env.DEMO_MODE) { DemoDataManager.get().initialize(); Loading @@ -22,6 +25,39 @@ app.get("/", (req, res) => { res.send("fediverse.events-api"); }); app.get("/_internal/sync", async (req, res) => { if ( !process.env.ADMIN_TOKEN || req.headers.authorization !== process.env.ADMIN_TOKEN ) { res.status(401).send("do not"); return; } const event_2025: Omit<DBEvent, "createdAt" | "updatedAt" | "endpoints"> & { endpoints: InputJsonValue; } = { id: "CANVAS-2025", name: "Canvas 2025", start: new Date("2025-07-12T04:00:00.000Z"), // 7/12/2025 4am UTC end: new Date("2025-07-14T04:00:00.000Z"), endpoints: { open: "https://2025.canvas.fediverse.events", more_info: "https://fediverse.events/canvas", }, }; await prisma.event.upsert({ where: { id: event_2025.id, }, create: event_2025, update: event_2025, }); res.send("ok"); }); const v1 = openapiRouter(); app.use("/v1", v1.router); Loading