···
: "https://plc.directory/" + did,
50
-
return await res.json().then((doc) => {
50
+
return res.json().then((doc) => {
for (const alias of doc.alsoKnownAs) {
if (alias.includes("at://")) {
return alias.split("//")[1];
···
agent = new Agent(result.session);
81
-
setHandle(await resolveDid(agent.did!));
81
+
setHandle(await resolveDid(agent.assertDid));
sub = result.session.sub;
···
const fetchPage = async (cursor?: string) => {
return await agent.com.atproto.repo.listRecords({
152
+
repo: agent.assertDid,
collection: "app.bsky.graph.follow",
···
173
-
await fetchFollows().then((follows) => {
174
-
setFollowCount(follows.length);
175
-
let tmpFollows: FollowRecord[] = [];
176
-
follows.forEach(async (record: ComAtprotoRepoListRecords.Record) => {
177
-
let status: RepoStatus | undefined = undefined;
178
-
const follow = record.value as AppBskyGraphFollow.Record;
173
+
const follows = await fetchFollows();
174
+
setFollowCount(follows.length);
175
+
let tmpFollows: FollowRecord[] = [];
182
-
const res = await agent.getProfile({
183
-
actor: follow.subject,
177
+
follows.forEach(async (record: ComAtprotoRepoListRecords.Record) => {
178
+
let status: RepoStatus | undefined = undefined;
179
+
const follow = record.value as AppBskyGraphFollow.Record;
186
-
handle = res.data.handle;
187
-
const viewer = res.data.viewer!;
183
+
const res = await agent.getProfile({
184
+
actor: follow.subject,
189
-
if (!viewer.followedBy) status = RepoStatus.NONMUTUAL;
187
+
handle = res.data.handle;
188
+
const viewer = res.data.viewer!;
191
-
if (viewer.blockedBy) {
193
-
viewer.blocking || viewer.blockingByList ?
194
-
RepoStatus.BLOCKEDBY | RepoStatus.BLOCKING
195
-
: RepoStatus.BLOCKEDBY;
196
-
} else if (res.data.did.includes(agent.did!)) {
197
-
status = RepoStatus.YOURSELF;
198
-
} else if (viewer.blocking || viewer.blockingByList) {
199
-
status = RepoStatus.BLOCKING;
202
-
handle = await resolveDid(follow.subject);
190
+
if (!viewer.followedBy) status = RepoStatus.NONMUTUAL;
192
+
if (viewer.blockedBy) {
205
-
e.message.includes("not found") ? RepoStatus.DELETED
206
-
: e.message.includes("deactivated") ? RepoStatus.DEACTIVATED
207
-
: e.message.includes("suspended") ? RepoStatus.SUSPENDED
194
+
viewer.blocking || viewer.blockingByList ?
195
+
RepoStatus.BLOCKEDBY | RepoStatus.BLOCKING
196
+
: RepoStatus.BLOCKEDBY;
197
+
} else if (res.data.did.includes(agent.assertDid)) {
198
+
status = RepoStatus.YOURSELF;
199
+
} else if (viewer.blocking || viewer.blockingByList) {
200
+
status = RepoStatus.BLOCKING;
203
+
handle = await resolveDid(follow.subject);
211
-
const status_label =
212
-
status == RepoStatus.DELETED ? "Deleted"
213
-
: status == RepoStatus.DEACTIVATED ? "Deactivated"
214
-
: status == RepoStatus.SUSPENDED ? "Suspended"
215
-
: status == RepoStatus.NONMUTUAL ? "Non Mutual"
216
-
: status == RepoStatus.YOURSELF ? "Literally Yourself"
217
-
: status == RepoStatus.BLOCKING ? "Blocking"
218
-
: status == RepoStatus.BLOCKEDBY ? "Blocked by"
219
-
: RepoStatus.BLOCKEDBY | RepoStatus.BLOCKING ? "Mutual Block"
206
+
e.message.includes("not found") ? RepoStatus.DELETED
207
+
: e.message.includes("deactivated") ? RepoStatus.DEACTIVATED
208
+
: e.message.includes("suspended") ? RepoStatus.SUSPENDED
222
-
if (status !== undefined) {
224
-
did: follow.subject,
228
-
status_label: status_label,
230
-
visible: status == RepoStatus.NONMUTUAL ? false : true,
233
-
setProgress(progress() + 1);
234
-
if (progress() == followCount()) setFollowRecords(tmpFollows);
212
+
const status_label =
213
+
status == RepoStatus.DELETED ? "Deleted"
214
+
: status == RepoStatus.DEACTIVATED ? "Deactivated"
215
+
: status == RepoStatus.SUSPENDED ? "Suspended"
216
+
: status == RepoStatus.NONMUTUAL ? "Non Mutual"
217
+
: status == RepoStatus.YOURSELF ? "Literally Yourself"
218
+
: status == RepoStatus.BLOCKING ? "Blocking"
219
+
: status == RepoStatus.BLOCKEDBY ? "Blocked by"
220
+
: RepoStatus.BLOCKEDBY | RepoStatus.BLOCKING ? "Mutual Block"
223
+
if (status !== undefined) {
225
+
did: follow.subject,
229
+
status_label: status_label,
231
+
visible: status == RepoStatus.NONMUTUAL ? false : true,
234
+
setProgress(progress() + 1);
235
+
if (progress() == followCount()) setFollowRecords(tmpFollows);
···
for (let i = 0; i < writes.length; i += BATCHSIZE) {
await agent.com.atproto.repo.applyWrites({
253
+
repo: agent.assertDid,
writes: writes.slice(i, i + BATCHSIZE),