From 6600567377a26c2dd74bc1b846d7b95f0e06ff03 Mon Sep 17 00:00:00 2001 From: Jethro Grassie Date: Sat, 18 Aug 2018 09:32:29 -0400 Subject: [PATCH] webui: expose pool port --- src/pool.c | 1 + src/webui-embed.html | 1 + src/webui.c | 6 ++++++ src/webui.h | 1 + 4 files changed, 9 insertions(+) diff --git a/src/pool.c b/src/pool.c index 48d1688..8786037 100644 --- a/src/pool.c +++ b/src/pool.c @@ -2424,6 +2424,7 @@ int main(int argc, char **argv) uic.port = config.webui_port; uic.pool_stats = &pool_stats; uic.pool_fee = config.pool_fee; + uic.pool_port = config.pool_port; uic.payment_threshold = config.payment_threshold; start_web_ui(&uic); diff --git a/src/webui-embed.html b/src/webui-embed.html index 30d2b42..fbf9000 100644 --- a/src/webui-embed.html +++ b/src/webui-embed.html @@ -26,6 +26,7 @@ Last block found: {{LAST_BLOCK_FOUND}} Payment threshold: {{PAYMENT_THRESHOLD}} Pool fee: {{POOL_FEE}} + Pool port: {{POOL_PORT}} Miners connected: {{MINERS_CONNECTED}} Your HR: {{MINER_HASHRATE}} Balance due: {{MINER_BALANCE_DUE}} diff --git a/src/webui.c b/src/webui.c index 2aaa53d..4cef22d 100644 --- a/src/webui.c +++ b/src/webui.c @@ -65,6 +65,7 @@ static char MINER_HASHRATE[] = "{{MINER_HASHRATE}}"; static char POOL_BLOCKS_FOUND[] = "{{POOL_BLOCKS_FOUND}}"; static char PAYMENT_THRESHOLD[] = "{{PAYMENT_THRESHOLD}}"; static char POOL_FEE[] = "{{POOL_FEE}}"; +static char POOL_PORT[] = "{{POOL_PORT}}"; static char MINER_BALANCE_DUE[] = "{{MINER_BALANCE_DUE}}"; @@ -144,6 +145,11 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, sprintf(temp, "%.2f", context->pool_fee); memcpy(p, temp, strlen(temp)); + sprintf(temp, "%d", context->pool_port); + p = strstr(page_buffer, POOL_PORT); + memset(p, ' ', strlen(POOL_PORT)); + memcpy(p, temp, strlen(temp)); + const char *wa = MHD_lookup_connection_value(connection, MHD_COOKIE_KIND, "wa"); if (wa != NULL) { diff --git a/src/webui.h b/src/webui.h index ecd722a..8065759 100644 --- a/src/webui.h +++ b/src/webui.h @@ -49,6 +49,7 @@ typedef struct wui_context_t pool_stats_t *pool_stats; float pool_fee; float payment_threshold; + uint32_t pool_port; } wui_context_t; int start_web_ui(wui_context_t *context);