chore: swap base_url getting on some endpoints
This commit is contained in:
parent
4c89e433ad
commit
aaa3a34d60
3 changed files with 9 additions and 10 deletions
|
@ -93,7 +93,7 @@ export class MastodonApiServerService {
|
||||||
},
|
},
|
||||||
order: { id: 'ASC' },
|
order: { id: 'ASC' },
|
||||||
});
|
});
|
||||||
const contact = admin == null ? null : convertAccount((await client.getAccount(admin.id, BASE_URL)).data);
|
const contact = admin == null ? null : convertAccount((await client.getAccount(admin.id)).data);
|
||||||
reply.send(await getInstance(data.data, contact, this.config, await this.metaService.fetch()));
|
reply.send(await getInstance(data.data, contact, this.config, await this.metaService.fetch()));
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
/* console.error(e); */
|
/* console.error(e); */
|
||||||
|
|
|
@ -106,8 +106,7 @@ export class ApiAccountMastodon {
|
||||||
try {
|
try {
|
||||||
const data = await this.client.getAccountStatuses(
|
const data = await this.client.getAccountStatuses(
|
||||||
convertId((this.request.params as any).id, IdType.SharkeyId),
|
convertId((this.request.params as any).id, IdType.SharkeyId),
|
||||||
convertTimelinesArgsId(argsToBools(limitToInt(this.request.query as any))),
|
convertTimelinesArgsId(argsToBools(limitToInt(this.request.query as any)))
|
||||||
this.BASE_URL,
|
|
||||||
);
|
);
|
||||||
return data.data.map((status) => convertStatus(status));
|
return data.data.map((status) => convertStatus(status));
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
|
|
@ -266,14 +266,14 @@ export default class Misskey implements MegalodonInterface {
|
||||||
/**
|
/**
|
||||||
* POST /api/users/show
|
* POST /api/users/show
|
||||||
*/
|
*/
|
||||||
public async getAccount(id: string, host?: string): Promise<Response<Entity.Account>> {
|
public async getAccount(id: string): Promise<Response<Entity.Account>> {
|
||||||
return this.client
|
return this.client
|
||||||
.post<MisskeyAPI.Entity.UserDetail>('/api/users/show', {
|
.post<MisskeyAPI.Entity.UserDetail>('/api/users/show', {
|
||||||
userId: id
|
userId: id
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
return Object.assign(res, {
|
return Object.assign(res, {
|
||||||
data: MisskeyAPI.Converter.userDetail(res.data, host)
|
data: MisskeyAPI.Converter.userDetail(res.data, this.baseUrl)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ export default class Misskey implements MegalodonInterface {
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.data.pinnedNotes) {
|
if (res.data.pinnedNotes) {
|
||||||
return { ...res, data: res.data.pinnedNotes.map(n => MisskeyAPI.Converter.note(n, host)) }
|
return { ...res, data: res.data.pinnedNotes.map(n => MisskeyAPI.Converter.note(n, this.baseUrl)) }
|
||||||
}
|
}
|
||||||
return { ...res, data: [] }
|
return { ...res, data: [] }
|
||||||
})
|
})
|
||||||
|
@ -630,7 +630,7 @@ export default class Misskey implements MegalodonInterface {
|
||||||
}
|
}
|
||||||
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => {
|
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => {
|
||||||
return Object.assign(res, {
|
return Object.assign(res, {
|
||||||
data: res.data.map(u => MisskeyAPI.Converter.userDetail(u))
|
data: res.data.map(u => MisskeyAPI.Converter.userDetail(u, this.baseUrl))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1225,14 +1225,14 @@ export default class Misskey implements MegalodonInterface {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getStatusFavouritedBy(_id: string, host?: string): Promise<Response<Array<Entity.Account>>> {
|
public async getStatusFavouritedBy(_id: string): Promise<Response<Array<Entity.Account>>> {
|
||||||
return this.client.post<Array<MisskeyAPI.Entity.Reaction>>("/api/notes/reactions", {
|
return this.client.post<Array<MisskeyAPI.Entity.Reaction>>("/api/notes/reactions", {
|
||||||
noteId: _id,
|
noteId: _id,
|
||||||
})
|
})
|
||||||
.then(async (res) => ({
|
.then(async (res) => ({
|
||||||
...res,
|
...res,
|
||||||
data: (
|
data: (
|
||||||
await Promise.all(res.data.map((n) => this.getAccount(n.user.id, host)))
|
await Promise.all(res.data.map((n) => this.getAccount(n.user.id)))
|
||||||
).map((p) => p.data),
|
).map((p) => p.data),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -2059,7 +2059,7 @@ export default class Misskey implements MegalodonInterface {
|
||||||
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => ({
|
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => ({
|
||||||
...res,
|
...res,
|
||||||
data: {
|
data: {
|
||||||
accounts: res.data.map(u => MisskeyAPI.Converter.userDetail(u)),
|
accounts: res.data.map(u => MisskeyAPI.Converter.userDetail(u, this.baseUrl)),
|
||||||
statuses: [],
|
statuses: [],
|
||||||
hashtags: []
|
hashtags: []
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue