ugly fucking global timeline endpoint

This commit is contained in:
jaina heartles 2022-11-18 04:07:58 -08:00
parent 6748f065ef
commit 1b379513f7
2 changed files with 36 additions and 0 deletions

View File

@ -4,6 +4,7 @@ pub const routes = .{
index,
about,
login,
global_timeline,
};
const index = struct {
@ -54,3 +55,18 @@ const login = struct {
try res.status(.see_other);
}
};
const global_timeline = struct {
pub const path = "/timelines/global";
pub const method = .GET;
pub fn handler(req: anytype, res: anytype, srv: anytype) !void {
_ = req;
const timeline = try srv.globalTimeline(.{});
try res.template(.ok, @embedFile("./web/timelines/global.tmpl.html"), .{
.notes = timeline.items,
.community = srv.community,
});
}
};

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>{ .community.name }</title>
</head>
<body>
<header>
<h1>{ .community.name }</h1>
</header>
{#for .notes |$note| =}
<section>
<header>@{$note.author.username}</header>
<div>
{$note.content}
</div>
</section>
{/for =}
</body>
</html>