add dispatchUrl to oauth agent

This commit is contained in:
Hailey
2025-07-22 11:53:29 -07:00
parent de4fe0c63c
commit d184b59d24
2 changed files with 7 additions and 3 deletions
-1
View File
@@ -287,7 +287,6 @@ class BskyAppAgent extends BskyAgent {
// Now the agent is ready.
const account = agentToSessionAccountOrThrow(this)
account.isOauthSession = false
let lastSession = this.sessionManager.session
this.persistSessionHandler = event => {
if (this.sessionManager.session) {
+7 -2
View File
@@ -45,6 +45,8 @@ export async function oauthAgentAndSessionToSessionAccount(
logger.error(e)
return undefined
}
// This is the PDS url that we want to store in the session
const {aud} = await session.getTokenInfo(false)
return {
service: session.serverMetadata.issuer,
did: session.did,
@@ -54,14 +56,17 @@ export async function oauthAgentAndSessionToSessionAccount(
emailAuthFactor: data.emailAuthFactor,
active: data.active,
status: data.status,
pdsUrl: session.serverMetadata.issuer,
pdsUrl: aud,
isSelfHosted: !session.server.issuer.startsWith(BSKY_SERVICE), // TODO: is this entryway?
isOauthSession: true,
}
}
export class OauthBskyAppAgent extends Agent {
// this is a field available in AtpAgent, so we'll add it here
session?: AtpSessionData
// this exists on the old agent, so we will add it here for backwards compat
dispatchUrl?: string
#oauthSession: OAuthSession
#account?: SessionAccount
@@ -79,9 +84,9 @@ export class OauthBskyAppAgent extends Agent {
this,
this.#oauthSession,
)
account.isOauthSession = true
this.#account = account
this.session = sessionAccountToSession(account)
this.dispatchUrl = account.pdsUrl
await Promise.all([gates, moderation])