|
|
@ -212,8 +212,10 @@ define([
|
|
|
|
queue.next();
|
|
|
|
queue.next();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Don't show the rename prompt if we don't want to store the file in the drive (avatar)
|
|
|
|
// Don't show the rename and password prompts if we don't store the file in the drive
|
|
|
|
|
|
|
|
// e.g. avatar
|
|
|
|
var showNamePrompt = !config.noStore;
|
|
|
|
var showNamePrompt = !config.noStore;
|
|
|
|
|
|
|
|
var showPasswordPrompt = !config.noStore;
|
|
|
|
|
|
|
|
|
|
|
|
var promptName = function (file, cb) {
|
|
|
|
var promptName = function (file, cb) {
|
|
|
|
var extIdx = file.name.lastIndexOf('.');
|
|
|
|
var extIdx = file.name.lastIndexOf('.');
|
|
|
@ -225,6 +227,7 @@ define([
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
UI.prompt(msg, name, function (newName) {
|
|
|
|
UI.prompt(msg, name, function (newName) {
|
|
|
|
if (newName === null) {
|
|
|
|
if (newName === null) {
|
|
|
|
|
|
|
|
// "Don't ask me again"
|
|
|
|
showNamePrompt = false;
|
|
|
|
showNamePrompt = false;
|
|
|
|
return void cb (file.name);
|
|
|
|
return void cb (file.name);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -235,6 +238,19 @@ define([
|
|
|
|
cb(newName);
|
|
|
|
cb(newName);
|
|
|
|
}, {cancel: Messages.doNotAskAgain}, true);
|
|
|
|
}, {cancel: Messages.doNotAskAgain}, true);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var promptPassword = function (file, cb) {
|
|
|
|
|
|
|
|
var msg = Messages.upload_password;
|
|
|
|
|
|
|
|
UI.prompt(msg, '', function (password) {
|
|
|
|
|
|
|
|
if (password === null) {
|
|
|
|
|
|
|
|
// "Don't ask me again"
|
|
|
|
|
|
|
|
showPasswordPrompt = false;
|
|
|
|
|
|
|
|
return void cb ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cb(password);
|
|
|
|
|
|
|
|
}, {cancel: Messages.doNotAskAgain, password: true}, true);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var handleFileState = {
|
|
|
|
var handleFileState = {
|
|
|
|
queue: [],
|
|
|
|
queue: [],
|
|
|
|
inProgress: false
|
|
|
|
inProgress: false
|
|
|
@ -246,6 +262,7 @@ define([
|
|
|
|
var thumb;
|
|
|
|
var thumb;
|
|
|
|
var file_arraybuffer;
|
|
|
|
var file_arraybuffer;
|
|
|
|
var name = file.name;
|
|
|
|
var name = file.name;
|
|
|
|
|
|
|
|
var password;
|
|
|
|
var finish = function () {
|
|
|
|
var finish = function () {
|
|
|
|
var metadata = {
|
|
|
|
var metadata = {
|
|
|
|
name: name,
|
|
|
|
name: name,
|
|
|
@ -255,6 +272,7 @@ define([
|
|
|
|
queue.push({
|
|
|
|
queue.push({
|
|
|
|
blob: file_arraybuffer,
|
|
|
|
blob: file_arraybuffer,
|
|
|
|
metadata: metadata,
|
|
|
|
metadata: metadata,
|
|
|
|
|
|
|
|
password: password,
|
|
|
|
dropEvent: e
|
|
|
|
dropEvent: e
|
|
|
|
});
|
|
|
|
});
|
|
|
|
handleFileState.inProgress = false;
|
|
|
|
handleFileState.inProgress = false;
|
|
|
@ -263,11 +281,18 @@ define([
|
|
|
|
handleFile(next[0], next[1]);
|
|
|
|
handleFile(next[0], next[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
var getPassword = function () {
|
|
|
|
|
|
|
|
if (!showPasswordPrompt) { return void finish(); }
|
|
|
|
|
|
|
|
promptPassword(file, function (pw) {
|
|
|
|
|
|
|
|
password = pw;
|
|
|
|
|
|
|
|
finish();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
var getName = function () {
|
|
|
|
var getName = function () {
|
|
|
|
if (!showNamePrompt) { return void finish(); }
|
|
|
|
if (!showNamePrompt) { return void getPassword(); }
|
|
|
|
promptName(file, function (newName) {
|
|
|
|
promptName(file, function (newName) {
|
|
|
|
name = newName;
|
|
|
|
name = newName;
|
|
|
|
finish();
|
|
|
|
getPassword();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|