commit
63175d1e60
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "sengi",
|
"name": "sengi",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"main": "main-electron.js",
|
"main": "main-electron.js",
|
||||||
"description": "A multi-account desktop client for Mastodon and Pleroma",
|
"description": "A multi-account desktop client for Mastodon and Pleroma",
|
||||||
|
|
|
@ -357,7 +357,11 @@ export class MastodonService {
|
||||||
createList(account: AccountInfo, title: string): Promise<StreamElement> {
|
createList(account: AccountInfo, title: string): Promise<StreamElement> {
|
||||||
let route = `https://${account.instance}${this.apiRoutes.postList}?title=${title}`;
|
let route = `https://${account.instance}${this.apiRoutes.postList}?title=${title}`;
|
||||||
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
|
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) => {
|
.then((list: List) => {
|
||||||
return new StreamElement(StreamTypeEnum.list, list.title, account.id, null, list.title, list.id, account.instance);
|
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> {
|
addAccountToList(account: AccountInfo, listId: string, accountId: number): Promise<any> {
|
||||||
let route = `https://${account.instance}${this.apiRoutes.addAccountToList}`.replace('{0}', listId);
|
let route = `https://${account.instance}${this.apiRoutes.addAccountToList}`.replace('{0}', listId);
|
||||||
route += `?account_ids[]=${accountId}`;
|
route += `?account_ids[]=${accountId}`;
|
||||||
|
|
||||||
|
let data = new ListAccountData();
|
||||||
|
data.account_ids.push(accountId.toString());
|
||||||
|
|
||||||
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
|
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> {
|
removeAccountFromList(account: AccountInfo, listId: string, accountId: number): Promise<any> {
|
||||||
|
@ -543,6 +551,15 @@ class PollData {
|
||||||
choices: number[];
|
choices: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ListData {
|
||||||
|
title: string;
|
||||||
|
replies_policy: string = 'list'; //TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
class ListAccountData {
|
||||||
|
account_ids: string[] = [];
|
||||||
|
}
|
||||||
|
|
||||||
class StatusData {
|
class StatusData {
|
||||||
status: string;
|
status: string;
|
||||||
in_reply_to_id: string;
|
in_reply_to_id: string;
|
||||||
|
|
Loading…
Reference in New Issue