From f336eec494660c47694b223ecb69980294f25fb4 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Mon, 25 Sep 2023 16:54:05 +0200 Subject: [PATCH] upd: add baseurl to all related calls --- packages/megalodon/src/misskey.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts index 6c2797695d..23506d6e6d 100644 --- a/packages/megalodon/src/misskey.ts +++ b/packages/megalodon/src/misskey.ts @@ -676,7 +676,7 @@ export default class Misskey implements MegalodonInterface { } return this.client.post>('/api/i/favorites', params).then(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 .post('/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('/api/notes/show', { 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('/api/notes/show', { 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('/api/notes/create', { 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('/api/notes/show', { 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> { @@ -1379,7 +1379,7 @@ export default class Misskey implements MegalodonInterface { .post('/api/notes/show', { 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('/api/notes/show', { 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 }) .then(res => { - const note = MisskeyAPI.Converter.note(res.data) + const note = MisskeyAPI.Converter.note(res.data, this.baseUrl) return { ...res, data: note.poll } }) if (!res.data) { @@ -2149,7 +2149,7 @@ export default class Misskey implements MegalodonInterface { ...res, data: { accounts: [], - statuses: res.data.map(n => MisskeyAPI.Converter.note(n)), + statuses: res.data.map(n => MisskeyAPI.Converter.note(n, this.baseUrl)), hashtags: [] } })) @@ -2318,7 +2318,7 @@ export default class Misskey implements MegalodonInterface { .post('/api/notes/show', { 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>> {