support v2 instance, fix #504
This commit is contained in:
parent
2cb443dd4d
commit
232a86566c
|
@ -13,8 +13,12 @@ export class MastodonService {
|
||||||
constructor(private readonly httpClient: HttpClient) { }
|
constructor(private readonly httpClient: HttpClient) { }
|
||||||
|
|
||||||
getInstance(instance: string): Promise<Instance> {
|
getInstance(instance: string): Promise<Instance> {
|
||||||
const route = `https://${instance}${this.apiRoutes.getInstance}`;
|
let route = `https://${instance}${this.apiRoutes.getInstancev2}`;
|
||||||
return this.httpClient.get<Instance>(route).toPromise();
|
return this.httpClient.get<Instance>(route).toPromise()
|
||||||
|
.catch(err => {
|
||||||
|
route = `https://${instance}${this.apiRoutes.getInstance}`;
|
||||||
|
return this.httpClient.get<Instance>(route).toPromise();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
retrieveAccountDetails(account: AccountInfo): Promise<Account> {
|
retrieveAccountDetails(account: AccountInfo): Promise<Account> {
|
||||||
|
|
|
@ -25,6 +25,7 @@ export class ApiRoutes {
|
||||||
rejectFollowRequest = '/api/v1/follow_requests/{0}/reject';
|
rejectFollowRequest = '/api/v1/follow_requests/{0}/reject';
|
||||||
followRemote = '/api/v1/follows';
|
followRemote = '/api/v1/follows';
|
||||||
getInstance = '/api/v1/instance';
|
getInstance = '/api/v1/instance';
|
||||||
|
getInstancev2 = '/api/v2/instance';
|
||||||
uploadMediaAttachment = '/api/v1/media';
|
uploadMediaAttachment = '/api/v1/media';
|
||||||
updateMediaAttachment = '/api/v1/media/{0}';
|
updateMediaAttachment = '/api/v1/media/{0}';
|
||||||
getMutes = '/api/v1/mutes';
|
getMutes = '/api/v1/mutes';
|
||||||
|
|
Loading…
Reference in New Issue