Add post and event cards, shared calendar sheet and per-event ICS; rework past events and next-event card
This commit is contained in:
1 parent
d328adac5c
commit
b2dc033de1
33 files changed
+1150
-206
No files matched your search
@@ -69,6 +69,28 @@ app.MapGet("/events.ics", async (PocketBaseClient pocketBase, CancellationToken
|
||||
return Results.Text(IcsCalendar.Build(events), "text/calendar; charset=utf-8");
|
||||
});
|
||||
|
||||
// One event as a calendar file ("In Kalender übernehmen" on the events page): the
|
||||
// same calendar as the feed, holding just this event. Unlike the feed it does not
|
||||
// fall back to an empty calendar when PocketBase is down -- a file without the event
|
||||
// the visitor clicked would be a silent failure, so it answers 503. An unknown or
|
||||
// non-public id is a 404.
|
||||
app.MapGet("/events/{id}.ics", async (string id, PocketBaseClient pocketBase, CancellationToken token) =>
|
||||
{
|
||||
IReadOnlyList<Event> events;
|
||||
try
|
||||
{
|
||||
events = await pocketBase.GetEventsAsync(token);
|
||||
}
|
||||
catch (PocketBaseUnavailableException)
|
||||
{
|
||||
return Results.StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||
}
|
||||
|
||||
return events.FirstOrDefault(@event => @event.Id == id) is { } match
|
||||
? Results.Text(IcsCalendar.Build([match]), "text/calendar; charset=utf-8")
|
||||
: Results.NotFound();
|
||||
});
|
||||
|
||||
// Status page for an outside monitor (Uptime Kuma) to check. One check tells all
|
||||
// three states apart: no reply = the app is down, 503 = the app runs but PocketBase
|
||||
// is down, 200 = both are fine. It talks to PocketBase directly, not through the
|
||||
|
||||
Reference in new issue
Block a user