ResolveObjectResponse,
ResolveObject,
CreatePostReport,
- PostReport,
ListPostReports,
PostReportResponse,
ListPostReportsResponse,
CommentReportResponse,
ListCommentReports,
ListCommentReportsResponse,
+ DeleteAccount,
+ DeleteAccountResponse
} from 'lemmy-js-client';
export interface API {
}
export let alpha: API = {
- client: new LemmyHttp('http://localhost:8541'),
+ client: new LemmyHttp('http://127.0.0.1:8541'),
};
export let beta: API = {
- client: new LemmyHttp('http://localhost:8551'),
+ client: new LemmyHttp('http://127.0.0.1:8551'),
};
export let gamma: API = {
- client: new LemmyHttp('http://localhost:8561'),
+ client: new LemmyHttp('http://127.0.0.1:8561'),
};
export let delta: API = {
- client: new LemmyHttp('http://localhost:8571'),
+ client: new LemmyHttp('http://127.0.0.1:8571'),
};
export let epsilon: API = {
- client: new LemmyHttp('http://localhost:8581'),
+ client: new LemmyHttp('http://127.0.0.1:8581'),
};
const password = 'lemmylemmy'
gamma.auth = res[2].jwt;
delta.auth = res[3].jwt;
epsilon.auth = res[4].jwt;
+
+ // regstration applications are now enabled by default, need to disable them
+ await alpha.client.editSite({ require_application: false, auth: alpha.auth});
+ await beta.client.editSite({ require_application: false, auth: beta.auth});
+ await gamma.client.editSite({ require_application: false, auth: gamma.auth});
+ await delta.client.editSite({ require_application: false, auth: delta.auth});
+ await epsilon.client.editSite({ require_application: false, auth: epsilon.auth});
}
export async function createPost(
export async function banPersonFromSite(
api: API,
person_id: number,
- ban: boolean
+ ban: boolean,
+ remove_data: boolean,
): Promise<BanPersonResponse> {
// Make sure lemmy-beta/c/main is cached on lemmy_alpha
let form: BanPerson = {
person_id,
ban,
- remove_data: false,
+ remove_data,
auth: api.auth,
};
return api.client.banPerson(form);
api: API,
person_id: number,
community_id: number,
+ remove_data: boolean,
ban: boolean
): Promise<BanFromCommunityResponse> {
- // Make sure lemmy-beta/c/main is cached on lemmy_alpha
let form: BanFromCommunity = {
person_id,
community_id,
- remove_data: false,
+ remove_data,
ban,
auth: api.auth,
};
name_: string = randomString(5)
): Promise<CommunityResponse> {
let description = 'a sample description';
- let icon = 'https://image.flaticon.com/icons/png/512/35/35896.png';
- let banner = 'https://image.flaticon.com/icons/png/512/35/35896.png';
let form: CreateCommunity = {
name: name_,
title: name_,
description,
- icon,
- banner,
nsfw: false,
auth: api.auth,
};
return api.client.saveUserSettings(form);
}
+export async function deleteUser(
+ api: API,
+): Promise<DeleteAccountResponse> {
+ let form: DeleteAccount = {
+ auth: api.auth,
+ password
+ };
+ return api.client.deleteAccount(form);
+}
+
export async function getSite(
api: API
): Promise<GetSiteResponse> {
}
return result;
}
+
+export async function unfollows() {
+ await unfollowRemotes(alpha);
+ await unfollowRemotes(gamma);
+ await unfollowRemotes(delta);
+ await unfollowRemotes(epsilon);
+}