boosts now reflect visibility of target post

This commit is contained in:
ari melody 2024-07-08 12:08:33 +01:00
parent b9445cf832
commit d595b037e6
Signed by: ari
GPG key ID: CF99829C92678188
2 changed files with 8 additions and 3 deletions

View file

@ -297,13 +297,18 @@ export async function getPostContext(host, token, post_id) {
* @param {string} host - The domain of the target server.
* @param {string} token - The application token.
* @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 form = new FormData();
if (visibility) form.append("visibility", visibility);
const data = await fetch(url, {
method: 'POST',
headers: { "Authorization": `Bearer ${token}` }
headers: { "Authorization": `Bearer ${token}` },
body: form,
}).then(res => res.json());
return data;

View file

@ -28,7 +28,7 @@
data = await api.unboostPost($server.host, $app.token, post.id);
} else {
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) {