summaryrefslogtreecommitdiff
path: root/bot/node_modules/matrix-js-sdk/lib/content-repo.js.map
diff options
context:
space:
mode:
Diffstat (limited to 'bot/node_modules/matrix-js-sdk/lib/content-repo.js.map')
-rw-r--r--bot/node_modules/matrix-js-sdk/lib/content-repo.js.map1
1 files changed, 1 insertions, 0 deletions
diff --git a/bot/node_modules/matrix-js-sdk/lib/content-repo.js.map b/bot/node_modules/matrix-js-sdk/lib/content-repo.js.map
new file mode 100644
index 0000000..4738edf
--- /dev/null
+++ b/bot/node_modules/matrix-js-sdk/lib/content-repo.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"content-repo.js","names":["_utils","require","getHttpUriForMxc","baseUrl","mxc","width","height","resizeMethod","allowDirectLinks","indexOf","serverAndMediaId","slice","prefix","params","Math","round","toString","Object","keys","length","fragmentOffset","fragment","urlParams","encodeParams"],"sources":["../src/content-repo.ts"],"sourcesContent":["/*\nCopyright 2015 - 2021 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\nimport { encodeParams } from \"./utils\";\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 * @returns The complete URL to the content.\n */\nexport function getHttpUriForMxc(\n baseUrl: string,\n mxc?: string,\n width?: number,\n height?: number,\n resizeMethod?: string,\n allowDirectLinks = false,\n): string {\n if (typeof mxc !== \"string\" || !mxc) {\n return \"\";\n }\n if (mxc.indexOf(\"mxc://\") !== 0) {\n if (allowDirectLinks) {\n return mxc;\n } else {\n return \"\";\n }\n }\n let serverAndMediaId = mxc.slice(6); // strips mxc://\n let prefix = \"/_matrix/media/v3/download/\";\n const params: Record<string, string> = {};\n\n if (width) {\n params[\"width\"] = Math.round(width).toString();\n }\n if (height) {\n params[\"height\"] = Math.round(height).toString();\n }\n if (resizeMethod) {\n params[\"method\"] = resizeMethod;\n }\n if (Object.keys(params).length > 0) {\n // these are thumbnailing params so they probably want the\n // thumbnailing API...\n prefix = \"/_matrix/media/v3/thumbnail/\";\n }\n\n const fragmentOffset = serverAndMediaId.indexOf(\"#\");\n let fragment = \"\";\n if (fragmentOffset >= 0) {\n fragment = serverAndMediaId.slice(fragmentOffset);\n serverAndMediaId = serverAndMediaId.slice(0, fragmentOffset);\n }\n\n const urlParams = Object.keys(params).length === 0 ? \"\" : \"?\" + encodeParams(params);\n return baseUrl + prefix + serverAndMediaId + urlParams + fragment;\n}\n"],"mappings":";;;;;;AAgBA,IAAAA,MAAA,GAAAC,OAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAC5BC,OAAe,EACfC,GAAY,EACZC,KAAc,EACdC,MAAe,EACfC,YAAqB,EACrBC,gBAAgB,GAAG,KAAK,EAClB;EACN,IAAI,OAAOJ,GAAG,KAAK,QAAQ,IAAI,CAACA,GAAG,EAAE;IACjC,OAAO,EAAE;EACb;EACA,IAAIA,GAAG,CAACK,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;IAC7B,IAAID,gBAAgB,EAAE;MAClB,OAAOJ,GAAG;IACd,CAAC,MAAM;MACH,OAAO,EA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