mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-28 01:28:30 +00:00
Add an http_port config setting
This should help with #1061. Also added a warning about the default port being blocked by browsers.
This commit is contained in:
parent
eaa7abc542
commit
475b859e3f
@ -401,6 +401,17 @@
|
|||||||
<listitem>Port to use for hddtemp connections. Defaults to 7634.
|
<listitem>Port to use for hddtemp connections. Defaults to 7634.
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>
|
||||||
|
<option>http_port</option>
|
||||||
|
</command>
|
||||||
|
</term>
|
||||||
|
<listitem>Port to listen to for HTTP connections. Default value is
|
||||||
|
10080, but is blocked by Firefox and Chrome, so you really want to
|
||||||
|
change it.
|
||||||
|
<para /></listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command>
|
<command>
|
||||||
|
@ -61,6 +61,8 @@ std::string webpage;
|
|||||||
struct MHD_Daemon *httpd;
|
struct MHD_Daemon *httpd;
|
||||||
static conky::simple_config_setting<bool> http_refresh("http_refresh", false,
|
static conky::simple_config_setting<bool> http_refresh("http_refresh", false,
|
||||||
true);
|
true);
|
||||||
|
static conky::simple_config_setting<unsigned short> http_port("http_port",
|
||||||
|
HTTPPORT, true);
|
||||||
|
|
||||||
MHD_Result sendanswer(void *cls, struct MHD_Connection *connection,
|
MHD_Result sendanswer(void *cls, struct MHD_Connection *connection,
|
||||||
const char *url, const char *method, const char *version,
|
const char *url, const char *method, const char *version,
|
||||||
@ -85,8 +87,15 @@ class out_to_http_setting : public conky::simple_config_setting<bool> {
|
|||||||
Base::lua_setter(l, init);
|
Base::lua_setter(l, init);
|
||||||
|
|
||||||
if (init && do_convert(l, -1).first) {
|
if (init && do_convert(l, -1).first) {
|
||||||
httpd = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, HTTPPORT, nullptr,
|
/* warn about old default port */
|
||||||
NULL, &sendanswer, nullptr, MHD_OPTION_END);
|
if (http_port.get(*state) == 10080) {
|
||||||
|
NORM_ERR(
|
||||||
|
"warning: port 10080 is blocked by browsers "
|
||||||
|
"like Firefox and Chromium, you may want to change http_port.");
|
||||||
|
}
|
||||||
|
httpd =
|
||||||
|
MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, http_port.get(*state),
|
||||||
|
nullptr, NULL, &sendanswer, nullptr, MHD_OPTION_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
++s;
|
++s;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user