1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-07 23:02:56 +03:00

Add authenticated media parameter to getMediaConfig (#4762)

* feat(client): Add authenticated media parameter to getMediaConfig

* test(client): add tests for mediaconfig

---------

Co-authored-by: Maurizio <maurizio-noah.abbruzzo-santiago@t-systems.com>
This commit is contained in:
m004
2025-03-20 17:16:11 +01:00
committed by GitHub
parent e2bdb2f057
commit 0760c5f64c
2 changed files with 34 additions and 3 deletions

View File

@@ -2069,11 +2069,18 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
/**
* Get the config for the media repository.
*
* @param useAuthenticatedMedia - If true, the caller supports authenticated
* media and wants an authentication-required URL. Note that server support
* for authenticated media will *not* be checked - it is the caller's responsibility
* to do so before calling this function.
*
* @returns Promise which resolves with an object containing the config.
*/
public getMediaConfig(): Promise<IMediaConfig> {
return this.http.authedRequest(Method.Get, "/config", undefined, undefined, {
prefix: MediaPrefix.V3,
public getMediaConfig(useAuthenticatedMedia: boolean = false): Promise<IMediaConfig> {
const path = useAuthenticatedMedia ? "/media/config" : "/config";
return this.http.authedRequest(Method.Get, path, undefined, undefined, {
prefix: useAuthenticatedMedia ? ClientPrefix.V1 : MediaPrefix.V3,
});
}