Created
April 11, 2023 03:51
-
-
Save mattn/c99dbbd395031ead57c09eea9a26b4c5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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