-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
257 additions
and
112 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
packages/bsky/src/api/com/atproto/admin/getAccountInfos.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Server } from '../../../../lexicon' | ||
import AppContext from '../../../../context' | ||
import { Actor } from '../../../../db/tables/actor' | ||
import { mapDefined } from '@atproto/common' | ||
import { INVALID_HANDLE } from '@atproto/syntax' | ||
|
||
export default function (server: Server, ctx: AppContext) { | ||
server.com.atproto.admin.getAccountInfos({ | ||
auth: ctx.roleVerifier, | ||
handler: async ({ params }) => { | ||
const { dids } = params | ||
const db = ctx.db.getPrimary() | ||
const actorService = ctx.services.actor(db) | ||
const [actors, profiles] = await Promise.all([ | ||
actorService.getActors(dids, true), | ||
actorService.getProfileRecords(dids, true), | ||
]) | ||
const actorByDid = actors.reduce((acc, cur) => { | ||
return acc.set(cur.did, cur) | ||
}, new Map<string, Actor>()) | ||
|
||
const infos = mapDefined(dids, (did) => { | ||
const info = actorByDid.get(did) | ||
if (!info) return | ||
const profile = profiles.get(did) | ||
return { | ||
did, | ||
handle: info.handle ?? INVALID_HANDLE, | ||
relatedRecords: profile ? [profile] : undefined, | ||
indexedAt: info.indexedAt, | ||
} | ||
}) | ||
|
||
return { | ||
encoding: 'application/json', | ||
body: { | ||
infos, | ||
}, | ||
} | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export const eventTableName = 'blob_push_event' | ||
|
||
export type BlobPushEventType = 'takedown' | ||
|
||
export interface BlobPushEvent { | ||
eventType: BlobPushEventType | ||
subjectDid: string | ||
subjectBlobCid: string | ||
subjectUri: string | null | ||
takedownId: number | null | ||
confirmedAt: string | null | ||
} | ||
|
||
export type PartialDB = { | ||
[eventTableName]: BlobPushEvent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export const eventTableName = 'record_push_event' | ||
|
||
export type RecordPushEventType = 'takedown' | ||
|
||
export interface RecordPushEvent { | ||
eventType: RecordPushEventType | ||
subjectDid: string | ||
subjectUri: string | ||
subjectCid: string | null | ||
takedownId: number | null | ||
confirmedAt: string | null | ||
} | ||
|
||
export type PartialDB = { | ||
[eventTableName]: RecordPushEvent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const eventTableName = 'repo_push_event' | ||
|
||
export type RepoPushEventType = 'takedown' | ||
|
||
export interface RepoPushEvent { | ||
eventType: RepoPushEventType | ||
subjectDid: string | ||
takedownId: number | null | ||
confirmedAt: string | null | ||
} | ||
|
||
export type PartialDB = { | ||
[eventTableName]: RepoPushEvent | ||
} |
Oops, something went wrong.