mirror of
https://github.com/keeweb/keeweb.git
synced 2024-06-21 07:06:39 +02:00
fix #81: fix dropbox folder selection
This commit is contained in:
parent
a75a1bc66c
commit
0de302c61b
|
@ -248,7 +248,6 @@ var DropboxLink = {
|
|||
var isSelfHostedApp = !/^http(s?):\/\/localhost:8085/.test(location.href) &&
|
||||
!/http(s?):\/\/antelle\.github\.io\/keeweb/.test(location.href) &&
|
||||
!/http(s?):\/\/app\.keeweb\.info/.test(location.href);
|
||||
isSelfHostedApp = true;
|
||||
return Launcher || !isSelfHostedApp || getKey() !== DropboxKeys.AppFolderKeyParts.join('');
|
||||
},
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
var DropboxLink = require('../comp/dropbox-link'),
|
||||
AppSettingsModel = require('../models/app-settings-model'),
|
||||
Locale = require('../util/locale'),
|
||||
UrlUtils = require('../util/url-util'),
|
||||
Logger = require('../util/logger');
|
||||
|
||||
|
@ -128,7 +129,7 @@ var StorageDropbox = {
|
|||
if (err) { return callback(err); }
|
||||
DropboxLink.list(that._toFullPath(''), function(err, files, dirStat, filesStat) {
|
||||
if (err) { return callback(err); }
|
||||
var result = filesStat
|
||||
var fileList = filesStat
|
||||
.filter(function(f) { return !f.isFolder && !f.isRemoved; })
|
||||
.map(function(f) {
|
||||
return {
|
||||
|
@ -137,7 +138,8 @@ var StorageDropbox = {
|
|||
rev: f.versionTag
|
||||
};
|
||||
});
|
||||
callback(null, result);
|
||||
var dir = dirStat.inAppFolder ? Locale.openAppFolder : UrlUtils.trimStartSlash(dirStat.path);
|
||||
callback(null, fileList, dir);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -118,7 +118,8 @@ var Locale = {
|
|||
openDropHere: 'drop files here',
|
||||
openFailedRead: 'Failed to read file',
|
||||
openNothingFound: 'Nothing found',
|
||||
openNothingFoundBody: 'No files which could be opened.',
|
||||
openNothingFoundBody: 'No files which could be opened (files are searched inside {} folder).',
|
||||
openAppFolder: 'app',
|
||||
openSelectFile: 'Select a file',
|
||||
openSelectFileBody: 'Select a file which you would like to open',
|
||||
openPassFor: 'Password for',
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
var UrlUtil = {
|
||||
multiSlashRegex: /\/{2,}/g,
|
||||
lastPartRegex: /[^\/]+$/,
|
||||
trimStartSlashRegex: /^\\/,
|
||||
|
||||
getDataFileName: function(url) {
|
||||
var ix = url.lastIndexOf('/');
|
||||
|
@ -19,6 +20,10 @@ var UrlUtil = {
|
|||
|
||||
fileToDir: function(url) {
|
||||
return url.replace(this.lastPartRegex, '');
|
||||
},
|
||||
|
||||
trimStartSlash: function(url) {
|
||||
return url.replace(this.trimStartSlashRegex, '');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ var OpenView = Backbone.View.extend({
|
|||
var that = this;
|
||||
that.busy = true;
|
||||
icon.toggleClass('flip3d', true);
|
||||
storage.list(function(err, files) {
|
||||
storage.list(function(err, files, dir) {
|
||||
icon.toggleClass('flip3d', false);
|
||||
that.busy = false;
|
||||
if (err || !files) {
|
||||
|
@ -518,7 +518,10 @@ var OpenView = Backbone.View.extend({
|
|||
allStorageFiles[file.path] = file;
|
||||
});
|
||||
if (!buttons.length) {
|
||||
Alerts.error({ header: Locale.openNothingFound, body: Locale.openNothingFoundBody });
|
||||
Alerts.error({
|
||||
header: Locale.openNothingFound,
|
||||
body: Locale.openNothingFoundBody.replace('{}', dir)
|
||||
});
|
||||
return;
|
||||
}
|
||||
buttons.push({result: '', title: Locale.alertCancel});
|
||||
|
|
Loading…
Reference in New Issue
Block a user