summary refs log tree commit diff
path: root/contexts.c
diff options
context:
space:
mode:
Diffstat (limited to 'contexts.c')
-rw-r--r--contexts.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/contexts.c b/contexts.c
index d8eb4fd..e17ccfe 100644
--- a/contexts.c
+++ b/contexts.c
@@ -46,22 +46,22 @@ const char *ContextsQuery = SQL(
 );
 
 enum kcgi_err pageContexts(struct kreq *req) {
-	if (!req->fieldmap[Network]) return httpFail(req, KHTTP_400);
+	struct Scope scope = htmlScope(req);
+	if (!scope.network) return httpFail(req, KHTTP_400);
+
 	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;
-
 	struct khtmlreq html;
 	error = error
 		|| khttp_body(req)
 		|| khtml_open(&html, req, KHTML_PRETTY)
-		|| htmlHead(&html, network)
-		|| htmlNav(&html, network, NULL);
+		|| htmlHead(&html, scope.network)
+		|| htmlNav(&html, scope);
 	if (error) return error;
 
 	dbBindInt(stmt.contexts, ":recent", pageRecent);
-	dbBindText(stmt.contexts, ":network", network);
+	dbBindText(stmt.contexts, ":network", scope.network);
 	if (pagePublic) dbBindInt(stmt.contexts, ":query", false);
 
 	enum State {
@@ -92,7 +92,7 @@ enum kcgi_err pageContexts(struct kreq *req) {
 
 		char *href = khttp_urlpart(
 			NULL, NULL, Pages[Events],
-			Keys[Network].name, network,
+			Keys[Network].name, scope.network,
 			Keys[Context].name, context,
 			NULL
 		);