From 2700d016843dddd53ff2a86fd39ce9aa2b7e5cd7 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Tue, 16 Jun 2015 21:05:31 +0200 Subject: playing with embeddable web frontend --- src/GNUmakefile | 6 +++++- src/index.html | 11 +++++++++++ src/webserver.c | 5 ++++- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 src/index.html (limited to 'src') diff --git a/src/GNUmakefile b/src/GNUmakefile index bec27f0..07f5748 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -34,7 +34,7 @@ master.o: master.c master.h port.h coordinator.o: coordinator.c coordinator.h port.h system.h worker.o: worker.c worker.h port.h system.o: system.c system.h -webserver.o: webserver.c webserver.h +webserver.o: webserver.c webserver.h index.h 3rdParty/linenoise/linenoise.o: 3rdParty/linenoise/linenoise.c 3rdParty/linenoise/linenoise.h 3rdParty/http_tiny/http_lib.o: 3rdParty/http_tiny/http_lib.c 3rdParty/http_tiny/http_lib.h cli.o: cli.c cli.h @@ -54,6 +54,9 @@ workertest.o: workertest.c biruda_conf.c: biruda.conf 3rdParty/xxd/xxd 3rdParty/xxd/xxd -i biruda.conf > biruda_conf.c +index.h: index.html 3rdParty/xxd/xxd + 3rdParty/xxd/xxd -i index.html > index.h + clean: @-rm *.o @-rm biruda birudaenv @@ -63,6 +66,7 @@ clean: @-rm 3rdParty/linenoise/*.o @-rm 3rdParty/xxd/xxd @-rm biruda_conf.c + @-rm index.h # default values DESTDIR ?= diff --git a/src/index.html b/src/index.html new file mode 100644 index 0000000..cd9b586 --- /dev/null +++ b/src/index.html @@ -0,0 +1,11 @@ + + + biruda + + + +

+ Welcome to biruda! Please state your wish.. +

+ + diff --git a/src/webserver.c b/src/webserver.c index 81ec523..947f90f 100644 --- a/src/webserver.c +++ b/src/webserver.c @@ -12,6 +12,9 @@ #include +/* embedded web pages and JS code */ +#include "index.h" + static struct MHD_Daemon *d; #if MHD_VERSION < 0x00090500 @@ -100,7 +103,7 @@ static int handle_request( void *cls, struct MHD_Connection *connection, } } else { - snprintf( biruda_msg, sizeof( biruda_msg ), "Welcome to biruda! Please state your wish..\n" ); + snprintf( biruda_msg, index_html_len, (char *)index_html ); } response = MHD_create_response_from_buffer( strlen( biruda_msg ), -- cgit v1.2.3-54-g00ecf