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": { "headers": {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
"referrer": "https://grimgreenfo.rest/", "referrer": "https://mk.therwi.net/",
"body": JSON.stringify({ "noteId": this.status.id, }), "body": JSON.stringify({ "noteId": this.status.id, }),
"method": "POST", "method": "POST",
"mode": "cors" "mode": "cors"

View file

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