mirror of
https://github.com/moparisthebest/keepass2android
synced 2025-03-11 07:31:00 -04:00
added legacy support for saved storage paths from WebDav/FTP
added changelog and version number for 1.01 preview-2 release
This commit is contained in:
parent
cf38374505
commit
6ce4ceb91b
@ -415,7 +415,7 @@ namespace keepass2android.Io
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LegacyFtpStorage : BuiltInFileStorage
|
public class LegacyFtpStorage : BuiltInFileStorage
|
||||||
{
|
{
|
||||||
public LegacyFtpStorage(IKp2aApp app) : base(app)
|
public LegacyFtpStorage(IKp2aApp app) : base(app)
|
||||||
{
|
{
|
||||||
@ -432,7 +432,7 @@ namespace keepass2android.Io
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LegacyWebDavStorage : BuiltInFileStorage
|
public class LegacyWebDavStorage : BuiltInFileStorage
|
||||||
{
|
{
|
||||||
public LegacyWebDavStorage(IKp2aApp app) : base(app)
|
public LegacyWebDavStorage(IKp2aApp app) : base(app)
|
||||||
{
|
{
|
||||||
|
@ -352,7 +352,7 @@ namespace keepass2android.Io
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string IocToPath(IOConnectionInfo ioc)
|
public virtual string IocToPath(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
return ioc.Path;
|
return ioc.Path;
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,17 @@ namespace keepass2android.Io
|
|||||||
|
|
||||||
public static ConnectionSettings FromIoc(IOConnectionInfo ioc)
|
public static ConnectionSettings FromIoc(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
|
if (!string.IsNullOrEmpty(ioc.UserName))
|
||||||
|
{
|
||||||
|
//legacy support
|
||||||
|
return new ConnectionSettings()
|
||||||
|
{
|
||||||
|
EncryptionMode = FtpEncryptionMode.None,
|
||||||
|
Username = ioc.UserName,
|
||||||
|
Password = ioc.Password
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
string path = ioc.Path;
|
string path = ioc.Path;
|
||||||
int schemeLength = path.IndexOf("://", StringComparison.Ordinal);
|
int schemeLength = path.IndexOf("://", StringComparison.Ordinal);
|
||||||
path = path.Substring(schemeLength + 3);
|
path = path.Substring(schemeLength + 3);
|
||||||
@ -155,7 +166,7 @@ namespace keepass2android.Io
|
|||||||
{
|
{
|
||||||
using (FtpClient client = GetClient(ioc))
|
using (FtpClient client = GetClient(ioc))
|
||||||
{
|
{
|
||||||
string localPath = IocPathToUri(ioc.Path).PathAndQuery;
|
string localPath = IocToUri(ioc).PathAndQuery;
|
||||||
if (client.DirectoryExists(localPath))
|
if (client.DirectoryExists(localPath))
|
||||||
client.DeleteDirectory(localPath, true);
|
client.DeleteDirectory(localPath, true);
|
||||||
else
|
else
|
||||||
@ -194,7 +205,7 @@ namespace keepass2android.Io
|
|||||||
else
|
else
|
||||||
client.Credentials = new NetworkCredential("anonymous", ""); //TODO TEST
|
client.Credentials = new NetworkCredential("anonymous", ""); //TODO TEST
|
||||||
|
|
||||||
Uri uri = IocPathToUri(ioc.Path);
|
Uri uri = IocToUri(ioc);
|
||||||
client.Host = uri.Host;
|
client.Host = uri.Host;
|
||||||
if (!uri.IsDefaultPort) //TODO test
|
if (!uri.IsDefaultPort) //TODO test
|
||||||
client.Port = uri.Port;
|
client.Port = uri.Port;
|
||||||
@ -214,14 +225,25 @@ namespace keepass2android.Io
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
internal Uri IocPathToUri(string path)
|
internal Uri IocToUri(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
|
if (!string.IsNullOrEmpty(ioc.UserName))
|
||||||
|
{
|
||||||
|
//legacy support.
|
||||||
|
return new Uri(ioc.Path);
|
||||||
|
}
|
||||||
|
string path = ioc.Path;
|
||||||
//remove additional stuff like TLS param
|
//remove additional stuff like TLS param
|
||||||
int schemeLength = path.IndexOf("://", StringComparison.Ordinal);
|
int schemeLength = path.IndexOf("://", StringComparison.Ordinal);
|
||||||
string scheme = path.Substring(0, schemeLength);
|
string scheme = path.Substring(0, schemeLength);
|
||||||
path = path.Substring(schemeLength + 3);
|
path = path.Substring(schemeLength + 3);
|
||||||
string settings = path.Substring(0, path.IndexOf(ConnectionSettings.SettingsPostFix, StringComparison.Ordinal));
|
if (path.StartsWith(ConnectionSettings.SettingsPrefix))
|
||||||
path = path.Substring(settings.Length + 1);
|
{
|
||||||
|
//this should always be the case. However, in rare cases we might get an ioc with legacy path but no username set (if they only want to get a display name)
|
||||||
|
string settings = path.Substring(0, path.IndexOf(ConnectionSettings.SettingsPostFix, StringComparison.Ordinal));
|
||||||
|
path = path.Substring(settings.Length + 1);
|
||||||
|
|
||||||
|
}
|
||||||
return new Uri(scheme + "://" + path);
|
return new Uri(scheme + "://" + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +276,7 @@ namespace keepass2android.Io
|
|||||||
{
|
{
|
||||||
using (var cl = GetClient(ioc))
|
using (var cl = GetClient(ioc))
|
||||||
{
|
{
|
||||||
return cl.OpenRead(IocPathToUri(ioc.Path).PathAndQuery, FtpDataType.Binary, 0);
|
return cl.OpenRead(IocToUri(ioc).PathAndQuery, FtpDataType.Binary, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (FtpCommandException ex)
|
catch (FtpCommandException ex)
|
||||||
@ -282,7 +304,6 @@ namespace keepass2android.Io
|
|||||||
|
|
||||||
public string GetFilenameWithoutPathAndExt(IOConnectionInfo ioc)
|
public string GetFilenameWithoutPathAndExt(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
//TODO does this work when flags are encoded in the iocPath?
|
|
||||||
return UrlUtil.StripExtension(
|
return UrlUtil.StripExtension(
|
||||||
UrlUtil.GetFileName(ioc.Path));
|
UrlUtil.GetFileName(ioc.Path));
|
||||||
}
|
}
|
||||||
@ -298,7 +319,7 @@ namespace keepass2android.Io
|
|||||||
{
|
{
|
||||||
using (var client = GetClient(ioc))
|
using (var client = GetClient(ioc))
|
||||||
{
|
{
|
||||||
client.CreateDirectory(IocPathToUri(GetFilePath(ioc, newDirName).Path).PathAndQuery);
|
client.CreateDirectory(IocToUri(GetFilePath(ioc, newDirName)).PathAndQuery);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (FtpCommandException ex)
|
catch (FtpCommandException ex)
|
||||||
@ -314,7 +335,7 @@ namespace keepass2android.Io
|
|||||||
using (var client = GetClient(ioc))
|
using (var client = GetClient(ioc))
|
||||||
{
|
{
|
||||||
List<FileDescription> files = new List<FileDescription>();
|
List<FileDescription> files = new List<FileDescription>();
|
||||||
foreach (FtpListItem item in client.GetListing(IocPathToUri(ioc.Path).PathAndQuery,
|
foreach (FtpListItem item in client.GetListing(IocToUri(ioc).PathAndQuery,
|
||||||
FtpListOption.Modify | FtpListOption.Size | FtpListOption.DerefLinks))
|
FtpListOption.Modify | FtpListOption.Size | FtpListOption.DerefLinks))
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -366,7 +387,7 @@ namespace keepass2android.Io
|
|||||||
using (FtpClient client = GetClient(ioc))
|
using (FtpClient client = GetClient(ioc))
|
||||||
{
|
{
|
||||||
|
|
||||||
var uri = IocPathToUri(ioc.Path);
|
var uri = IocToUri(ioc);
|
||||||
string path = uri.PathAndQuery;
|
string path = uri.PathAndQuery;
|
||||||
if (!client.FileExists(path) && (!client.DirectoryExists(path)))
|
if (!client.FileExists(path) && (!client.DirectoryExists(path)))
|
||||||
throw new FileNotFoundException();
|
throw new FileNotFoundException();
|
||||||
@ -439,7 +460,7 @@ namespace keepass2android.Io
|
|||||||
|
|
||||||
public string GetDisplayName(IOConnectionInfo ioc)
|
public string GetDisplayName(IOConnectionInfo ioc)
|
||||||
{
|
{
|
||||||
var uri = IocPathToUri(ioc.Path);
|
var uri = IocToUri(ioc);
|
||||||
return uri.ToString(); //TODO is this good?
|
return uri.ToString(); //TODO is this good?
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,7 +500,7 @@ namespace keepass2android.Io
|
|||||||
{
|
{
|
||||||
using (var client = GetClient(ioc))
|
using (var client = GetClient(ioc))
|
||||||
{
|
{
|
||||||
return client.OpenWrite(IocPathToUri(ioc.Path).PathAndQuery);
|
return client.OpenWrite(IocToUri(ioc).PathAndQuery);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,7 +569,7 @@ namespace keepass2android.Io
|
|||||||
{
|
{
|
||||||
|
|
||||||
_client = _fileStorage.GetClient(_ioc, false);
|
_client = _fileStorage.GetClient(_ioc, false);
|
||||||
_stream = _client.OpenWrite(_fileStorage.IocPathToUri(_iocTemp.Path).PathAndQuery);
|
_stream = _client.OpenWrite(_fileStorage.IocToUri(_iocTemp).PathAndQuery);
|
||||||
return _stream;
|
return _stream;
|
||||||
}
|
}
|
||||||
catch (FtpCommandException ex)
|
catch (FtpCommandException ex)
|
||||||
@ -568,8 +589,8 @@ namespace keepass2android.Io
|
|||||||
//make sure target file does not exist:
|
//make sure target file does not exist:
|
||||||
//try
|
//try
|
||||||
{
|
{
|
||||||
if (_client.FileExists(_fileStorage.IocPathToUri(_ioc.Path).PathAndQuery))
|
if (_client.FileExists(_fileStorage.IocToUri(_ioc).PathAndQuery))
|
||||||
_client.DeleteFile(_fileStorage.IocPathToUri(_ioc.Path).PathAndQuery);
|
_client.DeleteFile(_fileStorage.IocToUri(_ioc).PathAndQuery);
|
||||||
|
|
||||||
}
|
}
|
||||||
//catch (FtpCommandException)
|
//catch (FtpCommandException)
|
||||||
@ -577,8 +598,8 @@ namespace keepass2android.Io
|
|||||||
//TODO get a new clien? might be stale
|
//TODO get a new clien? might be stale
|
||||||
}
|
}
|
||||||
|
|
||||||
_client.Rename(_fileStorage.IocPathToUri(_iocTemp.Path).PathAndQuery,
|
_client.Rename(_fileStorage.IocToUri(_iocTemp).PathAndQuery,
|
||||||
_fileStorage.IocPathToUri(_ioc.Path).PathAndQuery);
|
_fileStorage.IocToUri(_ioc).PathAndQuery);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (FtpCommandException ex)
|
catch (FtpCommandException ex)
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -26,7 +26,7 @@ namespace keepass2android
|
|||||||
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeHoloLightDialog));
|
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeHoloLightDialog));
|
||||||
builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title));
|
builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title));
|
||||||
List<string> changeLog = new List<string>{
|
List<string> changeLog = new List<string>{
|
||||||
ctx.GetString(Resource.String.ChangeLog_1_01_preview),
|
ctx.GetString(Resource.String.ChangeLog_1_01),
|
||||||
ctx.GetString(Resource.String.ChangeLog_1_0_0e),
|
ctx.GetString(Resource.String.ChangeLog_1_0_0e),
|
||||||
ctx.GetString(Resource.String.ChangeLog_1_0_0),
|
ctx.GetString(Resource.String.ChangeLog_1_0_0),
|
||||||
ctx.GetString(Resource.String.ChangeLog_0_9_9c),
|
ctx.GetString(Resource.String.ChangeLog_0_9_9c),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:versionCode="82"
|
android:versionCode="83"
|
||||||
android:versionName="1.01-pre1"
|
android:versionName="1.01-pre2"
|
||||||
package="keepass2android.keepass2android"
|
package="keepass2android.keepass2android"
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
|
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
|
||||||
|
@ -680,13 +680,14 @@
|
|||||||
* Fix for SSL vulnerability in Microsoft Live SDK (used when accessing files via OneDrive)\n
|
* Fix for SSL vulnerability in Microsoft Live SDK (used when accessing files via OneDrive)\n
|
||||||
* Bug fix: Previous release contained two input methods (one crashing)\n
|
* Bug fix: Previous release contained two input methods (one crashing)\n
|
||||||
</string>
|
</string>
|
||||||
|
<string name="ChangeLog_1_01">
|
||||||
<string name="ChangeLog_1_01_preview">
|
Version 1.01 preview\n
|
||||||
Version 1.01-pre1\n
|
* Reimplemented WebDav file storage, now allows file browsing and supports modern encryption.\n
|
||||||
* NOTE: this is a preview, ONLY use for testing!\n
|
* Reimpleented FTP file storage, now allows file browsing and supports encryption (FTPS).\n
|
||||||
* added preview-support for the new KDBX-4-format (see http://keepass.info/help/kb/kdbx_4.html) including Argon2 key derivation and ChaCha20 encryption. Argon2 is currently only implemented in managed code. Expect a slow transformation process.\n
|
* Updated to OneDrive SDK (previously used Live SDK is no longer updated)\n
|
||||||
|
* Updated to Dropbox SDK v2 (previously v1 SDK is deprecated).\n
|
||||||
|
* added preview-support for the new KDBX-4-format (see http://keepass.info/help/kb/kdbx_4.html) including Argon2 key derivation and ChaCha20 encryption. Argon2 is currently only implemented in managed code. Expect a slow transformation process. This is for TESTING ONLY!\n
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<string name="ChangeLog_1_0_0e">
|
<string name="ChangeLog_1_0_0e">
|
||||||
Version 1.0.0e\n
|
Version 1.0.0e\n
|
||||||
* fix for Fingerprint Unlock on older Samsung devices with Android 6\n
|
* fix for Fingerprint Unlock on older Samsung devices with Android 6\n
|
||||||
|
@ -515,6 +515,8 @@ namespace keepass2android
|
|||||||
new SftpFileStorage(this),
|
new SftpFileStorage(this),
|
||||||
new NetFtpFileStorage(Application.Context, this),
|
new NetFtpFileStorage(Application.Context, this),
|
||||||
new WebDavFileStorage(this),
|
new WebDavFileStorage(this),
|
||||||
|
//new LegacyWebDavStorage(this),
|
||||||
|
//new LegacyFtpStorage(this),
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
new LocalFileStorage(this)
|
new LocalFileStorage(this)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user