about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-07-09 19:30:36 -0400
committerJune McEnroe <june@causal.agency>2020-07-09 19:30:36 -0400
commit8d89baa38766e8d9e889fef560d9af368441bccd (patch)
tree1c2228c6b10a8201bd5117f482225fa1e11236e1
parentAdd search forms (diff)
downloadscooper-8d89baa38766e8d9e889fef560d9af368441bccd.tar.gz
scooper-8d89baa38766e8d9e889fef560d9af368441bccd.zip
Add events page stub
Diffstat (limited to '')
-rw-r--r--events.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/events.c b/events.c
index c891bff..9262225 100644
--- a/events.c
+++ b/events.c
@@ -22,5 +22,24 @@
 #include "server.h"
 
 enum kcgi_err pageEvents(struct kreq *req) {
-	return httpFail(req, KHTTP_501);
+	if (!req->fieldmap[Network] || !req->fieldmap[Context]) {
+		return httpFail(req, KHTTP_404);
+	}
+
+	enum kcgi_err error = httpHead(req, KHTTP_200, KMIME_TEXT_HTML);
+	if (req->method == KMETHOD_HEAD) return error;
+
+	const char *network = req->fieldmap[Network]->parsed.s;
+	const char *context = req->fieldmap[Context]->parsed.s;
+
+	struct khtmlreq html;
+	error = error
+		|| khttp_body(req)
+		|| khtml_open(&html, req, KHTML_PRETTY)
+		|| htmlHead(&html, context)
+		|| htmlNav(&html, network, context)
+		|| htmlSearch(&html, network, context);
+	if (error) return error;
+
+	return khtml_close(&html);
 }
rite install script yet againJune McEnroe 2020-09-11Remove NetBSD from install scriptJune McEnroe I never use it. 2020-09-11Use MacPorts rather than pkgsrcJune McEnroe My system is probably such a mess now... 2020-09-11Add debian VM name to sshJune McEnroe 2020-09-11Add influencer tweetJune McEnroe 2020-09-10Add The Kingdom of GodsJune McEnroe Reading has really slowed down :( 2020-09-07Add SunglassesJune McEnroe An IRC find. 2020-09-06Add Between the BreathsJune McEnroe One of those good songs from a soundtrack of a film that probably isn't? The summary sounds a lot more interesting than the title implies, at least. 2020-09-04Open /dev/tty in nudgeJune McEnroe This makes it work even when it's run connected to a pipe, i.e. as the notify command of catgirl... 2020-09-04Add nudgeJune McEnroe 2020-09-03Build fbclock with -lzJune McEnroe I guess this got lost somewhere, long ago... 2020-08-29Add tweets from retweetsJune McEnroe