fix: store PDS URL for session resumption
This commit is contained in:
@@ -14,6 +14,7 @@ const accountSchema = z.object({
|
|||||||
refreshJwt: z.string().optional(), // optional because it can expire
|
refreshJwt: z.string().optional(), // optional because it can expire
|
||||||
accessJwt: z.string().optional(), // optional because it can expire
|
accessJwt: z.string().optional(), // optional because it can expire
|
||||||
deactivated: z.boolean().optional(),
|
deactivated: z.boolean().optional(),
|
||||||
|
pdsUrl: z.string().optional(),
|
||||||
})
|
})
|
||||||
export type PersistedAccount = z.infer<typeof accountSchema>
|
export type PersistedAccount = z.infer<typeof accountSchema>
|
||||||
|
|
||||||
|
|||||||
@@ -313,6 +313,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
|||||||
refreshJwt: agent.session.refreshJwt,
|
refreshJwt: agent.session.refreshJwt,
|
||||||
accessJwt: agent.session.accessJwt,
|
accessJwt: agent.session.accessJwt,
|
||||||
deactivated: isSessionDeactivated(agent.session.accessJwt),
|
deactivated: isSessionDeactivated(agent.session.accessJwt),
|
||||||
|
pdsUrl: agent.pdsUrl?.toString(),
|
||||||
}
|
}
|
||||||
|
|
||||||
await configureModeration(agent, account)
|
await configureModeration(agent, account)
|
||||||
@@ -405,6 +406,10 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
|||||||
logger.debug(`session: attempting to reuse previous session`)
|
logger.debug(`session: attempting to reuse previous session`)
|
||||||
|
|
||||||
agent.session = prevSession
|
agent.session = prevSession
|
||||||
|
if (account.pdsUrl) {
|
||||||
|
agent.api.xrpc.uri = agent.pdsUrl = new URL(account.pdsUrl)
|
||||||
|
}
|
||||||
|
|
||||||
__globalAgent = agent
|
__globalAgent = agent
|
||||||
upsertAccount(account)
|
upsertAccount(account)
|
||||||
|
|
||||||
@@ -479,6 +484,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
|||||||
refreshJwt: agent.session.refreshJwt,
|
refreshJwt: agent.session.refreshJwt,
|
||||||
accessJwt: agent.session.accessJwt,
|
accessJwt: agent.session.accessJwt,
|
||||||
deactivated: isSessionDeactivated(agent.session.accessJwt),
|
deactivated: isSessionDeactivated(agent.session.accessJwt),
|
||||||
|
pdsUrl: agent.pdsUrl?.toString(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user