Unfollow tool for Bluesky

remove comments; rename var

Changed files
+7 -9
src
+7 -9
src/App.tsx
···
import { BskyAgent } from "@atproto/api";
const [unfollowNotice, setUnfollowNotice] = createSignal("");
-
let unfollowURIs: number[] = [];
+
let unfollowURIsIndexes: number[] = [];
let followRecords: any[];
const fetchFollows = async (agent: any) => {
···
password: userPassword,
});
-
if (unfollowURIs.length == 0 || preview) {
-
if (preview) unfollowURIs = [];
+
if (unfollowURIsIndexes.length == 0 || preview) {
+
if (preview) unfollowURIsIndexes = [];
followRecords = await fetchFollows(agent);
let followsDID: string[] = [];
···
for (let i = 0; i < res.data.profiles.length; i++) {
tmpDID[i] = res.data.profiles[i].did;
if (res.data.profiles[i].viewer?.blockedBy) {
-
unfollowURIs.push(i + n);
-
//await agent.deleteFollow(followRecords[i + n].uri);
+
unfollowURIsIndexes.push(i + n);
setUnfollowNotice(
unfollowNotice() +
"Found blocked account: " +
···
}
for (let i = 0; i < res.data.profiles.length; i++) {
if (!tmpDID.includes(followsDID[i + n])) {
-
unfollowURIs.push(i + n);
-
//await agent.deleteFollow(followRecords[i + n].uri);
+
unfollowURIsIndexes.push(i + n);
setUnfollowNotice(
unfollowNotice() +
"Found deleted account: " +
···
}
if (!preview) {
-
for (const i of unfollowURIs) {
+
for (const i of unfollowURIsIndexes) {
await agent.deleteFollow(followRecords[i].uri);
setUnfollowNotice(
unfollowNotice() +
···
"<br>",
);
}
-
unfollowURIs = [];
+
unfollowURIsIndexes = [];
followRecords = [];
}