upd: add baseurl to all related calls

This commit is contained in:
Mar0xy 2023-09-25 16:54:05 +02:00
parent b9752b20cb
commit f336eec494
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828

View file

@ -676,7 +676,7 @@ export default class Misskey implements MegalodonInterface {
} }
return this.client.post<Array<MisskeyAPI.Entity.Favorite>>('/api/i/favorites', params).then(res => { return this.client.post<Array<MisskeyAPI.Entity.Favorite>>('/api/i/favorites', params).then(res => {
return Object.assign(res, { return Object.assign(res, {
data: res.data.map(fav => MisskeyAPI.Converter.note(fav.note)) data: res.data.map(fav => MisskeyAPI.Converter.note(fav.note, this.baseUrl))
}) })
}) })
} }
@ -1125,7 +1125,7 @@ export default class Misskey implements MegalodonInterface {
} }
return this.client return this.client
.post<MisskeyAPI.Entity.CreatedNote>('/api/notes/create', params) .post<MisskeyAPI.Entity.CreatedNote>('/api/notes/create', params)
.then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data.createdNote) })) .then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data.createdNote, this.baseUrl) }))
} }
/** /**
@ -1298,7 +1298,7 @@ export default class Misskey implements MegalodonInterface {
.post<MisskeyAPI.Entity.Note>('/api/notes/show', { .post<MisskeyAPI.Entity.Note>('/api/notes/show', {
noteId: id noteId: id
}) })
.then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data) })) .then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data, this.baseUrl) }))
} }
/** /**
@ -1312,7 +1312,7 @@ export default class Misskey implements MegalodonInterface {
.post<MisskeyAPI.Entity.Note>('/api/notes/show', { .post<MisskeyAPI.Entity.Note>('/api/notes/show', {
noteId: id noteId: id
}) })
.then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data) })) .then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data, this.baseUrl) }))
} }
/** /**
@ -1323,7 +1323,7 @@ export default class Misskey implements MegalodonInterface {
.post<MisskeyAPI.Entity.CreatedNote>('/api/notes/create', { .post<MisskeyAPI.Entity.CreatedNote>('/api/notes/create', {
renoteId: id renoteId: id
}) })
.then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data.createdNote) })) .then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data.createdNote, this.baseUrl) }))
} }
/** /**
@ -1337,7 +1337,7 @@ export default class Misskey implements MegalodonInterface {
.post<MisskeyAPI.Entity.Note>('/api/notes/show', { .post<MisskeyAPI.Entity.Note>('/api/notes/show', {
noteId: id noteId: id
}) })
.then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data) })) .then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data, this.baseUrl) }))
} }
public async bookmarkStatus(_id: string): Promise<Response<Entity.Status>> { public async bookmarkStatus(_id: string): Promise<Response<Entity.Status>> {
@ -1379,7 +1379,7 @@ export default class Misskey implements MegalodonInterface {
.post<MisskeyAPI.Entity.Note>('/api/notes/show', { .post<MisskeyAPI.Entity.Note>('/api/notes/show', {
noteId: id noteId: id
}) })
.then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data) })) .then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data, this.baseUrl) }))
} }
/** /**
@ -1393,7 +1393,7 @@ export default class Misskey implements MegalodonInterface {
.post<MisskeyAPI.Entity.Note>('/api/notes/show', { .post<MisskeyAPI.Entity.Note>('/api/notes/show', {
noteId: id noteId: id
}) })
.then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data) })) .then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data, this.baseUrl) }))
} }
// ====================================== // ======================================
@ -1482,7 +1482,7 @@ export default class Misskey implements MegalodonInterface {
noteId: status_id noteId: status_id
}) })
.then(res => { .then(res => {
const note = MisskeyAPI.Converter.note(res.data) const note = MisskeyAPI.Converter.note(res.data, this.baseUrl)
return { ...res, data: note.poll } return { ...res, data: note.poll }
}) })
if (!res.data) { if (!res.data) {
@ -2149,7 +2149,7 @@ export default class Misskey implements MegalodonInterface {
...res, ...res,
data: { data: {
accounts: [], accounts: [],
statuses: res.data.map(n => MisskeyAPI.Converter.note(n)), statuses: res.data.map(n => MisskeyAPI.Converter.note(n, this.baseUrl)),
hashtags: [] hashtags: []
} }
})) }))
@ -2318,7 +2318,7 @@ export default class Misskey implements MegalodonInterface {
.post<MisskeyAPI.Entity.Note>('/api/notes/show', { .post<MisskeyAPI.Entity.Note>('/api/notes/show', {
noteId: id noteId: id
}) })
.then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data) })) .then(res => ({ ...res, data: MisskeyAPI.Converter.note(res.data, this.baseUrl) }))
} }
public async getEmojiReactions(id: string): Promise<Response<Array<Entity.Reaction>>> { public async getEmojiReactions(id: string): Promise<Response<Array<Entity.Reaction>>> {