From 5ffcd278be9121f965b19a4e0b719ce3e45b7173 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Mon, 25 Sep 2023 22:45:22 +0200 Subject: [PATCH] rm: remove attempt at supporting avatar/banner changing --- .../api/mastodon/MastodonApiServerService.ts | 12 +++--------- packages/megalodon/src/megalodon.ts | 2 +- packages/megalodon/src/misskey.ts | 14 +------------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts index adcbe6077..f343e1b69 100644 --- a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts +++ b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts @@ -236,20 +236,14 @@ export class MastodonApiServerService { } }); - fastify.patch('/v1/accounts/update_credentials', { preHandler: upload.single('file') }, async (_request, reply) => { + fastify.patch('/v1/accounts/update_credentials', async (_request, reply) => { const BASE_URL = `${_request.protocol}://${_request.hostname}`; const accessTokens = _request.headers.authorization; const client = getClient(BASE_URL, accessTokens); // we are using this here, because in private mode some info isnt // displayed without being logged in try { - const multipartData = await _request.file; - if (!multipartData) { - const data = await client.updateCredentials(_request.body!); - reply.send(convertAccount(data.data)); - } else { - const data = await client.updateCredentials(_request.body!, multipartData); - reply.send(convertAccount(data.data)); - } + const data = await client.updateCredentials(_request.body!); + reply.send(convertAccount(data.data)); } catch (e: any) { /* console.error(e); */ reply.code(401).send(e.response.data); diff --git a/packages/megalodon/src/megalodon.ts b/packages/megalodon/src/megalodon.ts index b29325477..19cd5c555 100644 --- a/packages/megalodon/src/megalodon.ts +++ b/packages/megalodon/src/megalodon.ts @@ -149,7 +149,7 @@ export interface MegalodonInterface { language?: string } fields_attributes?: Array<{ name: string; value: string }> - }, file?: any): Promise> + }): Promise> /** * View information about a profile. * diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts index 69884bf60..5640ce19b 100644 --- a/packages/megalodon/src/misskey.ts +++ b/packages/megalodon/src/misskey.ts @@ -220,7 +220,7 @@ export default class Misskey implements MegalodonInterface { language?: string } | null fields_attributes?: Array<{ name: string; value: string }> - }, file?: any): Promise> { + }): Promise> { let params = {} if (options) { if (options.bot !== undefined) { @@ -233,18 +233,6 @@ export default class Misskey implements MegalodonInterface { name: options.display_name }) } - if (options.avatar) { - const media = await this.uploadMedia(file); - params = Object.assign(params, { - avatarId: media.data.id - }) - } - if (options.header) { - const media = await this.uploadMedia(file); - params = Object.assign(params, { - headerId: media.data.id - }) - } if (options.note) { params = Object.assign(params, { description: options.note