store uncoverted username/device in tour view

This commit is contained in:
Jan-Piet Mens 2022-08-07 14:30:34 +02:00
parent 87d0fb81b0
commit f5015eaa7b

View File

@ -439,7 +439,7 @@ void do_request(struct udata *ud, UT_string *username, UT_string *device, char *
if (strcmp(request_type, "tour") == 0) {
FILE *fp;
char path[BUFSIZ], *u = strdup(UB(username)), *d = strdup(UB(device));
char path[BUFSIZ];
if ((r = json_find_member(json, "tour")) == NULL) {
return;
@ -449,13 +449,10 @@ void do_request(struct udata *ud, UT_string *username, UT_string *device, char *
utstring_printf(url, "%s/view/%s", ud->http_prefix, uuid);
lowercase(u);
lowercase(d);
JsonNode *o = json_mkobject();
json_append_member(o, "page", json_mkstring("leafletmap.html"));
json_append_member(o, "user", json_mkstring(u));
json_append_member(o, "device", json_mkstring(d));
json_append_member(o, "user", json_mkstring(UB(username)));
json_append_member(o, "device", json_mkstring(UB(device)));
json_append_member(o, "label", json_mkstring(elem(r, "label")));
json_append_member(o, "zoom", json_mknumber(6));
json_append_member(o, "from", json_mkstring(elem(r, "from")));
@ -472,8 +469,6 @@ void do_request(struct udata *ud, UT_string *username, UT_string *device, char *
} else {
olog(LOG_ERR, "Can't create tour at %s: %m", path);
json_delete(o);
free(u);
free(d);
return;
}
@ -494,7 +489,6 @@ void do_request(struct udata *ud, UT_string *username, UT_string *device, char *
if (httpmode) {
*jnode = resp; // caller will delete `resp'
// this will leak u and d ...
return;
}
@ -502,8 +496,6 @@ void do_request(struct udata *ud, UT_string *username, UT_string *device, char *
publish(ud, UB(fulltopic), js);
free(js);
}
free(u);
free(d);
json_delete(resp);
} else if (strcmp(request_type, "tours") == 0) {