mirror of
				https://github.com/owntone/owntone-server.git
				synced 2025-10-30 00:05:05 -04:00 
			
		
		
		
	[jsonapi] Make PUT /api/outputs/x capable of device verification
This commit is contained in:
		
							parent
							
								
									18e75c2445
								
							
						
					
					
						commit
						d18e49f59b
					
				| @ -317,7 +317,7 @@ curl -X PUT "http://localhost:3689/api/player/seek?seek_ms=-30000" | ||||
| | GET       | [/api/outputs](#get-a-list-of-available-outputs) | Get a list of available outputs      | | ||||
| | PUT       | [/api/outputs/set](#set-enabled-outputs)         | Set enabled outputs                  | | ||||
| | GET       | [/api/outputs/{id}](#get-an-output)              | Get an output                        | | ||||
| | PUT       | [/api/outputs/{id}](#change-an-output)           | Change an output (enable/disable or volume) | | ||||
| | PUT       | [/api/outputs/{id}](#change-an-output)           | Change an output setting             | | ||||
| | PUT       | [/api/outputs/{id}/toggle](#toggle-an-output)    | Enable or disable an output, depending on the current state | | ||||
| 
 | ||||
| 
 | ||||
| @ -482,6 +482,7 @@ PUT /api/outputs/{id} | ||||
| | --------------- | --------- | -------------------- | | ||||
| | selected        | boolean   | *(Optional)* `true` to enable and `false` to disable the output | | ||||
| | volume          | integer   | *(Optional)* Volume in percent (0 - 100)  | | ||||
| | pin             | string    | *(Optional)* PIN for device verification  | | ||||
| 
 | ||||
| **Response** | ||||
| 
 | ||||
|  | ||||
| @ -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) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user