diff --git a/conf_schema.h b/conf_schema.h index 42f58045..a80d9487 100644 --- a/conf_schema.h +++ b/conf_schema.h @@ -333,6 +333,7 @@ STRING(256, interface_path, "", str_nonempty,, "Path of director ATOM(bool_t, respawn_on_crash, 0, boolean,, "If true, server will exec(2) itself on fatal signals, eg SEGV") ATOM(uint32_t, config_reload_interval_ms, 1000, uint32_nonzero,, "Time interval between configuration reload polls, in milliseconds") SUB_STRUCT(watchdog, watchdog,) +STRING(120, motd, "", str_nonempty,, "Message Of The Day displayed on HTTPD root page") END_STRUCT STRUCT(monitor) diff --git a/httpd.c b/httpd.c index 3bc67936..271bb50e 100644 --- a/httpd.c +++ b/httpd.c @@ -437,19 +437,24 @@ static int root_page(httpd_request *r, const char *remainder) char temp[8192]; strbuf b = strbuf_local(temp, sizeof temp); strbuf_sprintf(b, "" - "

Hello, I'm %s*


" - "Interfaces;
", + "

Hello, I'm %s*

", alloca_tohex_sid_t_trunc(my_subscriber->sid, 16)); + if (config.server.motd[0]) { + strbuf_puts(b, "

"); + strbuf_html_escape(b, config.server.motd, strlen(config.server.motd)); + strbuf_puts(b, "

"); + } + strbuf_puts(b, "Interfaces;
"); int i; for (i=0;i%d: %s, TX: %d, RX: %d
", + strbuf_sprintf(b, "%d: %s, TX: %d, RX: %d
", i, i, overlay_interfaces[i].name, overlay_interfaces[i].tx_count, overlay_interfaces[i].recv_count); } - strbuf_puts(b, "Neighbours;
"); + strbuf_puts(b, "Neighbours;
"); link_neighbour_short_status_html(b, "/neighbour"); if (is_rhizome_http_enabled()){ - strbuf_puts(b, "Rhizome Status
"); + strbuf_puts(b, "Rhizome Status
"); } strbuf_puts(b, ""); if (strbuf_overrun(b)) {