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