mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 04:15:17 +00:00
Can send files to conversations
This commit is contained in:
@ -10,7 +10,7 @@ const APIClient = {
|
||||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
exec: function(apiURI, args, withLogin){
|
||||
exec: function(apiURI, args, withLogin) {
|
||||
|
||||
if(!args)
|
||||
args = {};
|
||||
@ -29,6 +29,24 @@ const APIClient = {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns {Promise}
|
||||
*/
|
||||
execFormData: function(uri, data, withLogin) {
|
||||
if (!data)
|
||||
data = new FormData();
|
||||
|
||||
return new Promise((res, rej) => {
|
||||
this.makeFormDatarequest(uri, data, withLogin, (result) => {
|
||||
if (result.error)
|
||||
reject(result.error);
|
||||
|
||||
else
|
||||
res(result);
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Make an API request
|
||||
*
|
||||
|
@ -833,4 +833,13 @@ function rpad(str, len, fill) {
|
||||
while(str.length < len)
|
||||
str = fill + str
|
||||
return str
|
||||
}
|
||||
|
||||
/**
|
||||
* Format file size to human readable format
|
||||
*
|
||||
* @param {number} size The size to format
|
||||
*/
|
||||
function fileSizeToHuman(size) {
|
||||
return Math.round(ServerConfig.conf.conversation_files_max_size/(1000*1000)*100)/100 + "MB";
|
||||
}
|
Reference in New Issue
Block a user