You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
WIP url previewing
This commit is contained in:
@@ -1448,6 +1448,23 @@ MatrixClient.prototype.getCurrentUploads = function() {
|
||||
return this._http.getCurrentUploads();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a preview of the given URL as OpenGraph metadata
|
||||
* @param {module:client.callback} callback Optional.
|
||||
* @return {module:client.Promise} Resolves: Object of OG metadata.
|
||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||
* May return synthesized attributes if the URL lacked OG meta.
|
||||
*/
|
||||
MatrixClient.prototype.getUrlPreview = function(url, callback) {
|
||||
// FIXME: maintain a clientside cache to stop hammering synapse
|
||||
// especially as synapse doesn't cache yet
|
||||
return this._http.authedRequestWithPrefix(
|
||||
callback, "GET", "/preview_url", {
|
||||
url: url
|
||||
}, undefined, httpApi.PREFIX_MEDIA_R0
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} roomId
|
||||
* @param {boolean} isTyping
|
||||
|
||||
@@ -47,6 +47,11 @@ module.exports.PREFIX_UNSTABLE = "/_matrix/client/unstable";
|
||||
*/
|
||||
module.exports.PREFIX_IDENTITY_V1 = "/_matrix/identity/api/v1";
|
||||
|
||||
/**
|
||||
* URI path for the media repo API
|
||||
*/
|
||||
module.exports.PREFIX_MEDIA_R0 = "/_matrix/media/r0";
|
||||
|
||||
/**
|
||||
* Construct a MatrixHttpApi.
|
||||
* @constructor
|
||||
|
||||
Reference in New Issue
Block a user