fix attachments and update referrer

This commit is contained in:
therwi 2025-06-03 22:38:14 +03:00
parent d8d679b4dc
commit 4d6b0f8ddc
2 changed files with 11 additions and 7 deletions

View file

@ -581,7 +581,7 @@ const Status = {
"headers": {
"Content-Type": "application/json",
},
"referrer": "https://grimgreenfo.rest/",
"referrer": "https://mk.therwi.net/",
"body": JSON.stringify({ "noteId": this.status.id, }),
"method": "POST",
"mode": "cors"

View file

@ -881,7 +881,7 @@ const postStatus = ({
form.append('text', status)
form.append('source', 'Pleroma FE')
if (spoilerText) form.append('cw', spoilerText)
if (sensitive && spoilerText != null) form.append('cw', spoilerText)
if (visibility){
var misskey_visibility = "public"
switch (visibility) {
@ -898,12 +898,9 @@ const postStatus = ({
}
form.append('visibility', misskey_visibility)
}
if (sensitive) form.append('cw', spoilerText)
if (contentType) form.append('content_type', contentType)
if (language) form.append('language', language)
mediaIds.forEach(val => {
form.append('mediaIds[]', val)
})
// if (mediaIds != '[]') form.append('mediaIds');
if (pollOptions.some(option => option !== '')) {
const normalizedPoll = {
expires_in: poll.expiresIn,
@ -933,8 +930,15 @@ const postStatus = ({
postHeaders['idempotency-key'] = idempotencyKey
}
const bo = Object.fromEntries(form.entries());
if (mediaIds !== '[]') bo.mediaIds = String(mediaIds).split(',');
console.log(bo);
return fetch(MISSKEY_POST_NOTE_URL, {
body: JSON.stringify(Object.fromEntries(form)),
body: JSON.stringify(bo),
method: 'POST',
headers: postHeaders
})