-
Notifications
You must be signed in to change notification settings - Fork 739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve wellknown usage #3585
Improve wellknown usage #3585
Conversation
…rameter to be able to use something else than the userId's domain
…rver API Also handle the migration for the specific matrix-client.matrix.org URL
… homeserver base url
Actually import what has been done in Login V2...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just 2 remarks
if (it is Failure.OtherServerError | ||
&& it.httpCode == HttpsURLConnection.HTTP_NOT_FOUND /* 404 */) { | ||
// It's maybe a Riot url? | ||
getRiotDomainLoginFlowInternal(homeServerConnectionConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove Riot reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
return tryOrNull { getWellknown(userId) } | ||
suspend fun RawService.getElementWellknown(sessionParams: SessionParams): ElementWellKnown? { | ||
// By default we use the domain of the userId to retrieve the .well-known data | ||
val domain = sessionParams.userId.substringAfter(":") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have an extension method for this substringAfter(":") as we use it at several places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: added fun String.getDomain(): String
in MatrixPattern
This PR fixes several issues:
Fixes #2843 : we now first perform a .well-known request, even if the entered URL is a valid Matrix API
Fixes #3572: we now store the url entered at session creation (Auth database migration required to add the new field), for further reference. Settings screen is updated:
and
API URL is only displayed in developer mode (see the diff with https://user-images.githubusercontent.com/3940906/123458079-e79cba00-d5e4-11eb-825e-4d481662b418.png).
Some change in the SDK API, wellknown now takes a domain instead of a matrixId.
Tested OK
Limitation
If the user enter the matrix API url, for instance "matrix-client.matrix.org", there is no way to deduce the domain matrix.org. So every further wellknow request will fail.