From b9928978b2b67f86d8bc539232636bb4e9e1243e Mon Sep 17 00:00:00 2001 From: amay077 Date: Thu, 27 Jun 2024 21:38:47 +0900 Subject: [PATCH] =?UTF-8?q?mastodon=20=E3=81=AE=E3=83=90=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=83=89=E3=81=A7=20post=20=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 24 +++++------------------- src/lib/MainContent.ts | 17 +++++++++++++---- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 107d991..3bffe27 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,23 +1,9 @@ { - "typescript.preferences.importModuleSpecifier": "non-relative", + "workbench.colorTheme": "Monokai", "workbench.colorCustomizations": { - "activityBar.activeBackground": "#ab307e", - "activityBar.background": "#ab307e", - "activityBar.foreground": "#e7e7e7", - "activityBar.inactiveForeground": "#e7e7e799", - "activityBarBadge.background": "#25320e", - "activityBarBadge.foreground": "#e7e7e7", - "commandCenter.border": "#e7e7e799", - "sash.hoverBorder": "#ab307e", - "statusBar.background": "#832561", - "statusBar.foreground": "#e7e7e7", - "statusBarItem.hoverBackground": "#ab307e", - "statusBarItem.remoteBackground": "#832561", - "statusBarItem.remoteForeground": "#e7e7e7", - "titleBar.activeBackground": "#832561", - "titleBar.activeForeground": "#e7e7e7", - "titleBar.inactiveBackground": "#83256199", - "titleBar.inactiveForeground": "#e7e7e799" + "titleBar.activeBackground": "#059212", + "titleBar.activeForeground": "#FFFFFF", + "activityBar.background": "#059212", + "activityBar.foreground": "#FFFFFF" }, - "peacock.color": "#832561" } \ No newline at end of file diff --git a/src/lib/MainContent.ts b/src/lib/MainContent.ts index c1462ca..1b7613a 100644 --- a/src/lib/MainContent.ts +++ b/src/lib/MainContent.ts @@ -108,15 +108,24 @@ const postToMastodon = async (text: string, images: string[]): Promise } })(); - const res = await fetch(`https://${MASTODON_HOST}/api/v1/statuses`, { + // const res = await fetch(`https://${MASTODON_HOST}/api/v1/statuses`, { + // method: 'POST', + // headers: { + // 'Authorization': `Bearer ${ACCESS_TOKEN}`, + // 'Content-Type': 'application/json', + // }, + // body: JSON.stringify({ status, media_ids }), + // }); + + const res = await fetch(`${Config.API_ENDPOINT}/mastodon_post`, { method: 'POST', headers: { - 'Authorization': `Bearer ${ACCESS_TOKEN}`, - 'Content-Type': 'application/json', + 'Content-Type': 'text/plain', }, - body: JSON.stringify({ status, media_ids }), + body: JSON.stringify({ host: MASTODON_HOST, token: settings.token_data.access_token, status, media_ids }), }); + if (res.ok) { } else { return false;