diff --git a/src/app/components/stream/stream-overlay/stream-overlay.component.ts b/src/app/components/stream/stream-overlay/stream-overlay.component.ts index 07e216fe..55627a31 100644 --- a/src/app/components/stream/stream-overlay/stream-overlay.component.ts +++ b/src/app/components/stream/stream-overlay/stream-overlay.component.ts @@ -71,7 +71,7 @@ export class StreamOverlayComponent implements OnInit { return; } - this.mastodonService.search(selectedAccounts[0], accountName) + this.mastodonService.search(selectedAccounts[0], accountName, true) .then((result: Results) => { this.account = result.accounts[0]; }); diff --git a/src/app/services/mastodon.service.ts b/src/app/services/mastodon.service.ts index 39c82a3f..c7ee6e81 100644 --- a/src/app/services/mastodon.service.ts +++ b/src/app/services/mastodon.service.ts @@ -117,6 +117,12 @@ export class MastodonService { return this.httpClient.get(route, { headers: headers }).toPromise() } + searchAccount(account: AccountInfo, query: string, limit: number = 40, following: boolean = false): Promise{ + const route = `https://${account.instance}${this.apiRoutes.searchForAccounts}?q=${query}&limit=${limit}&following=${following}`; + const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` }); + return this.httpClient.get(route, { headers: headers }).toPromise() + } + reblog(account: AccountInfo, status: Status): Promise { const route = `https://${account.instance}${this.apiRoutes.reblogStatus}`.replace('{0}', status.id); const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });