mirror of https://github.com/keeweb/keeweb.git
allow to add multiple files
This commit is contained in:
parent
f10fd3172e
commit
8093279b95
|
@ -72,17 +72,19 @@ var AppModel = Backbone.Model.extend({
|
|||
|
||||
applyUserConfig(config) {
|
||||
this.settings.set(config.settings);
|
||||
if (config.file && config.file.storage && config.file.name && config.file.path) {
|
||||
if (!this.fileInfos.getMatch(config.file.storage, config.file.name, config.file.path)) {
|
||||
var fileInfo = new FileInfoModel({
|
||||
if (config.files) {
|
||||
config.files
|
||||
.filter(file => file && file.storage && file.name && file.path &&
|
||||
!this.fileInfos.getMatch(file.storage, file.name, file.path))
|
||||
.map(file => new FileInfoModel({
|
||||
id: IdGenerator.uuid(),
|
||||
name: config.file.name,
|
||||
storage: config.file.storage,
|
||||
path: config.file.path,
|
||||
opts: config.file.options
|
||||
});
|
||||
this.fileInfos.unshift(fileInfo);
|
||||
}
|
||||
name: file.name,
|
||||
storage: file.storage,
|
||||
path: file.path,
|
||||
opts: file.options
|
||||
}))
|
||||
.reverse()
|
||||
.forEach(fi => this.fileInfos.unshift(fi));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -358,7 +360,7 @@ var AppModel = Backbone.Model.extend({
|
|||
logger.info('Load from storage');
|
||||
storage.load(params.path, params.opts, (err, data, stat) => {
|
||||
if (err) {
|
||||
if (fileInfo) {
|
||||
if (fileInfo && fileInfo.openDate) {
|
||||
logger.info('Open file from cache because of storage load error', err);
|
||||
that.openFileFromCache(params, callback, fileInfo);
|
||||
} else {
|
||||
|
|
|
@ -169,6 +169,7 @@ var Locale = {
|
|||
openConfigErrorNotFound: 'File not found',
|
||||
openError: 'Error',
|
||||
openErrorDescription: 'There was an error opening file',
|
||||
openErrorFileNotFound: 'File not found',
|
||||
|
||||
detAttDownload: 'Shift-click attachment button to download or ',
|
||||
detAttDelToRemove: 'Delete to remove',
|
||||
|
|
|
@ -471,6 +471,9 @@ var OpenView = Backbone.View.extend({
|
|||
this.inputEl[0].selectionStart = 0;
|
||||
this.inputEl[0].selectionEnd = this.inputEl.val().length;
|
||||
if (err.code !== 'InvalidKey') {
|
||||
if (err.notFound) {
|
||||
err = Locale.openErrorFileNotFound;
|
||||
}
|
||||
Alerts.error({
|
||||
header: Locale.openError,
|
||||
body: Locale.openErrorDescription + '<pre class="modal__pre">' + _.escape(err.toString()) + '</pre>'
|
||||
|
|
|
@ -35,10 +35,10 @@
|
|||
"onedrive": true,
|
||||
"onedriveClientId": null
|
||||
},
|
||||
"file": {
|
||||
"files": [{
|
||||
"storage": "webdav",
|
||||
"name": "",
|
||||
"path": "",
|
||||
"options": { "user": "", "password": "" }
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue