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

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-7",
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;
@@ -244,7 +244,7 @@ export class AutoDiscovery {
244
244
 
245
245
  // Step 5b: Verify there is an identity server listening on the provided
246
246
  // URL.
247
- const isResponse = await this.fetchWellKnownObject(`${isUrl}/_matrix/identity/v2`);
247
+ const isResponse = await this.fetchWellKnownObject(`${isUrl}/im/_matrix/identity/v2`);
248
248
  if (!isResponse?.raw || isResponse.action !== AutoDiscoveryAction.SUCCESS) {
249
249
  logger.error("Invalid /v2 response");
250
250
  failingClientConfig["m.identity_server"].error = AutoDiscovery.ERROR_INVALID_IDENTITY_SERVER;
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";
@@ -1693,7 +1694,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
1693
1694
  });
1694
1695
  const options =
1695
1696
  msc3391DeleteAccountDataServerSupport === ServerSupport.Unstable
1696
- ? { prefix: "/_matrix/client/unstable/org.matrix.msc3391" }
1697
+ ? { prefix: "/im/_matrix/client/unstable/org.matrix.msc3391" }
1697
1698
  : undefined;
1698
1699
  return await this.http.authedRequest(Method.Delete, path, undefined, undefined, options);
1699
1700
  }
@@ -3899,7 +3900,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
3899
3900
  prefix:
3900
3901
  Thread.hasServerSideListSupport === FeatureSupport.Stable
3901
3902
  ? ClientPrefix.V1
3902
- : "/_matrix/client/unstable/org.matrix.msc3856",
3903
+ : "/im/_matrix/client/unstable/org.matrix.msc3856",
3903
3904
  };
3904
3905
 
3905
3906
  return this.http
@@ -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) => {
@@ -5218,7 +5219,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
5218
5219
  case SERVICE_TYPES.IS:
5219
5220
  return this.http.getUrl("/terms", undefined, IdentityPrefix.V2, baseUrl);
5220
5221
  case SERVICE_TYPES.IM:
5221
- return this.http.getUrl("/terms", undefined, "/_matrix/integrations/v1", baseUrl);
5222
+ return this.http.getUrl("/terms", undefined, "/im/_matrix/integrations/v1", baseUrl);
5222
5223
  default:
5223
5224
  throw new Error("Unsupported service type");
5224
5225
  }
@@ -6055,7 +6056,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
6055
6056
  if (await this.doesServerSupportUnstableFeature("uk.tcpip.msc4133.stable")) {
6056
6057
  return ClientPrefix.V3;
6057
6058
  }
6058
- return "/_matrix/client/unstable/uk.tcpip.msc4133";
6059
+ return "/im/_matrix/client/unstable/uk.tcpip.msc4133";
6059
6060
  }
6060
6061
 
6061
6062
  /**
@@ -7174,7 +7175,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
7174
7175
  if (e.errcode === "M_UNRECOGNIZED") {
7175
7176
  // fall back to the prefixed hierarchy API.
7176
7177
  return this.http.authedRequest<IRoomHierarchy>(Method.Get, path, queryParams, undefined, {
7177
- prefix: "/_matrix/client/unstable/org.matrix.msc2946",
7178
+ prefix: "/im/_matrix/client/unstable/org.matrix.msc2946",
7178
7179
  });
7179
7180
  }
7180
7181
 
@@ -7268,7 +7269,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
7268
7269
  const clientTimeout = req.clientTimeout;
7269
7270
  delete req.clientTimeout;
7270
7271
  return this.http.authedRequest<MSC3575SlidingSyncResponse>(Method.Post, "/sync", qps, req, {
7271
- prefix: "/_matrix/client/unstable/org.matrix.msc3575",
7272
+ prefix: "/im/_matrix/client/unstable/org.matrix.msc3575",
7272
7273
  baseUrl: proxyBaseUrl,
7273
7274
  localTimeoutMs: clientTimeout,
7274
7275
  abortSignal,
@@ -7300,7 +7301,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
7300
7301
  */
7301
7302
  public async getRoomSummary(roomIdOrAlias: string, via?: string[]): Promise<RoomSummary> {
7302
7303
  const paramOpts = {
7303
- prefix: "/_matrix/client/unstable/im.nheko.summary",
7304
+ prefix: "/im/_matrix/client/unstable/im.nheko.summary",
7304
7305
  };
7305
7306
  try {
7306
7307
  const path = utils.encodeUri("/summary/$roomid", { $roomid: roomIdOrAlias });
@@ -7402,7 +7403,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
7402
7403
  (<MatrixError>err).httpStatus === 405)
7403
7404
  ) {
7404
7405
  return await this.http.authedRequest(Method.Get, path, queryParams, undefined, {
7405
- prefix: "/_matrix/client/unstable/org.matrix.msc3030",
7406
+ prefix: "/im/_matrix/client/unstable/org.matrix.msc3030",
7406
7407
  });
7407
7408
  }
7408
7409
 
@@ -91,9 +91,9 @@ export function getHttpUriForMxc(
91
91
  const isThumbnailRequest = !!width || !!height || !!resizeMethod;
92
92
  const verb = isThumbnailRequest ? "thumbnail" : "download";
93
93
  if (useAuthentication) {
94
- prefix = `/_matrix/client/v1/media/${verb}`;
94
+ prefix = `/im/_matrix/client/v1/media/${verb}`;
95
95
  } else {
96
- prefix = `/_matrix/media/v3/${verb}`;
96
+ prefix = `/im/_matrix/media/v3/${verb}`;
97
97
  }
98
98
 
99
99
  const url = new URL(`${prefix}/${serverName}/${mediaId}`, baseUrl);
@@ -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
  {