Добавлена синхронизация файлов обоев
This commit is contained in:
@@ -174,11 +174,10 @@ class Reader {
|
||||
return await axios.get(url, options);
|
||||
}
|
||||
|
||||
async uploadFile(file, maxUploadFileSize, callback) {
|
||||
if (!maxUploadFileSize)
|
||||
maxUploadFileSize = 10*1024*1024;
|
||||
async uploadFile(file, maxUploadFileSize = 10*1024*1024, callback) {
|
||||
if (file.size > maxUploadFileSize)
|
||||
throw new Error(`Размер файла превышает ${maxUploadFileSize} байт`);
|
||||
|
||||
let formData = new FormData();
|
||||
formData.append('file', file, file.name);
|
||||
|
||||
@@ -225,6 +224,21 @@ class Reader {
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
async uploadFileBuf(buf) {
|
||||
const response = await wsc.message(await wsc.send({action: 'upload-file-buf', buf}));
|
||||
|
||||
if (response.error)
|
||||
throw new Error(response.error);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
async getUploadedFileBuf(url) {
|
||||
url = url.replace('disk://', '/upload/');
|
||||
return (await axios.get(url)).data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default new Reader();
|
||||
Reference in New Issue
Block a user