boosts now reflect visibility of target post
This commit is contained in:
		
							parent
							
								
									b9445cf832
								
							
						
					
					
						commit
						d595b037e6
					
				
					 2 changed files with 8 additions and 3 deletions
				
			
		|  | @ -297,13 +297,18 @@ export async function getPostContext(host, token, post_id) { | ||||||
|  * @param {string} host - The domain of the target server. |  * @param {string} host - The domain of the target server. | ||||||
|  * @param {string} token - The application token. |  * @param {string} token - The application token. | ||||||
|  * @param {string} post_id - The ID of the post to boost. |  * @param {string} post_id - The ID of the post to boost. | ||||||
|  |  * @param {string} visibility - The visibility with which to boost the post. | ||||||
|  */ |  */ | ||||||
| export async function boostPost(host, token, post_id) { | export async function boostPost(host, token, post_id, visibility) { | ||||||
|     let url = `https://${host}/api/v1/statuses/${post_id}/reblog`; |     let url = `https://${host}/api/v1/statuses/${post_id}/reblog`; | ||||||
| 
 | 
 | ||||||
|  |     let form = new FormData(); | ||||||
|  |     if (visibility) form.append("visibility", visibility); | ||||||
|  | 
 | ||||||
|     const data = await fetch(url, { |     const data = await fetch(url, { | ||||||
|         method: 'POST', |         method: 'POST', | ||||||
|         headers: { "Authorization": `Bearer ${token}` } |         headers: { "Authorization": `Bearer ${token}` }, | ||||||
|  |         body: form, | ||||||
|     }).then(res => res.json()); |     }).then(res => res.json()); | ||||||
| 
 | 
 | ||||||
|     return data; |     return data; | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ | ||||||
|             data = await api.unboostPost($server.host, $app.token, post.id); |             data = await api.unboostPost($server.host, $app.token, post.id); | ||||||
|         } else { |         } else { | ||||||
|             playSound("boost"); |             playSound("boost"); | ||||||
|             data = await api.boostPost($server.host, $app.token, post.id); |             data = await api.boostPost($server.host, $app.token, post.id, post.visibility); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (!data) { |         if (!data) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue