[jsonapi] Make PUT /api/outputs/x capable of device verification

This commit is contained in:
ejurgensen
2020-05-26 22:46:49 +02:00
parent 18e75c2445
commit d18e49f59b
2 changed files with 10 additions and 1 deletions

View File

@@ -1530,6 +1530,7 @@ jsonapi_reply_outputs_put_byid(struct httpd_request *hreq)
json_object* request;
bool selected;
int volume;
const char *pin;
int ret;
ret = safe_atou64(hreq->uri_parsed->path_parts[2], &output_id);
@@ -1566,6 +1567,13 @@ jsonapi_reply_outputs_put_byid(struct httpd_request *hreq)
ret = player_volume_setabs_speaker(output_id, volume);
}
if (ret == 0 && jparse_contains_key(request, "pin", json_type_string))
{
pin = jparse_str_from_obj(request, "pin");
if (pin)
ret = player_speaker_authorize(output_id, pin);
}
jparse_free(request);
if (ret < 0)