1
0

chore: use this.baseUrl instead of BASE_URL

This commit is contained in:
Mar0xy
2023-09-25 12:46:47 +02:00
parent aaa3a34d60
commit 0547940523
5 changed files with 31 additions and 35 deletions
+14 -16
View File
@@ -291,8 +291,7 @@ export default class Misskey implements MegalodonInterface {
exclude_replies: boolean
exclude_reblogs: boolean
only_media?: boolean
},
host?: string
}
): Promise<Response<Array<Entity.Status>>> {
if (options && options.pinned) {
return this.client
@@ -343,7 +342,7 @@ export default class Misskey implements MegalodonInterface {
}
}
return this.client.post<Array<MisskeyAPI.Entity.Note>>('/api/users/notes', params).then(res => {
const statuses: Array<Entity.Status> = res.data.map(note => MisskeyAPI.Converter.note(note, host))
const statuses: Array<Entity.Status> = 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<Response<Entity.Status>> {
public async getStatus(id: string): Promise<Response<Entity.Status>> {
return this.client
.post<MisskeyAPI.Entity.Note>('/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<Response<Array<Entity.Account>>> {
public async getStatusRebloggedBy(id: string): Promise<Response<Array<Entity.Account>>> {
return this.client
.post<Array<MisskeyAPI.Entity.Note>>('/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<Response<Array<Entity.Status>>> {
}): Promise<Response<Array<Entity.Status>>> {
let params = {}
if (options) {
if (options.only_media !== undefined) {
@@ -1523,7 +1522,7 @@ export default class Misskey implements MegalodonInterface {
}
return this.client
.post<Array<MisskeyAPI.Entity.Note>>('/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<Response<Array<Entity.Status>>> {
}): Promise<Response<Array<Entity.Status>>> {
let params = {}
if (options) {
if (options.only_media !== undefined) {
@@ -1566,7 +1565,7 @@ export default class Misskey implements MegalodonInterface {
}
return this.client
.post<Array<MisskeyAPI.Entity.Note>>('/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<Response<Array<Entity.Status>>> {
let params = {
tag: hashtag
@@ -1616,7 +1614,7 @@ export default class Misskey implements MegalodonInterface {
}
return this.client
.post<Array<MisskeyAPI.Entity.Note>>('/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<Response<Array<Entity.Status>>> {
}): Promise<Response<Array<Entity.Status>>> {
let params = {
withFiles: false
}
@@ -1656,7 +1654,7 @@ export default class Misskey implements MegalodonInterface {
}
return this.client
.post<Array<MisskeyAPI.Entity.Note>>('/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)) }))
}
/**