mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-26 22:43:08 +02:00
rm: remove attempt at supporting avatar/banner changing
This commit is contained in:
parent
7c64dce1ad
commit
5ffcd278be
3 changed files with 5 additions and 23 deletions
|
@ -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 BASE_URL = `${_request.protocol}://${_request.hostname}`;
|
||||||
const accessTokens = _request.headers.authorization;
|
const accessTokens = _request.headers.authorization;
|
||||||
const client = getClient(BASE_URL, accessTokens); // we are using this here, because in private mode some info isnt
|
const client = getClient(BASE_URL, accessTokens); // we are using this here, because in private mode some info isnt
|
||||||
// displayed without being logged in
|
// displayed without being logged in
|
||||||
try {
|
try {
|
||||||
const multipartData = await _request.file;
|
const data = await client.updateCredentials(_request.body!);
|
||||||
if (!multipartData) {
|
reply.send(convertAccount(data.data));
|
||||||
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));
|
|
||||||
}
|
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
/* console.error(e); */
|
/* console.error(e); */
|
||||||
reply.code(401).send(e.response.data);
|
reply.code(401).send(e.response.data);
|
||||||
|
|
|
@ -149,7 +149,7 @@ export interface MegalodonInterface {
|
||||||
language?: string
|
language?: string
|
||||||
}
|
}
|
||||||
fields_attributes?: Array<{ name: string; value: string }>
|
fields_attributes?: Array<{ name: string; value: string }>
|
||||||
}, file?: any): Promise<Response<Entity.Account>>
|
}): Promise<Response<Entity.Account>>
|
||||||
/**
|
/**
|
||||||
* View information about a profile.
|
* View information about a profile.
|
||||||
*
|
*
|
||||||
|
|
|
@ -220,7 +220,7 @@ export default class Misskey implements MegalodonInterface {
|
||||||
language?: string
|
language?: string
|
||||||
} | null
|
} | null
|
||||||
fields_attributes?: Array<{ name: string; value: string }>
|
fields_attributes?: Array<{ name: string; value: string }>
|
||||||
}, file?: any): Promise<Response<Entity.Account>> {
|
}): Promise<Response<Entity.Account>> {
|
||||||
let params = {}
|
let params = {}
|
||||||
if (options) {
|
if (options) {
|
||||||
if (options.bot !== undefined) {
|
if (options.bot !== undefined) {
|
||||||
|
@ -233,18 +233,6 @@ export default class Misskey implements MegalodonInterface {
|
||||||
name: options.display_name
|
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) {
|
if (options.note) {
|
||||||
params = Object.assign(params, {
|
params = Object.assign(params, {
|
||||||
description: options.note
|
description: options.note
|
||||||
|
|
Loading…
Reference in a new issue