mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Use the right base URL for the ESS config/well known endpoints (#7469)
* Rename `UrlContentFetcher` to `ClientUrlContentFetcher` and add missing base URL data (server name, homeserver URL) * Avoid passing the `homeserverUrl/serverName` around. Calculate the URL in `DefaultRemoteEnterpriseConfigRetriever` using the newly added `homserver` and `server` values as the possible base URLs, depending on the remote config source * Make sure we don't perform blocking requests to fetch the remote config when restoring a session Add a `needsRefresh` parameter to `RemoteEnterpriseConfigResult.NotFound` to handle this, and store a `no-config` value in the store to indicate an endpoint has been checked and no config was found * Bump enterprise module
This commit is contained in:
committed by
GitHub
parent
c31d7e6cce
commit
a1e86ad499
+12
-2
@@ -8,9 +8,19 @@
|
||||
package io.element.android.libraries.matrix.api
|
||||
|
||||
/**
|
||||
* An interface to fetch content from a URL using a simple GET request.
|
||||
* An interface to fetch content from a URL using a simple GET request launched from a Matrix client.
|
||||
*/
|
||||
fun interface UrlContentFetcher {
|
||||
interface ClientUrlContentFetcher {
|
||||
/**
|
||||
* The domain of the public server for this homeserver.
|
||||
*/
|
||||
val server: String?
|
||||
|
||||
/**
|
||||
* The URL of the actual Matrix homeserver.
|
||||
*/
|
||||
val homeserverUrl: String
|
||||
|
||||
/**
|
||||
* Execute generic GET requests through the SDKs internal HTTP client.
|
||||
*/
|
||||
+1
-4
@@ -60,16 +60,13 @@ import java.util.Optional
|
||||
* One instance exists per session, created on login or session restore and torn down by [logout], [clearCache] or account deactivation.
|
||||
* Suspending members here report failures through a [Result] instead of throwing, and run their work off the main thread.
|
||||
*/
|
||||
interface MatrixClient : UrlContentFetcher {
|
||||
interface MatrixClient : ClientUrlContentFetcher {
|
||||
/** Identifier of the logged in user; a [SessionId] and a [UserId] are the same value. */
|
||||
val sessionId: SessionId
|
||||
|
||||
/** Identifier of this device, as assigned by the homeserver when the session was created. */
|
||||
val deviceId: DeviceId
|
||||
|
||||
/** Base URL of the homeserver this client is connected to. */
|
||||
val homeserverUrl: String
|
||||
|
||||
/** Directories holding this session's databases, caches and downloaded media. */
|
||||
val sessionPaths: SessionPaths
|
||||
|
||||
|
||||
+1
-1
@@ -15,4 +15,4 @@ import java.lang.AutoCloseable
|
||||
* Note: this client implements an [AutoCloseable] interface, so using [AutoCloseable.close] or [AutoCloseable.use] will clean up any resources associated
|
||||
* with it, such as temporary files.
|
||||
*/
|
||||
interface TemporaryMatrixClient : UrlContentFetcher, AutoCloseable
|
||||
interface TemporaryMatrixClient : ClientUrlContentFetcher, AutoCloseable
|
||||
|
||||
+3
-3
@@ -12,10 +12,10 @@ package io.element.android.libraries.matrix.api
|
||||
*/
|
||||
interface TemporaryMatrixClientFactory {
|
||||
/**
|
||||
* Builds an unauthenticated client pointing at [homeServerUrl], backed by a fresh set of temporary session directories.
|
||||
* Builds an unauthenticated client pointing at [serverName], backed by a fresh set of temporary session directories.
|
||||
* The caller owns the returned client and must close it to delete those directories.
|
||||
*
|
||||
* @param homeServerUrl the URL of the homeserver the client will talk to.
|
||||
* @param serverName the domain of the public-facing server for the actual homeserver
|
||||
*/
|
||||
suspend fun create(homeServerUrl: String): Result<TemporaryMatrixClient>
|
||||
suspend fun create(serverName: String): Result<TemporaryMatrixClient>
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
|
||||
package io.element.android.libraries.matrix.api.scanner
|
||||
|
||||
import io.element.android.libraries.matrix.api.UrlContentFetcher
|
||||
import io.element.android.libraries.matrix.api.ClientUrlContentFetcher
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
|
||||
/**
|
||||
@@ -26,6 +26,6 @@ fun interface ContentScannerUrlProvider {
|
||||
/**
|
||||
* @param urlContentFetcher used to read the configuration advertised by the homeserver; a client that is not authenticated yet also works.
|
||||
*/
|
||||
fun create(urlContentFetcher: UrlContentFetcher): ContentScannerUrlProvider
|
||||
fun create(urlContentFetcher: ClientUrlContentFetcher): ContentScannerUrlProvider
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user