mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-12-22 06:58:50 -05: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)
|
||||
{
|
||||
@ -432,7 +432,7 @@ namespace keepass2android.Io
|
||||
}
|
||||
}
|
||||
|
||||
class LegacyWebDavStorage : BuiltInFileStorage
|
||||
public class LegacyWebDavStorage : BuiltInFileStorage
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -99,6 +99,17 @@ namespace keepass2android.Io
|
||||
|
||||
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;
|
||||
int schemeLength = path.IndexOf("://", StringComparison.Ordinal);
|
||||
path = path.Substring(schemeLength + 3);
|
||||
@ -155,7 +166,7 @@ namespace keepass2android.Io
|
||||
{
|
||||
using (FtpClient client = GetClient(ioc))
|
||||
{
|
||||
string localPath = IocPathToUri(ioc.Path).PathAndQuery;
|
||||
string localPath = IocToUri(ioc).PathAndQuery;
|
||||
if (client.DirectoryExists(localPath))
|
||||
client.DeleteDirectory(localPath, true);
|
||||
else
|
||||
@ -194,7 +205,7 @@ namespace keepass2android.Io
|
||||
else
|
||||
client.Credentials = new NetworkCredential("anonymous", ""); //TODO TEST
|
||||
|
||||
Uri uri = IocPathToUri(ioc.Path);
|
||||
Uri uri = IocToUri(ioc);
|
||||
client.Host = uri.Host;
|
||||
if (!uri.IsDefaultPort) //TODO test
|
||||
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
|
||||
int schemeLength = path.IndexOf("://", StringComparison.Ordinal);
|
||||
string scheme = path.Substring(0, schemeLength);
|
||||
path = path.Substring(schemeLength + 3);
|
||||
if (path.StartsWith(ConnectionSettings.SettingsPrefix))
|
||||
{
|
||||
//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);
|
||||
}
|
||||
|
||||
@ -254,7 +276,7 @@ namespace keepass2android.Io
|
||||
{
|
||||
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)
|
||||
@ -282,7 +304,6 @@ namespace keepass2android.Io
|
||||
|
||||
public string GetFilenameWithoutPathAndExt(IOConnectionInfo ioc)
|
||||
{
|
||||
//TODO does this work when flags are encoded in the iocPath?
|
||||
return UrlUtil.StripExtension(
|
||||
UrlUtil.GetFileName(ioc.Path));
|
||||
}
|
||||
@ -298,7 +319,7 @@ namespace keepass2android.Io
|
||||
{
|
||||
using (var client = GetClient(ioc))
|
||||
{
|
||||
client.CreateDirectory(IocPathToUri(GetFilePath(ioc, newDirName).Path).PathAndQuery);
|
||||
client.CreateDirectory(IocToUri(GetFilePath(ioc, newDirName)).PathAndQuery);
|
||||
}
|
||||
}
|
||||
catch (FtpCommandException ex)
|
||||
@ -314,7 +335,7 @@ namespace keepass2android.Io
|
||||
using (var client = GetClient(ioc))
|
||||
{
|
||||
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))
|
||||
{
|
||||
|
||||
@ -366,7 +387,7 @@ namespace keepass2android.Io
|
||||
using (FtpClient client = GetClient(ioc))
|
||||
{
|
||||
|
||||
var uri = IocPathToUri(ioc.Path);
|
||||
var uri = IocToUri(ioc);
|
||||
string path = uri.PathAndQuery;
|
||||
if (!client.FileExists(path) && (!client.DirectoryExists(path)))
|
||||
throw new FileNotFoundException();
|
||||
@ -439,7 +460,7 @@ namespace keepass2android.Io
|
||||
|
||||
public string GetDisplayName(IOConnectionInfo ioc)
|
||||
{
|
||||
var uri = IocPathToUri(ioc.Path);
|
||||
var uri = IocToUri(ioc);
|
||||
return uri.ToString(); //TODO is this good?
|
||||
}
|
||||
|
||||
@ -479,7 +500,7 @@ namespace keepass2android.Io
|
||||
{
|
||||
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);
|
||||
_stream = _client.OpenWrite(_fileStorage.IocPathToUri(_iocTemp.Path).PathAndQuery);
|
||||
_stream = _client.OpenWrite(_fileStorage.IocToUri(_iocTemp).PathAndQuery);
|
||||
return _stream;
|
||||
}
|
||||
catch (FtpCommandException ex)
|
||||
@ -568,8 +589,8 @@ namespace keepass2android.Io
|
||||
//make sure target file does not exist:
|
||||
//try
|
||||
{
|
||||
if (_client.FileExists(_fileStorage.IocPathToUri(_ioc.Path).PathAndQuery))
|
||||
_client.DeleteFile(_fileStorage.IocPathToUri(_ioc.Path).PathAndQuery);
|
||||
if (_client.FileExists(_fileStorage.IocToUri(_ioc).PathAndQuery))
|
||||
_client.DeleteFile(_fileStorage.IocToUri(_ioc).PathAndQuery);
|
||||
|
||||
}
|
||||
//catch (FtpCommandException)
|
||||
@ -577,8 +598,8 @@ namespace keepass2android.Io
|
||||
//TODO get a new clien? might be stale
|
||||
}
|
||||
|
||||
_client.Rename(_fileStorage.IocPathToUri(_iocTemp.Path).PathAndQuery,
|
||||
_fileStorage.IocPathToUri(_ioc.Path).PathAndQuery);
|
||||
_client.Rename(_fileStorage.IocToUri(_iocTemp).PathAndQuery,
|
||||
_fileStorage.IocToUri(_ioc).PathAndQuery);
|
||||
|
||||
}
|
||||
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));
|
||||
builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title));
|
||||
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_0),
|
||||
ctx.GetString(Resource.String.ChangeLog_0_9_9c),
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="82"
|
||||
android:versionName="1.01-pre1"
|
||||
android:versionCode="83"
|
||||
android:versionName="1.01-pre2"
|
||||
package="keepass2android.keepass2android"
|
||||
android:installLocation="auto">
|
||||
<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
|
||||
* Bug fix: Previous release contained two input methods (one crashing)\n
|
||||
</string>
|
||||
|
||||
<string name="ChangeLog_1_01_preview">
|
||||
Version 1.01-pre1\n
|
||||
* NOTE: this is a preview, ONLY use for testing!\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
|
||||
<string name="ChangeLog_1_01">
|
||||
Version 1.01 preview\n
|
||||
* Reimplemented WebDav file storage, now allows file browsing and supports modern encryption.\n
|
||||
* Reimpleented FTP file storage, now allows file browsing and supports encryption (FTPS).\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 name="ChangeLog_1_0_0e">
|
||||
Version 1.0.0e\n
|
||||
* fix for Fingerprint Unlock on older Samsung devices with Android 6\n
|
||||
|
@ -515,6 +515,8 @@ namespace keepass2android
|
||||
new SftpFileStorage(this),
|
||||
new NetFtpFileStorage(Application.Context, this),
|
||||
new WebDavFileStorage(this),
|
||||
//new LegacyWebDavStorage(this),
|
||||
//new LegacyFtpStorage(this),
|
||||
#endif
|
||||
#endif
|
||||
new LocalFileStorage(this)
|
||||
|
Loading…
Reference in New Issue
Block a user