diff --git a/lib/src/client.dart b/lib/src/client.dart index 77fbb5f5..4bc704ab 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -144,6 +144,8 @@ class Client extends MatrixApi { Future Function( MatrixImageFileResizeArguments)? customImageResizer; + final bool forceUnAuthMedia; + /// Create a client /// [clientName] = unique identifier of this client /// [databaseBuilder]: A function that creates the database instance, that will be used. @@ -184,6 +186,7 @@ class Client extends MatrixApi { /// Set [customImageResizer] to your own implementation for a more advanced /// and faster image resizing experience. /// Set [enableDehydratedDevices] to enable experimental support for enabling MSC3814 dehydrated devices. + /// Set [forceUnAuthMedia] to force unauthenticated media endpoints even if support is detected. Client( this.clientName, { this.databaseBuilder, @@ -229,6 +232,7 @@ class Client extends MatrixApi { /// support. this.customRefreshTokenLifetime, this.typingIndicatorTimeout = const Duration(seconds: 30), + this.forceUnAuthMedia = false, }) : syncFilter = syncFilter ?? Filter( room: RoomFilter( @@ -1203,6 +1207,7 @@ class Client extends MatrixApi { AsyncCache(const Duration(hours: 1)); Future authenticatedMediaSupported() async { + if (forceUnAuthMedia) return false; final versionsResponse = await _versionsCache.fetch(() => getVersions()); return versionsResponse.versions.any( (v) => isVersionGreaterThanOrEqualTo(v, 'v1.11'),