Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http port config #1205

Merged
merged 1 commit into from
Sep 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/config_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,17 @@
<listitem>Port to use for hddtemp connections. Defaults to 7634.
<para /></listitem>
</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>
<term>
<command>
Expand Down
13 changes: 11 additions & 2 deletions src/display-http.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ std::string webpage;
struct MHD_Daemon *httpd;
static conky::simple_config_setting<bool> http_refresh("http_refresh", false,
true);
static conky::simple_config_setting<unsigned short> http_port("http_port",
HTTPPORT, true);

MHD_Result sendanswer(void *cls, struct MHD_Connection *connection,
const char *url, const char *method, const char *version,
Expand All @@ -85,8 +87,15 @@ class out_to_http_setting : public conky::simple_config_setting<bool> {
Base::lua_setter(l, init);

if (init && do_convert(l, -1).first) {
httpd = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, HTTPPORT, nullptr,
NULL, &sendanswer, nullptr, MHD_OPTION_END);
/* warn about old default port */
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;
Expand Down