diff options
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | src/index.html | 11 | ||||
-rw-r--r-- | src/webserver.c | 4 |
3 files changed, 17 insertions, 4 deletions
@@ -61,14 +61,12 @@ mainly because of lack on some systems or local modifications: * linenoise: lightweight editline/readline replacement for the biruda command line interface (cli) https://github.com/antirez/linenoise - (integrated) * http-tiny: simple web client library, used by the 'cli' to talk to the master. http://www.demailly.com/~dl/http-tiny-1.2.tar.gz - (integrated) * xxd: for integrating a configuration template into the biruda binary - itself for the '--generate-config' option - (integrated) + itself (for the '--generate-config' option), also used for embedding + HTML/CSS/JS for the webfronted into the binary Other projects -------------- diff --git a/src/index.html b/src/index.html index 4fc3f08..c6ab63a 100644 --- a/src/index.html +++ b/src/index.html @@ -10,6 +10,17 @@ $( function( ) { $( "#tabs" ).tabs( ); }); + + $(document).ready( function( ) { + refresh_status( ); + }); + + function refresh_status( ) { + $('#tabs').tabs( 'load', 0 ); + } + + var refreshId =setInterval( refresh_status, 1000 ); + </script> </head> diff --git a/src/webserver.c b/src/webserver.c index b552ccb..098334a 100644 --- a/src/webserver.c +++ b/src/webserver.c @@ -107,12 +107,16 @@ static int handle_request( void *cls, struct MHD_Connection *connection, } else if( strcmp( url, "/web" ) == 0 ) { strncpy( biruda_msg, (char *)index_html, index_html_len ); + biruda_msg[index_html_len] = '\0'; } else if( strcmp( url, "/web/jquery-ui.css" ) == 0 ) { strncpy( biruda_msg, (char *)jquery_ui_css, jquery_ui_css_len ); + biruda_msg[jquery_ui_css_len] = '\0'; } else if( strcmp( url, "/web/jquery.js" ) == 0 ) { strncpy( biruda_msg, (char *)jquery_js, jquery_js_len ); + biruda_msg[jquery_js_len] = '\0'; } else if( strcmp( url, "/web/jquery-ui.js" ) == 0 ) { strncpy( biruda_msg, (char *)jquery_ui_js, jquery_ui_js_len ); + biruda_msg[jquery_ui_js_len] = '\0'; } else { strcat( biruda_msg, "<html><body><p>This is biruda, the REST api. You can access the web interface <a href=\"/web\">here</a>.</p></body></html>" ); } |