1
0
mirror of https://github.com/NicolasConstant/sengi synced 2024-12-22 13:54:10 +01:00

Merge pull request #338 from NicolasConstant/develop

1.0.1 PR
This commit is contained in:
Nicolas Constant 2021-01-05 00:18:38 +01:00 committed by GitHub
commit 63175d1e60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "sengi",
"version": "1.0.0",
"version": "1.0.1",
"license": "AGPL-3.0-or-later",
"main": "main-electron.js",
"description": "A multi-account desktop client for Mastodon and Pleroma",

View File

@ -357,7 +357,11 @@ export class MastodonService {
createList(account: AccountInfo, title: string): Promise<StreamElement> {
let route = `https://${account.instance}${this.apiRoutes.postList}?title=${title}`;
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
return this.httpClient.post<List>(route, null, { headers: headers }).toPromise()
let data = new ListData();
data.title = title;
return this.httpClient.post<List>(route, data, { headers: headers }).toPromise()
.then((list: List) => {
return new StreamElement(StreamTypeEnum.list, list.title, account.id, null, list.title, list.id, account.instance);
});
@ -378,8 +382,12 @@ export class MastodonService {
addAccountToList(account: AccountInfo, listId: string, accountId: number): Promise<any> {
let route = `https://${account.instance}${this.apiRoutes.addAccountToList}`.replace('{0}', listId);
route += `?account_ids[]=${accountId}`;
let data = new ListAccountData();
data.account_ids.push(accountId.toString());
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
return this.httpClient.post(route, null, { headers: headers }).toPromise();
return this.httpClient.post(route, data, { headers: headers }).toPromise();
}
removeAccountFromList(account: AccountInfo, listId: string, accountId: number): Promise<any> {
@ -543,6 +551,15 @@ class PollData {
choices: number[];
}
class ListData {
title: string;
replies_policy: string = 'list'; //TODO
}
class ListAccountData {
account_ids: string[] = [];
}
class StatusData {
status: string;
in_reply_to_id: string;