From a52735a7ad14d257af6f24568e185b41fe90a075 Mon Sep 17 00:00:00 2001 From: "E.Smith" <31170571+azlm8t@users.noreply.github.com> Date: Thu, 11 Jun 2020 09:26:22 +0100 Subject: [PATCH 2/7] hdhomerun: Generate serverid from server name. (#4461) --- src/webui/webui.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/webui/webui.c b/src/webui/webui.c index d08ebd7c7..16cc5c03c 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -1615,6 +1615,9 @@ hdhomerun_server_discover(http_connection_t *hc, const char *remain, void *opaqu access_t *perm = access_get_by_username(hdhr_user); char http_ip[128]; htsbuf_queue_t *hq; + const char *server_name = config.server_name ?: "TVHeadend"; + /* We generate a unique deviceid based on the server name */ + uint32_t deviceid = tvh_crc32((const uint8_t*)server_name, strlen(server_name), 0); if (access_verify2(perm, ACCESS_STREAMING)) return http_noaccess_code(hc); @@ -1626,7 +1629,7 @@ hdhomerun_server_discover(http_connection_t *hc, const char *remain, void *opaqu htsbuf_qprintf(hq, "{ " \ "\"BaseURL\" : \"http://%s:%u\", " \ "\"DeviceAuth\": \"none\", " \ - "\"DeviceID\": \"12345678\", " \ + "\"DeviceID\": \"%08X\", " \ "\"FirmwareName\": \"hdhomerun_atsc\", " \ "\"FirmwareVersion\": \"20200101\", " \ "\"FriendlyName\": \"tvheadend\", " \ @@ -1635,7 +1638,9 @@ hdhomerun_server_discover(http_connection_t *hc, const char *remain, void *opaqu "\"ModelNumber\": \"HDTC-2US\", " \ "\"TunerCount\": 6 " \ "}", - http_ip, tvheadend_webui_port, http_ip, tvheadend_webui_port); + http_ip, tvheadend_webui_port, + deviceid, + http_ip, tvheadend_webui_port); http_output_content(hc, "application/json"); return 0; } -- 2.25.1