@unwanted/matrix-sdk-mini 34.12.0-5 → 34.12.0-6

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unwanted/matrix-sdk-mini",
3
- "version": "34.12.0-5",
3
+ "version": "34.12.0-6",
4
4
  "description": "Matrix Client-Server mini SDK for Javascript",
5
5
  "engines": {
6
6
  "node": ">=20.0.0"
@@ -17,7 +17,7 @@ limitations under the License.
17
17
 
18
18
  import { IClientWellKnown, IWellKnownConfig, IServerVersions } from "./client.ts";
19
19
  import { logger } from "./logger.ts";
20
- import { MatrixError, Method, timeoutSignal } from "./http-api/index.ts";
20
+ import { MatrixError, Method, timeoutSignal, VersionsPrefix } from "./http-api/index.ts";
21
21
  import { SUPPORTED_MATRIX_VERSIONS } from "./version-support.ts";
22
22
 
23
23
  // Dev note: Auto discovery is part of the spec.
@@ -179,7 +179,7 @@ export class AutoDiscovery {
179
179
  }
180
180
 
181
181
  // Step 3: Make sure the homeserver URL points to a homeserver.
182
- const hsVersions = await this.fetchWellKnownObject<IServerVersions>(`${hsUrl}/_matrix/client/versions`);
182
+ const hsVersions = await this.fetchWellKnownObject<IServerVersions>(`${hsUrl}${VersionsPrefix}`);
183
183
  if (!hsVersions || !Array.isArray(hsVersions.raw?.["versions"])) {
184
184
  logger.error("Invalid /versions response");
185
185
  clientConfig["m.homeserver"].error = AutoDiscovery.ERROR_INVALID_HOMESERVER;
package/src/client.ts CHANGED
@@ -60,6 +60,7 @@ import {
60
60
  Upload,
61
61
  UploadOpts,
62
62
  UploadResponse,
63
+ VersionsPrefix,
63
64
  } from "./http-api/index.ts";
64
65
  import { User, UserEvent, UserEventHandlerMap } from "./models/user.ts";
65
66
  import { getHttpUriForMxc } from "./content-repo.ts";
@@ -5019,7 +5020,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
5019
5020
 
5020
5021
  // We send an authenticated request as of MSC4026
5021
5022
  this.serverVersionsPromise = this.http
5022
- .authedRequest<IServerVersions>(Method.Get, "/_matrix/client/versions", undefined, undefined, {
5023
+ .authedRequest<IServerVersions>(Method.Get, VersionsPrefix, undefined, undefined, {
5023
5024
  prefix: "",
5024
5025
  })
5025
5026
  .catch((e) => {
@@ -46,3 +46,5 @@ export enum MediaPrefix {
46
46
  */
47
47
  V3 = "/im/_matrix/media/v3",
48
48
  }
49
+
50
+ export const VersionsPrefix = "/im/_matrix/client/versions";
package/src/sync.ts CHANGED
@@ -48,7 +48,7 @@ import {
48
48
  IToDeviceEvent,
49
49
  } from "./sync-accumulator.ts";
50
50
  import { MatrixEvent } from "./models/event.ts";
51
- import { MatrixError, Method } from "./http-api/index.ts";
51
+ import { MatrixError, Method, VersionsPrefix } from "./http-api/index.ts";
52
52
  import { ISavedSync } from "./store/index.ts";
53
53
  import { EventType } from "./@types/event.ts";
54
54
  import { IPushRules } from "./@types/PushRules.ts";
@@ -1508,7 +1508,7 @@ export class SyncApi {
1508
1508
  this.client.http
1509
1509
  .request(
1510
1510
  Method.Get,
1511
- "/_matrix/client/versions",
1511
+ VersionsPrefix,
1512
1512
  undefined, // queryParams
1513
1513
  undefined, // data
1514
1514
  {