diff scid/http.c @ 47:e8f24896b484

scid: add /workers page
author David Demelier <markand@malikania.fr>
date Tue, 16 Aug 2022 18:29:08 +0200
parents 576f4b1ec79f
children b474f0985e39
line wrap: on
line diff
--- a/scid/http.c	Mon Aug 15 17:57:34 2022 +0200
+++ b/scid/http.c	Tue Aug 16 18:29:08 2022 +0200
@@ -36,14 +36,16 @@
 #include "page-index.h"
 #include "page-jobresults.h"
 #include "page-static.h"
+#include "page-workers.h"
 #include "pageutil.h"
 #include "scid.h"
 
 enum page {
 	PAGE_INDEX,             /* Job results at index. */
+	PAGE_API,               /* JSON API with key authentication. */
 	PAGE_JOBRESULTS,        /* List of jobresult for one job. */
-	PAGE_API,
-	PAGE_STATIC,
+	PAGE_STATIC,            /* Static files delivery. */
+	PAGE_WORKERS,           /* User view of workers. */
 	PAGE_LAST               /* Not used. */
 };
 
@@ -86,18 +88,20 @@
 	}
 }
 
-static const char *pages[] = {
+static const char * const pages[] = {
 	[PAGE_INDEX]            = "",
+	[PAGE_API]              = "api",
 	[PAGE_JOBRESULTS]       = "jobresults",
-	[PAGE_API]              = "api",
-	[PAGE_STATIC]           = "static"
+	[PAGE_STATIC]           = "static",
+	[PAGE_WORKERS]          = "workers"
 };
 
 static void (*handlers[])(struct kreq *req) = {
 	[PAGE_INDEX]            = page_index,
+	[PAGE_API]              = dispatch_api,
 	[PAGE_JOBRESULTS]       = page_jobresults,
-	[PAGE_API]              = dispatch_api,
-	[PAGE_STATIC]           = page_static
+	[PAGE_STATIC]           = page_static,
+	[PAGE_WORKERS]          = page_workers
 };
 
 static void