@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.
@@ -81,9 +81,9 @@ export function getHttpUriForMxc(baseUrl, mxc, width, height, resizeMethod) {
81
81
  var isThumbnailRequest = !!width || !!height || !!resizeMethod;
82
82
  var verb = isThumbnailRequest ? "thumbnail" : "download";
83
83
  if (useAuthentication) {
84
- prefix = "/_matrix/client/v1/media/".concat(verb);
84
+ prefix = "/im/_matrix/client/v1/media/".concat(verb);
85
85
  } else {
86
- prefix = "/_matrix/media/v3/".concat(verb);
86
+ prefix = "/im/_matrix/media/v3/".concat(verb);
87
87
  }
88
88
  var url = new URL("".concat(prefix, "/").concat(serverName, "/").concat(mediaId), baseUrl);
89
89
  if (width) {
@@ -1 +1 @@
1
- {"version":3,"file":"content-repo.js","names":["serverNameRegex","validateServerName","serverName","matches","exec","mediaIdRegex","validateMediaId","mediaId","getHttpUriForMxc","baseUrl","mxc","width","height","resizeMethod","allowDirectLinks","arguments","length","undefined","allowRedirects","useAuthentication","startsWith","rest","slice","split","prefix","isThumbnailRequest","verb","concat","url","URL","searchParams","set","Math","round","toString","JSON","stringify","href"],"sources":["../src/content-repo.ts"],"sourcesContent":["/*\nCopyright 2015 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// Validation based on https://spec.matrix.org/v1.12/appendices/#server-name\n// We do not use the validation described in https://spec.matrix.org/v1.12/client-server-api/#security-considerations-5\n// as it'd wrongly make all MXCs invalid due to not allowing `[].:` in server names.\nconst serverNameRegex =\n /^(?:(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(?:\\[[\\dA-Fa-f:.]{2,45}])|(?:[A-Za-z\\d\\-.]{1,255}))(?::\\d{1,5})?$/;\nfunction validateServerName(serverName: string): boolean {\n const matches = serverNameRegex.exec(serverName);\n return matches?.[0] === serverName;\n}\n\n// Validation based on https://spec.matrix.org/v1.12/client-server-api/#security-considerations-5\nconst mediaIdRegex = /^[\\w-]+$/;\nfunction validateMediaId(mediaId: string): boolean {\n const matches = mediaIdRegex.exec(mediaId);\n return matches?.[0] === mediaId;\n}\n\n/**\n * Get the HTTP URL for an MXC URI.\n * @param baseUrl - The base homeserver url which has a content repo.\n * @param mxc - The mxc:// URI.\n * @param width - The desired width of the thumbnail.\n * @param height - The desired height of the thumbnail.\n * @param resizeMethod - The thumbnail resize method to use, either\n * \"crop\" or \"scale\".\n * @param allowDirectLinks - If true, return any non-mxc URLs\n * directly. Fetching such URLs will leak information about the user to\n * anyone they share a room with. If false, will return the emptry string\n * for such URLs.\n * @param allowRedirects - If true, the caller supports the URL being 307 or\n * 308 redirected to another resource upon request. If false, redirects\n * are not expected. Implied `true` when `useAuthentication` is `true`.\n * @param useAuthentication - If true, the caller supports authenticated\n * media and wants an authentication-required URL. Note that server support\n * for authenticated media will *not* be checked - it is the caller's responsibility\n * to do so before calling this function. Note also that `useAuthentication`\n * implies `allowRedirects`. Defaults to false (unauthenticated endpoints).\n * @returns The complete URL to the content, may be an empty string if the provided mxc is not valid.\n */\nexport function getHttpUriForMxc(\n baseUrl: string,\n mxc?: string,\n width?: number,\n height?: number,\n resizeMethod?: string,\n allowDirectLinks = false,\n allowRedirects?: boolean,\n useAuthentication?: boolean,\n): string {\n if (typeof mxc !== \"string\" || !mxc) {\n return \"\";\n }\n if (!mxc.startsWith(\"mxc://\")) {\n if (allowDirectLinks) {\n return mxc;\n } else {\n return \"\";\n }\n }\n\n const [serverName, mediaId, ...rest] = mxc.slice(6).split(\"/\");\n if (rest.length > 0 || !validateServerName(serverName) || !validateMediaId(mediaId)) {\n return \"\";\n }\n\n if (useAuthentication) {\n allowRedirects = true; // per docs (MSC3916 always expects redirects)\n\n // Dev note: MSC3916 removes `allow_redirect` entirely, but\n // for explicitness we set it here. This makes it slightly more obvious to\n // callers, hopefully.\n }\n\n let prefix: string;\n const isThumbnailRequest = !!width || !!height || !!resizeMethod;\n const verb = isThumbnailRequest ? \"thumbnail\" : \"download\";\n if (useAuthentication) {\n prefix = `/_matrix/client/v1/media/${verb}`;\n } else {\n prefix = `/_matrix/media/v3/${verb}`;\n }\n\n const url = new URL(`${prefix}/${serverName}/${mediaId}`, baseUrl);\n\n if (width) {\n url.searchParams.set(\"width\", Math.round(width).toString());\n }\n if (height) {\n url.searchParams.set(\"height\", Math.round(height).toString());\n }\n if (resizeMethod) {\n url.searchParams.set(\"method\", resizeMethod);\n }\n\n if (typeof allowRedirects === \"boolean\") {\n // We add this after, so we don't convert everything to a thumbnail request.\n url.searchParams.set(\"allow_redirect\", JSON.stringify(allowRedirects));\n }\n\n return url.href;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAMA,eAAe,GACjB,8GAA8G;AAClH,SAASC,kBAAkBA,CAACC,UAAkB,EAAW;EACrD,IAAMC,OAAO,GAAGH,eAAe,CAACI,IAAI,CAACF,UAAU,CAAC;EAChD,OAAO,CAAAC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAG,CAAC,CAAC,MAAKD,UAAU;AACtC;;AAEA;AACA,IAAMG,YAAY,GAAG,UAAU;AAC/B,SAASC,eAAeA,CAACC,OAAe,EAAW;EAC/C,IAAMJ,OAAO,GAAGE,YAAY,CAACD,IAAI,CAACG,OAAO,CAAC;EAC1C,OAAO,CAAAJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAG,CAAC,CAAC,MAAKI,OAAO;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AAAG,MAAA,CAA+BD,IAAI,CAAE;EAC/C,CAAC,MAAM;IACHF,MAAM,wBAAAG,MAAA,CAAwBD,IAAI,CAAE;EACxC;EAEA,IAAME,GAAG,GAAG,IAAIC,GAAG,IAAAF,MAAA,CAAIH,MAAM,OAAAG,MAAA,CAAIzB,UAAU,OAAAyB,MAAA,CAAIpB,OAAO,GAAIE,OAAO,CAAC;EAElE,IAAIE,KAAK,EAAE;IACPiB,GAAG,CAACE,YAAY,CAACC,GAAG,CAAC,OAAO,EAAEC,IAAI,CAACC,KAAK,CAACtB,KAAK,CAAC,CAACuB,QAAQ,CAAC,CAAC,CAAC;EAC/D;EACA,IAAItB,MAAM,EAAE;IACRgB,GAAG,CAACE,YAAY,CAACC,GAAG,CAAC,QAAQ,EAAEC,IAAI,CAACC,KAAK,CAACrB,MAAM,CAAC,CAACsB,QAAQ,CAAC,CAAC,CAAC;EACjE;EACA,IAAIrB,YAAY,EAAE;IACde,GAAG,CAACE,YAAY,CAACC,GAAG,CAAC,QAAQ,EAAElB,YAAY,CAAC;EAChD;EAEA,IAAI,OAAOK,cAAc,KAAK,SAAS,EAAE;IACrC;IACAU,GAAG,CAACE,YAAY,CAACC,GAAG,CAAC,gBAAgB,EAAEI,IAAI,CAACC,SAAS,CAAClB,cAAc,CAAC,CAAC;EAC1E;EAEA,OAAOU,GAAG,CAACS,IAAI;AACnB","ignoreList":[]}
1
+ {"version":3,"file":"content-repo.js","names":["serverNameRegex","validateServerName","serverName","matches","exec","mediaIdRegex","validateMediaId","mediaId","getHttpUriForMxc","baseUrl","mxc","width","height","resizeMethod","allowDirectLinks","arguments","length","undefined","allowRedirects","useAuthentication","startsWith","rest","slice","split","prefix","isThumbnailRequest","verb","concat","url","URL","searchParams","set","Math","round","toString","JSON","stringify","href"],"sources":["../src/content-repo.ts"],"sourcesContent":["/*\nCopyright 2015 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// Validation based on https://spec.matrix.org/v1.12/appendices/#server-name\n// We do not use the validation described in https://spec.matrix.org/v1.12/client-server-api/#security-considerations-5\n// as it'd wrongly make all MXCs invalid due to not allowing `[].:` in server names.\nconst serverNameRegex =\n /^(?:(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(?:\\[[\\dA-Fa-f:.]{2,45}])|(?:[A-Za-z\\d\\-.]{1,255}))(?::\\d{1,5})?$/;\nfunction validateServerName(serverName: string): boolean {\n const matches = serverNameRegex.exec(serverName);\n return matches?.[0] === serverName;\n}\n\n// Validation based on https://spec.matrix.org/v1.12/client-server-api/#security-considerations-5\nconst mediaIdRegex = /^[\\w-]+$/;\nfunction validateMediaId(mediaId: string): boolean {\n const matches = mediaIdRegex.exec(mediaId);\n return matches?.[0] === mediaId;\n}\n\n/**\n * Get the HTTP URL for an MXC URI.\n * @param baseUrl - The base homeserver url which has a content repo.\n * @param mxc - The mxc:// URI.\n * @param width - The desired width of the thumbnail.\n * @param height - The desired height of the thumbnail.\n * @param resizeMethod - The thumbnail resize method to use, either\n * \"crop\" or \"scale\".\n * @param allowDirectLinks - If true, return any non-mxc URLs\n * directly. Fetching such URLs will leak information about the user to\n * anyone they share a room with. If false, will return the emptry string\n * for such URLs.\n * @param allowRedirects - If true, the caller supports the URL being 307 or\n * 308 redirected to another resource upon request. If false, redirects\n * are not expected. Implied `true` when `useAuthentication` is `true`.\n * @param useAuthentication - If true, the caller supports authenticated\n * media and wants an authentication-required URL. Note that server support\n * for authenticated media will *not* be checked - it is the caller's responsibility\n * to do so before calling this function. Note also that `useAuthentication`\n * implies `allowRedirects`. Defaults to false (unauthenticated endpoints).\n * @returns The complete URL to the content, may be an empty string if the provided mxc is not valid.\n */\nexport function getHttpUriForMxc(\n baseUrl: string,\n mxc?: string,\n width?: number,\n height?: number,\n resizeMethod?: string,\n allowDirectLinks = false,\n allowRedirects?: boolean,\n useAuthentication?: boolean,\n): string {\n if (typeof mxc !== \"string\" || !mxc) {\n return \"\";\n }\n if (!mxc.startsWith(\"mxc://\")) {\n if (allowDirectLinks) {\n return mxc;\n } else {\n return \"\";\n }\n }\n\n const [serverName, mediaId, ...rest] = mxc.slice(6).split(\"/\");\n if (rest.length > 0 || !validateServerName(serverName) || !validateMediaId(mediaId)) {\n return \"\";\n }\n\n if (useAuthentication) {\n allowRedirects = true; // per docs (MSC3916 always expects redirects)\n\n // Dev note: MSC3916 removes `allow_redirect` entirely, but\n // for explicitness we set it here. This makes it slightly more obvious to\n // callers, hopefully.\n }\n\n let prefix: string;\n const isThumbnailRequest = !!width || !!height || !!resizeMethod;\n const verb = isThumbnailRequest ? \"thumbnail\" : \"download\";\n if (useAuthentication) {\n prefix = `/im/_matrix/client/v1/media/${verb}`;\n } else {\n prefix = `/im/_matrix/media/v3/${verb}`;\n }\n\n const url = new URL(`${prefix}/${serverName}/${mediaId}`, baseUrl);\n\n if (width) {\n url.searchParams.set(\"width\", Math.round(width).toString());\n }\n if (height) {\n url.searchParams.set(\"height\", Math.round(height).toString());\n }\n if (resizeMethod) {\n url.searchParams.set(\"method\", resizeMethod);\n }\n\n if (typeof allowRedirects === \"boolean\") {\n // We add this after, so we don't convert everything to a thumbnail request.\n url.searchParams.set(\"allow_redirect\", JSON.stringify(allowRedirects));\n }\n\n return url.href;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAMA,eAAe,GACjB,8GAA8G;AAClH,SAASC,kBAAkBA,CAACC,UAAkB,EAAW;EACrD,IAAMC,OAAO,GAAGH,eAAe,CAACI,IAAI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AACS,IAAI;AACnB","ignoreList":[]}
@@ -28,4 +28,5 @@ export declare enum MediaPrefix {
28
28
  */
29
29
  V3 = "/im/_matrix/media/v3"
30
30
  }
31
+ export declare const VersionsPrefix = "/im/_matrix/client/versions";
31
32
  //# sourceMappingURL=prefix.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prefix.d.ts","sourceRoot":"","sources":["../../src/http-api/prefix.ts"],"names":[],"mappings":"AAgBA,oBAAY,YAAY;IACpB;;OAEG;IACH,EAAE,0BAA0B;IAC5B;;OAEG;IACH,EAAE,0BAA0B;IAC5B;;OAEG;IACH,QAAQ,gCAAgC;CAC3C;AAED,oBAAY,cAAc;IACtB;;OAEG;IACH,EAAE,4BAA4B;CACjC;AAED,oBAAY,WAAW;IACnB;;OAEG;IACH,EAAE,yBAAyB;IAC3B;;OAEG;IACH,EAAE,yBAAyB;CAC9B"}
1
+ {"version":3,"file":"prefix.d.ts","sourceRoot":"","sources":["../../src/http-api/prefix.ts"],"names":[],"mappings":"AAgBA,oBAAY,YAAY;IACpB;;OAEG;IACH,EAAE,0BAA0B;IAC5B;;OAEG;IACH,EAAE,0BAA0B;IAC5B;;OAEG;IACH,QAAQ,gCAAgC;CAC3C;AAED,oBAAY,cAAc;IACtB;;OAEG;IACH,EAAE,4BAA4B;CACjC;AAED,oBAAY,WAAW;IACnB;;OAEG;IACH,EAAE,yBAAyB;IAC3B;;OAEG;IACH,EAAE,yBAAyB;CAC9B;AAED,eAAO,MAAM,cAAc,gCAAgC,CAAC"}
@@ -29,4 +29,5 @@ export var MediaPrefix = /*#__PURE__*/function (MediaPrefix) {
29
29
  MediaPrefix["V3"] = "/im/_matrix/media/v3";
30
30
  return MediaPrefix;
31
31
  }({});
32
+ export var VersionsPrefix = "/im/_matrix/client/versions";
32
33
  //# sourceMappingURL=prefix.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prefix.js","names":["ClientPrefix","IdentityPrefix","MediaPrefix"],"sources":["../../src/http-api/prefix.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nexport enum ClientPrefix {\n /**\n * A constant representing the URI path for Client-Server API endpoints versioned at v1.\n */\n V1 = \"/im/_matrix/client/v1\",\n /**\n * A constant representing the URI path for Client-Server API endpoints versioned at v3.\n */\n V3 = \"/im/_matrix/client/v3\",\n /**\n * A constant representing the URI path for as-yet unspecified Client-Server HTTP APIs.\n */\n Unstable = \"/im/_matrix/client/unstable\",\n}\n\nexport enum IdentityPrefix {\n /**\n * URI path for the v2 identity API\n */\n V2 = \"/im/_matrix/identity/v2\",\n}\n\nexport enum MediaPrefix {\n /**\n * A constant representing the URI path for Client-Server API Media endpoints versioned at v1.\n */\n V1 = \"/im/_matrix/media/v1\",\n /**\n * A constant representing the URI path for Client-Server API Media endpoints versioned at v3.\n */\n V3 = \"/im/_matrix/media/v3\",\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,WAAYA,YAAY,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAexB,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAO1B,WAAYC,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"prefix.js","names":["ClientPrefix","IdentityPrefix","MediaPrefix","VersionsPrefix"],"sources":["../../src/http-api/prefix.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nexport enum ClientPrefix {\n /**\n * A constant representing the URI path for Client-Server API endpoints versioned at v1.\n */\n V1 = \"/im/_matrix/client/v1\",\n /**\n * A constant representing the URI path for Client-Server API endpoints versioned at v3.\n */\n V3 = \"/im/_matrix/client/v3\",\n /**\n * A constant representing the URI path for as-yet unspecified Client-Server HTTP APIs.\n */\n Unstable = \"/im/_matrix/client/unstable\",\n}\n\nexport enum IdentityPrefix {\n /**\n * URI path for the v2 identity API\n */\n V2 = \"/im/_matrix/identity/v2\",\n}\n\nexport enum MediaPrefix {\n /**\n * A constant representing the URI path for Client-Server API Media endpoints versioned at v1.\n */\n V1 = \"/im/_matrix/media/v1\",\n /**\n * A constant representing the URI path for Client-Server API Media endpoints versioned at v3.\n */\n V3 = \"/im/_matrix/media/v3\",\n}\n\nexport const VersionsPrefix = \"/im/_matrix/client/versions\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,WAAYA,YAAY,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAexB,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAO1B,WAAYC,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAWvB,OAAO,IAAMC,cAAc,GAAG,6BAA6B","ignoreList":[]}
package/lib/sync.js CHANGED
@@ -34,7 +34,7 @@ import { Filter } from "./filter.js";
34
34
  import { EventTimeline } from "./models/event-timeline.js";
35
35
  import { logger } from "./logger.js";
36
36
  import { ClientEvent, PendingEventOrdering } from "./client.js";
37
- import { Method } from "./http-api/index.js";
37
+ import { Method, VersionsPrefix } from "./http-api/index.js";
38
38
  import { EventType } from "./@types/event.js";
39
39
  import { RoomStateEvent } from "./models/room-state.js";
40
40
  import { RoomMemberEvent } from "./models/room-member.js";
@@ -1356,7 +1356,7 @@ export class SyncApi {
1356
1356
  this.connectionReturnedDefer = undefined;
1357
1357
  }
1358
1358
  };
1359
- this.client.http.request(Method.Get, "/_matrix/client/versions", undefined,
1359
+ this.client.http.request(Method.Get, VersionsPrefix, undefined,
1360
1360
  // queryParams
1361
1361
  undefined,
1362
1362
  // data