mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Merge branch 'staging' into ooapi-dl
This commit is contained in:
commit
2374445c6a
@ -13,6 +13,18 @@
|
||||
return Array.prototype.slice.call(A, start, end);
|
||||
};
|
||||
|
||||
Util.u8ToBase64 = (u8, cb) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
let res = reader.result;
|
||||
let trim = res.slice(res.indexOf(',') + 1);
|
||||
cb(trim);
|
||||
};
|
||||
reader.readAsDataURL(new Blob([u8]));
|
||||
};
|
||||
|
||||
|
||||
|
||||
Util.shuffleArray = function (a) {
|
||||
for (var i = a.length - 1; i > 0; i--) {
|
||||
var j = Math.floor(Math.random() * (i + 1));
|
||||
|
||||
@ -19,9 +19,7 @@ define([
|
||||
'/common/media-tag.js',
|
||||
|
||||
'/components/file-saver/FileSaver.min.js',
|
||||
'/components/tweetnacl/nacl-fast.min.js',
|
||||
], function ($, ApiConfig, FileCrypto, MakeBackup, Thumb, UI, UIElements, Util, Hash, h, Messages, Pages, nThen, MT) {
|
||||
var Nacl = window.nacl;
|
||||
var module = {};
|
||||
|
||||
var blobToArrayBuffer = function (blob, cb) {
|
||||
@ -221,10 +219,12 @@ define([
|
||||
|
||||
file.noStore = config.noStore;
|
||||
try {
|
||||
file.blob = Nacl.util.encodeBase64(u8);
|
||||
file.teamId = teamId;
|
||||
common.uploadFile(file, function () {
|
||||
console.log('Upload started...');
|
||||
Util.u8ToBase64(u8, b64 => {
|
||||
file.blob = b64;
|
||||
file.teamId = teamId;
|
||||
common.uploadFile(file, function () {
|
||||
console.log('Upload started...');
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
UI.alert(Messages.upload_serverError);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user