diff --git a/doc/config_settings.xml b/doc/config_settings.xml index 44b02c49..ad8036fa 100644 --- a/doc/config_settings.xml +++ b/doc/config_settings.xml @@ -305,6 +305,17 @@ 7634. + + + + + + + When this is set the page generated with + out_to_http will automatically refresh each interval. Default + value is no. + + diff --git a/src/conky.cc b/src/conky.cc index 8da82b95..5fb37b8b 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -35,6 +35,7 @@ #include "timed-thread.h" #include #include +#include #include #include #include @@ -367,6 +368,7 @@ char *append_file = NULL; FILE *append_fpointer = NULL; #ifdef BUILD_HTTP std::string webpage; struct MHD_Daemon *httpd; +bool http_refresh; int sendanswer(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) { struct MHD_Response *response = MHD_create_response_from_data(webpage.length(), (void*) webpage.c_str(), MHD_NO, MHD_NO); @@ -1780,10 +1782,19 @@ static int draw_line(char *s, int special_index) static void draw_text(void) { #ifdef BUILD_HTTP -#define WEBPAGE_START "\nConky

" +#define WEBPAGE_START1 "\n" +#define WEBPAGE_START2 "Conky

" #define WEBPAGE_END "

" if (output_methods & TO_HTTP) { - webpage = WEBPAGE_START; + webpage = WEBPAGE_START1; + if(http_refresh) { + webpage.append(""); + } + webpage.append(WEBPAGE_START2); } #endif #ifdef BUILD_X11 @@ -2651,6 +2662,9 @@ static void set_default_configurations(void) format_human_readable = 1; top_mem = 0; top_time = 0; +#ifdef BUILD_HTTP + http_refresh = false; +#endif #ifdef BUILD_IOSTATS top_io = 0; #endif @@ -3304,6 +3318,11 @@ char load_config_file(const char *f) httpd = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, HTTPPORT, NULL, NULL, &sendanswer, NULL, MHD_OPTION_END); } } + CONF("http_refresh") { + if(string_to_bool(value)) { + http_refresh = true; + } + } #endif #ifdef BUILD_NCURSES CONF("out_to_ncurses") {