User friendly parameter options for webcontrol_interface

This commit is contained in:
MrDave
2021-07-03 21:15:56 -06:00
committed by Mr-Dave
parent d8f79e2b09
commit ea352472e5
3 changed files with 11 additions and 11 deletions

View File

@@ -2160,21 +2160,21 @@ static void conf_edit_webcontrol_parms(struct ctx_cam *cam, std::string &parm, e
static void conf_edit_webcontrol_interface(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact)
{
int parm_in;
if (pact == PARM_ACT_DFLT) {
cam->conf->webcontrol_interface = 0;
cam->conf->webcontrol_interface = "default";
} else if (pact == PARM_ACT_SET) {
parm_in = atoi(parm.c_str());
if ((parm_in < 0) || (parm_in > 3)) {
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_interface %d"),parm_in);
if ((parm == "default") || (parm == "user")) {
cam->conf->webcontrol_interface = parm;
} else if (parm == "") {
cam->conf->webcontrol_interface = "default";
} else {
cam->conf->webcontrol_interface = parm_in;
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_interface %s"), parm.c_str());
}
} else if (pact == PARM_ACT_GET) {
parm = std::to_string(cam->conf->webcontrol_interface);
parm = cam->conf->webcontrol_interface;
} else if (pact == PARM_ACT_LIST) {
parm = "[";
parm = parm + "\"0\",\"1\",\"2\",\"3\"";
parm = parm + "\"default\",\"user\"";
parm = parm + "]";
}
return;

View File

@@ -144,7 +144,7 @@
bool webcontrol_ipv6;
bool webcontrol_localhost;
int webcontrol_parms;
int webcontrol_interface;
std::string webcontrol_interface;
int webcontrol_auth_method;
std::string webcontrol_authentication;
bool webcontrol_tls;

View File

@@ -697,7 +697,7 @@ static mhdrslt webu_answer_post(struct ctx_webui *webui)
webu_post_main(webui);
pthread_mutex_unlock(&webui->motapp->mutex_post);
if (webui->motapp->cam_list[0]->conf->webcontrol_interface == 3) {
if (webui->motapp->cam_list[0]->conf->webcontrol_interface == "user") {
webu_html_user(webui);
} else {
webu_html_page(webui);
@@ -822,7 +822,7 @@ static mhdrslt webu_answer_get(struct ctx_webui *webui)
} else {
pthread_mutex_lock(&webui->motapp->mutex_post);
if (webui->motapp->cam_list[0]->conf->webcontrol_interface == 3) {
if (webui->motapp->cam_list[0]->conf->webcontrol_interface == "user") {
webu_html_user(webui);
} else {
webu_html_page(webui);