Skip to content

Instantly share code, notes, and snippets.

@mattn
Created April 11, 2023 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/c99dbbd395031ead57c09eea9a26b4c5 to your computer and use it in GitHub Desktop.
Save mattn/c99dbbd395031ead57c09eea9a26b4c5 to your computer and use it in GitHub Desktop.
export default function (server: Server, ctx: AppContext) {
server.app.bsky.actor.getProfile({
auth: authOptionalVerifier,
handler: async ({ auth, params }) => {
const { actor } = params
const requester = auth.credentials.did
const { db, services } = ctx
const actorService = services.actor(db)
const actorRes = await actorService.getActor(actor, true)
if (!actorRes) {
throw new InvalidRequestError('Profile not found')
}
if (softDeleted(actorRes)) {
throw new InvalidRequestError(
'Account has been taken down',
'AccountTakedown',
)
}
return {
encoding: 'application/json',
body: await actorService.views.profileDetailed(actorRes, requester),
}
},
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment