mirror of
https://github.com/Motion-Project/motion.git
synced 2026-02-07 13:31:38 -05:00
User friendly parameter options for webcontrol_interface
This commit is contained in:
16
src/conf.cpp
16
src/conf.cpp
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user