Send account requests to the account's own Stalwart
Two requests ignored the domain mapping from #238 and went to STALWART_URL: - /api/account/* re-fetched the upstream session without upstreamFor(), so once the five-minute session cache expired, password, app-password and 2FA calls for a mapped domain reached the default server. - The locale lookup resolved Stalwart's apiUrl against the default server rather than the one that issued the session. Both now use the session's own server, with a test pinning the second.
This commit is contained in:
@@ -198,7 +198,9 @@ async function fetchAccountInfo(authorization: string, session: UpstreamSession)
|
||||
session.primaryAccounts?.["urn:ietf:params:jmap:mail"] ??
|
||||
Object.keys(session.accounts ?? {})[0];
|
||||
if (!accountId) return EMPTY_INFO;
|
||||
const res = await fetch(absoluteUpstream(session.apiUrl), {
|
||||
// Against the server that issued this session, not the default: with a
|
||||
// domain mapped elsewhere, the default has never heard of the account.
|
||||
const res = await fetch(absoluteUpstream(session.apiUrl, session.baseUrl), {
|
||||
method: "POST",
|
||||
headers: { authorization, "content-type": "application/json", accept: "application/json" },
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user