diff --git a/packages/backend/src/server/api/mastodon/endpoints/search.ts b/packages/backend/src/server/api/mastodon/endpoints/search.ts index 5c68402ed..c5a40ae08 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/search.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/search.ts @@ -49,7 +49,7 @@ async function getFeaturedUser( BASE_URL: string, host: string, accessTokens: st return data.map((u) => { return { source: 'past_interactions', - account: Converter.userDetail(u, host), + account: Converter.userDetail(u), }; }); } catch (e: any) { diff --git a/packages/backend/src/server/api/mastodon/endpoints/status.ts b/packages/backend/src/server/api/mastodon/endpoints/status.ts index 9d4fa23b8..d21f48aba 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/status.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/status.ts @@ -24,7 +24,7 @@ export class ApiStatusMastodon { const accessTokens = _request.headers.authorization; const client = getClient(BASE_URL, accessTokens); try { - const data = await client.getStatus(convertId(_request.params.id, IdType.SharkeyId), BASE_URL); + const data = await client.getStatus(convertId(_request.params.id, IdType.SharkeyId)); reply.send(convertStatus(data.data)); } catch (e: any) { console.error(e); @@ -71,7 +71,7 @@ export class ApiStatusMastodon { const accessTokens = _request.headers.authorization; const client = getClient(BASE_URL, accessTokens); try { - const data = await client.getStatusRebloggedBy(convertId(_request.params.id, IdType.SharkeyId), BASE_URL); + const data = await client.getStatusRebloggedBy(convertId(_request.params.id, IdType.SharkeyId)); reply.send(data.data.map((account: Entity.Account) => convertAccount(account))); } catch (e: any) { console.error(e); @@ -86,7 +86,7 @@ export class ApiStatusMastodon { const accessTokens = _request.headers.authorization; const client = getClient(BASE_URL, accessTokens); try { - const data = await client.getStatusFavouritedBy(convertId(_request.params.id, IdType.SharkeyId), BASE_URL); + const data = await client.getStatusFavouritedBy(convertId(_request.params.id, IdType.SharkeyId)); reply.send(data.data.map((account: Entity.Account) => convertAccount(account))); } catch (e: any) { console.error(e); diff --git a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts index 70f0a4ad9..a17120516 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts @@ -51,8 +51,8 @@ export class ApiTimelineMastodon { try { const query: any = _request.query; const data = query.local === 'true' - ? await client.getLocalTimeline(convertTimelinesArgsId(argsToBools(limitToInt(query))), BASE_URL) - : await client.getPublicTimeline(convertTimelinesArgsId(argsToBools(limitToInt(query))), BASE_URL); + ? await client.getLocalTimeline(convertTimelinesArgsId(argsToBools(limitToInt(query)))) + : await client.getPublicTimeline(convertTimelinesArgsId(argsToBools(limitToInt(query)))); reply.send(data.data.map((status: Entity.Status) => convertStatus(status))); } catch (e: any) { console.error(e); @@ -69,7 +69,7 @@ export class ApiTimelineMastodon { const client = getClient(BASE_URL, accessTokens); try { const query: any = _request.query; - const data = await client.getHomeTimeline(convertTimelinesArgsId(limitToInt(query)), BASE_URL); + const data = await client.getHomeTimeline(convertTimelinesArgsId(limitToInt(query))); reply.send(data.data.map((status: Entity.Status) => convertStatus(status))); } catch (e: any) { console.error(e); @@ -87,7 +87,7 @@ export class ApiTimelineMastodon { try { const query: any = _request.query; const params: any = _request.params; - const data = await client.getTagTimeline(params.hashtag, convertTimelinesArgsId(limitToInt(query)), BASE_URL); + const data = await client.getTagTimeline(params.hashtag, convertTimelinesArgsId(limitToInt(query))); reply.send(data.data.map((status: Entity.Status) => convertStatus(status))); } catch (e: any) { console.error(e); diff --git a/packages/megalodon/src/megalodon.ts b/packages/megalodon/src/megalodon.ts index a7a387f37..19cd5c555 100644 --- a/packages/megalodon/src/megalodon.ts +++ b/packages/megalodon/src/megalodon.ts @@ -156,7 +156,7 @@ export interface MegalodonInterface { * @param id The account ID. * @return An account. */ - getAccount(id: string, host?: string): Promise> + getAccount(id: string): Promise> /** * Statuses posted to the given account. * @@ -182,8 +182,7 @@ export interface MegalodonInterface { exclude_replies?: boolean exclude_reblogs?: boolean only_media?: boolean - }, - host?: string + } ): Promise>> /** * Favourites timeline of any user. @@ -683,7 +682,7 @@ export interface MegalodonInterface { * @param id The target status id. * @return Status */ - getStatus(id: string, host?: string): Promise> + getStatus(id: string): Promise> /** * Edit a given status to change its text, sensitivity, media attachments, or poll. Note that editing a poll’s options will reset the votes. * @@ -734,14 +733,14 @@ export interface MegalodonInterface { * @param id The target status id. * @return Array of accounts. */ - getStatusRebloggedBy(id: string, host?: string): Promise>> + getStatusRebloggedBy(id: string): Promise>> /** * See who favourited a status * * @param id The target status id. * @return Array of accounts. */ - getStatusFavouritedBy(id: string, host?: string): Promise>> + getStatusFavouritedBy(id: string): Promise>> /** * Favourite a status. * @@ -926,7 +925,7 @@ export interface MegalodonInterface { max_id?: string since_id?: string min_id?: string - }, host?: string): Promise>> + }): Promise>> /** * View local timeline. * @@ -943,7 +942,7 @@ export interface MegalodonInterface { max_id?: string since_id?: string min_id?: string - }, host?: string): Promise>> + }): Promise>> /** * View hashtag timeline. * @@ -965,8 +964,7 @@ export interface MegalodonInterface { max_id?: string since_id?: string min_id?: string - }, - host?: string + } ): Promise>> /** * View home timeline. @@ -984,7 +982,7 @@ export interface MegalodonInterface { max_id?: string since_id?: string min_id?: string - }, host?: string): Promise>> + }): Promise>> /** * View list timeline. * diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts index 6d0b543c4..fad27f70d 100644 --- a/packages/megalodon/src/misskey.ts +++ b/packages/megalodon/src/misskey.ts @@ -291,8 +291,7 @@ export default class Misskey implements MegalodonInterface { exclude_replies: boolean exclude_reblogs: boolean only_media?: boolean - }, - host?: string + } ): Promise>> { if (options && options.pinned) { return this.client @@ -343,7 +342,7 @@ export default class Misskey implements MegalodonInterface { } } return this.client.post>('/api/users/notes', params).then(res => { - const statuses: Array = res.data.map(note => MisskeyAPI.Converter.note(note, host)) + const statuses: Array = res.data.map(note => MisskeyAPI.Converter.note(note, this.baseUrl)) return Object.assign(res, { data: statuses }) @@ -1132,12 +1131,12 @@ export default class Misskey implements MegalodonInterface { /** * POST /api/notes/show */ - public async getStatus(id: string, host: string): Promise> { + public async getStatus(id: string): Promise> { return this.client .post('/api/notes/show', { noteId: id }) - .then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data, host) })) + .then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data, this.baseUrl) })) } public async editStatus( @@ -1214,14 +1213,14 @@ export default class Misskey implements MegalodonInterface { /** * POST /api/notes/renotes */ - public async getStatusRebloggedBy(id: string, host?: string): Promise>> { + public async getStatusRebloggedBy(id: string): Promise>> { return this.client .post>('/api/notes/renotes', { noteId: id }) .then(res => ({ ...res, - data: res.data.map(n => MisskeyAPI.Converter.user(n.user, host)) + data: res.data.map(n => MisskeyAPI.Converter.user(n.user, this.baseUrl)) })) } @@ -1492,7 +1491,7 @@ export default class Misskey implements MegalodonInterface { max_id?: string since_id?: string min_id?: string - }, host?: string): Promise>> { + }): Promise>> { let params = {} if (options) { if (options.only_media !== undefined) { @@ -1523,7 +1522,7 @@ export default class Misskey implements MegalodonInterface { } return this.client .post>('/api/notes/global-timeline', params) - .then(res => ({ ...res, data: res.data.map(n => MisskeyAPI.Converter.note(n, host)) })) + .then(res => ({ ...res, data: res.data.map(n => MisskeyAPI.Converter.note(n, this.baseUrl)) })) } /** @@ -1535,7 +1534,7 @@ export default class Misskey implements MegalodonInterface { max_id?: string since_id?: string min_id?: string - }, host?: string): Promise>> { + }): Promise>> { let params = {} if (options) { if (options.only_media !== undefined) { @@ -1566,7 +1565,7 @@ export default class Misskey implements MegalodonInterface { } return this.client .post>('/api/notes/local-timeline', params) - .then(res => ({ ...res, data: res.data.map(n => MisskeyAPI.Converter.note(n, host)) })) + .then(res => ({ ...res, data: res.data.map(n => MisskeyAPI.Converter.note(n, this.baseUrl)) })) } /** @@ -1581,8 +1580,7 @@ export default class Misskey implements MegalodonInterface { max_id?: string since_id?: string min_id?: string - }, - host?: string + } ): Promise>> { let params = { tag: hashtag @@ -1616,7 +1614,7 @@ export default class Misskey implements MegalodonInterface { } return this.client .post>('/api/notes/search-by-tag', params) - .then(res => ({ ...res, data: res.data.map(n => MisskeyAPI.Converter.note(n, host)) })) + .then(res => ({ ...res, data: res.data.map(n => MisskeyAPI.Converter.note(n, this.baseUrl)) })) } /** @@ -1628,7 +1626,7 @@ export default class Misskey implements MegalodonInterface { max_id?: string since_id?: string min_id?: string - }, host?: string): Promise>> { + }): Promise>> { let params = { withFiles: false } @@ -1656,7 +1654,7 @@ export default class Misskey implements MegalodonInterface { } return this.client .post>('/api/notes/timeline', params) - .then(res => ({ ...res, data: res.data.map(n => MisskeyAPI.Converter.note(n, host)) })) + .then(res => ({ ...res, data: res.data.map(n => MisskeyAPI.Converter.note(n, this.baseUrl)) })) } /**