diff options
author | TopperDEL <github_com@tparth.de> | 2021-07-15 18:15:03 +0300 |
---|---|---|
committer | TopperDEL <github_com@tparth.de> | 2021-07-15 18:15:03 +0300 |
commit | 0981c66465f2619ec0d912ebe9bb218068ef220a (patch) | |
tree | 3817c7e7f2643c6a587fd462bd6f747f1dcff7b1 | |
parent | 3ed7d4b1634c2c882ff86dea79177ec87089c8dc (diff) |
feat: Create a copy of old Tardigrade-Backend with reuse of new Storj-Backend
23 files changed, 485 insertions, 92 deletions
diff --git a/Duplicati.sln b/Duplicati.sln index e734b5ee1..c9c4d40fd 100644 --- a/Duplicati.sln +++ b/Duplicati.sln @@ -101,6 +101,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.CommandLine.Confi EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Encryption", "Duplicati\Library\Encryption\Duplicati.Library.Encryption.csproj", "{2CF2D90E-C25B-47AD-91E0-98451BAB8058}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.Tardigrade", "Duplicati\Library\Backend\Tardigrade\Duplicati.Library.Backend.Tardigrade.csproj", "{AE035E01-C917-4F13-F35E-78F21C1A2F17}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.Storj", "Duplicati\Library\Backend\Storj\Duplicati.Library.Backend.Storj.csproj", "{AE035E01-C917-4F13-A35E-78F21C1A2F17}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.TencentCOS", "Duplicati\Library\Backend\TencentCOS\Duplicati.Library.Backend.TencentCOS.csproj", "{545DD6D4-9476-42D6-B51C-A28E000C489E}" @@ -307,6 +309,10 @@ Global {2CF2D90E-C25B-47AD-91E0-98451BAB8058}.Debug|Any CPU.Build.0 = Debug|Any CPU {2CF2D90E-C25B-47AD-91E0-98451BAB8058}.Release|Any CPU.ActiveCfg = Release|Any CPU {2CF2D90E-C25B-47AD-91E0-98451BAB8058}.Release|Any CPU.Build.0 = Release|Any CPU + {AE035E01-C917-4F13-F35E-78F21C1A2F17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE035E01-C917-4F13-F35E-78F21C1A2F17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE035E01-C917-4F13-F35E-78F21C1A2F17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE035E01-C917-4F13-F35E-78F21C1A2F17}.Release|Any CPU.Build.0 = Release|Any CPU {AE035E01-C917-4F13-A35E-78F21C1A2F17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AE035E01-C917-4F13-A35E-78F21C1A2F17}.Debug|Any CPU.Build.0 = Debug|Any CPU {AE035E01-C917-4F13-A35E-78F21C1A2F17}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/Duplicati/CommandLine/BackendTester/Duplicati.CommandLine.BackendTester.csproj b/Duplicati/CommandLine/BackendTester/Duplicati.CommandLine.BackendTester.csproj index 3a427342c..f4fcacef4 100644 --- a/Duplicati/CommandLine/BackendTester/Duplicati.CommandLine.BackendTester.csproj +++ b/Duplicati/CommandLine/BackendTester/Duplicati.CommandLine.BackendTester.csproj @@ -90,6 +90,10 @@ <Project>{ae035e01-c917-4f13-a35e-78f21c1a2f17}</Project>
<Name>Duplicati.Library.Backend.Storj</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Library\Backend\Tardigrade\Duplicati.Library.Backend.Tardigrade.csproj">
+ <Project>{ae035e01-c917-4f13-f35e-78f21c1a2f17}</Project>
+ <Name>Duplicati.Library.Backend.Tardigrade</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Library\Backend\TencentCOS\Duplicati.Library.Backend.TencentCOS.csproj">
<Project>{545dd6d4-9476-42d6-b51c-a28e000c489e}</Project>
<Name>Duplicati.Library.Backend.TencentCOS</Name>
diff --git a/Duplicati/CommandLine/BackendTool/Duplicati.CommandLine.BackendTool.csproj b/Duplicati/CommandLine/BackendTool/Duplicati.CommandLine.BackendTool.csproj index d35fafe90..152895ae0 100644 --- a/Duplicati/CommandLine/BackendTool/Duplicati.CommandLine.BackendTool.csproj +++ b/Duplicati/CommandLine/BackendTool/Duplicati.CommandLine.BackendTool.csproj @@ -96,6 +96,10 @@ <Project>{ae035e01-c917-4f13-a35e-78f21c1a2f17}</Project>
<Name>Duplicati.Library.Backend.Storj</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Library\Backend\Tardigrade\Duplicati.Library.Backend.Tardigrade.csproj">
+ <Project>{ae035e01-c917-4f13-f35e-78f21c1a2f17}</Project>
+ <Name>Duplicati.Library.Backend.Tardigrade</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Library\Backend\TencentCOS\Duplicati.Library.Backend.TencentCOS.csproj">
<Project>{545dd6d4-9476-42d6-b51c-a28e000c489e}</Project>
<Name>Duplicati.Library.Backend.TencentCOS</Name>
diff --git a/Duplicati/CommandLine/Duplicati.CommandLine.csproj b/Duplicati/CommandLine/Duplicati.CommandLine.csproj index 5e7db2104..6623a0e87 100644 --- a/Duplicati/CommandLine/Duplicati.CommandLine.csproj +++ b/Duplicati/CommandLine/Duplicati.CommandLine.csproj @@ -111,6 +111,10 @@ <Project>{32a74526-3e5f-413a-8cb4-1efdad4c8b91}</Project>
<Name>Duplicati.Library.Backend.Sia</Name>
</ProjectReference>
+ <ProjectReference Include="..\Library\Backend\Tardigrade\Duplicati.Library.Backend.Tardigrade.csproj">
+ <Project>{ae035e01-c917-4f13-f35e-78f21c1a2f17}</Project>
+ <Name>Duplicati.Library.Backend.Tardigrade</Name>
+ </ProjectReference>
<ProjectReference Include="..\Library\Compression\Duplicati.Library.Compression.csproj">
<Project>{19ECCE09-B5EB-406C-8C57-BAC66997D469}</Project>
<Name>Duplicati.Library.Compression</Name>
diff --git a/Duplicati/CommandLine/RecoveryTool/Duplicati.CommandLine.RecoveryTool.csproj b/Duplicati/CommandLine/RecoveryTool/Duplicati.CommandLine.RecoveryTool.csproj index ea1e82626..eb2e9e55b 100644 --- a/Duplicati/CommandLine/RecoveryTool/Duplicati.CommandLine.RecoveryTool.csproj +++ b/Duplicati/CommandLine/RecoveryTool/Duplicati.CommandLine.RecoveryTool.csproj @@ -134,6 +134,10 @@ <Project>{C0270709-2A40-43B5-8CF1-69581B9FA2A1}</Project>
<Name>Duplicati.Library.Backend.TahoeLAFS</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Library\Backend\Tardigrade\Duplicati.Library.Backend.Tardigrade.csproj">
+ <Project>{ae035e01-c917-4f13-f35e-78f21c1a2f17}</Project>
+ <Name>Duplicati.Library.Backend.Tardigrade</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Library\Backend\WEBDAV\Duplicati.Library.Backend.WEBDAV.csproj">
<Project>{BAE27510-8B5D-44B2-B33E-372A98908041}</Project>
<Name>Duplicati.Library.Backend.WEBDAV</Name>
diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/Duplicati.GUI.TrayIcon.csproj b/Duplicati/GUI/Duplicati.GUI.TrayIcon/Duplicati.GUI.TrayIcon.csproj index 81a3997c1..d90c29d8c 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/Duplicati.GUI.TrayIcon.csproj +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/Duplicati.GUI.TrayIcon.csproj @@ -221,6 +221,10 @@ <Project>{ae035e01-c917-4f13-a35e-78f21c1a2f17}</Project>
<Name>Duplicati.Library.Backend.Storj</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Library\Backend\Tardigrade\Duplicati.Library.Backend.Tardigrade.csproj">
+ <Project>{ae035e01-c917-4f13-f35e-78f21c1a2f17}</Project>
+ <Name>Duplicati.Library.Backend.Tardigrade</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Library\Backend\TencentCOS\Duplicati.Library.Backend.TencentCOS.csproj">
<Project>{545dd6d4-9476-42d6-b51c-a28e000c489e}</Project>
<Name>Duplicati.Library.Backend.TencentCOS</Name>
diff --git a/Duplicati/Library/Backend/Storj/Duplicati.Library.Backend.Storj.csproj b/Duplicati/Library/Backend/Storj/Duplicati.Library.Backend.Storj.csproj index c44e61a61..a6ff45a31 100644 --- a/Duplicati/Library/Backend/Storj/Duplicati.Library.Backend.Storj.csproj +++ b/Duplicati/Library/Backend/Storj/Duplicati.Library.Backend.Storj.csproj @@ -7,8 +7,8 @@ <ProjectGuid>{AE035E01-C917-4F13-A35E-78F21C1A2F17}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>Duplicati.Library.Backend.Tardigrade</RootNamespace> - <AssemblyName>Duplicati.Library.Backend.Tardigrade</AssemblyName> + <RootNamespace>Duplicati.Library.Backend.Storj</RootNamespace> + <AssemblyName>Duplicati.Library.Backend.Storj</AssemblyName> <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <Deterministic>true</Deterministic> diff --git a/Duplicati/Library/Backend/Storj/Properties/AssemblyInfo.cs b/Duplicati/Library/Backend/Storj/Properties/AssemblyInfo.cs index 5f3cc907e..27b1092b7 100644 --- a/Duplicati/Library/Backend/Storj/Properties/AssemblyInfo.cs +++ b/Duplicati/Library/Backend/Storj/Properties/AssemblyInfo.cs @@ -34,3 +34,4 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] +[assembly:InternalsVisibleTo("Duplicati.Library.Backend.Tardigrade")] diff --git a/Duplicati/Library/Backend/Storj/StorjBackend.cs b/Duplicati/Library/Backend/Storj/StorjBackend.cs index 8cc80caca..715aeef12 100644 --- a/Duplicati/Library/Backend/Storj/StorjBackend.cs +++ b/Duplicati/Library/Backend/Storj/StorjBackend.cs @@ -12,20 +12,10 @@ using uplink.NET.Interfaces; using uplink.NET.Models; using uplink.NET.Services; -namespace Duplicati.Library.Backend.Tardigrade +namespace Duplicati.Library.Backend.Storj { - public class Tardigrade : IStreamingBackend + public class Storj : IStreamingBackend { - #region Deprecated parameters - Should be removed in one of the next duplicati versions - private const string TARDIGRADE_AUTH_METHOD = "tardigrade-auth-method"; - private const string TARDIGRADE_SATELLITE = "tardigrade-satellite"; - private const string TARDIGRADE_API_KEY = "tardigrade-api-key"; - private const string TARDIGRADE_SECRET = "tardigrade-secret"; - private const string TARDIGRADE_SHARED_ACCESS = "tardigrade-shared-access"; - private const string TARDIGRADE_BUCKET = "tardigrade-bucket"; - private const string TARDIGRADE_FOLDER = "tardigrade-folder"; - #endregion - private const string STORJ_AUTH_METHOD = "storj-auth-method"; private const string STORJ_SATELLITE = "storj-satellite"; private const string STORJ_API_KEY = "storj-api-key"; @@ -34,7 +24,7 @@ namespace Duplicati.Library.Backend.Tardigrade private const string STORJ_BUCKET = "storj-bucket"; private const string STORJ_FOLDER = "storj-folder"; - private const string PROTOCOL_KEY = "tardigrade"; //Should be "storj" - but for historic reasons this stays "tardigrade" to not affect existing configurations + private const string PROTOCOL_KEY = "storj"; private const string STORJ_PARTNER_ID = "duplicati"; private readonly string _satellite; @@ -83,45 +73,35 @@ namespace Duplicati.Library.Backend.Tardigrade // ReSharper disable once UnusedMember.Global // This constructor is needed by the BackendLoader. - public Tardigrade() + public Storj() { } // ReSharper disable once UnusedMember.Global // This constructor is needed by the BackendLoader. - public Tardigrade(string url, Dictionary<string, string> options) + public Storj(string url, Dictionary<string, string> options) { InitStorjLibrary(); - options.TryGetValue(STORJ_AUTH_METHOD, out string auth_method); - if (string.IsNullOrEmpty(auth_method)) - auth_method = options[TARDIGRADE_AUTH_METHOD]; + var auth_method = options[STORJ_AUTH_METHOD]; if (auth_method == "Access grant") { //Create an access from the access grant - options.TryGetValue(STORJ_SHARED_ACCESS, out string shared_access); - if (string.IsNullOrEmpty(shared_access)) - shared_access = options[TARDIGRADE_SHARED_ACCESS]; + var shared_access = options[STORJ_SHARED_ACCESS]; _access = new Access(shared_access, new Config() { UserAgent = STORJ_PARTNER_ID }); } else { //Create an access for a satellite, API key and encryption passphrase - options.TryGetValue(STORJ_SATELLITE, out _satellite); - if (string.IsNullOrEmpty(_satellite)) - _satellite = options[TARDIGRADE_SATELLITE]; + _satellite = options[STORJ_SATELLITE]; - if (options.ContainsKey(TARDIGRADE_API_KEY) || options.ContainsKey(STORJ_API_KEY)) + if (options.ContainsKey(STORJ_API_KEY)) { - options.TryGetValue(STORJ_API_KEY, out _api_key); - if (string.IsNullOrEmpty(_api_key)) - _api_key = options[TARDIGRADE_API_KEY]; + _api_key = options[STORJ_API_KEY]; } - if (options.ContainsKey(TARDIGRADE_SECRET) || options.ContainsKey(STORJ_SECRET)) + if (options.ContainsKey(STORJ_SECRET)) { - options.TryGetValue(STORJ_SECRET, out _secret); - if (string.IsNullOrEmpty(_secret)) - _secret = options[TARDIGRADE_SECRET]; + _secret = options[STORJ_SECRET]; } _access = new Access(_satellite, _api_key, _secret, new Config() { UserAgent = STORJ_PARTNER_ID }); @@ -131,22 +111,18 @@ namespace Duplicati.Library.Backend.Tardigrade _objectService = new ObjectService(_access); //If no bucket was provided use the default "duplicati"-bucket - if (options.ContainsKey(TARDIGRADE_BUCKET) || options.ContainsKey(STORJ_BUCKET)) + if (options.ContainsKey(STORJ_BUCKET)) { - options.TryGetValue(STORJ_BUCKET, out _bucket); - if (string.IsNullOrEmpty(_bucket)) - _bucket = options[TARDIGRADE_BUCKET]; + _bucket = options[STORJ_BUCKET]; } else { _bucket = "duplicati"; } - if (options.ContainsKey(TARDIGRADE_FOLDER) || options.ContainsKey(STORJ_FOLDER)) + if (options.ContainsKey(STORJ_FOLDER)) { - options.TryGetValue(STORJ_FOLDER, out _folder); - if (string.IsNullOrEmpty(_folder)) - _folder = options[TARDIGRADE_FOLDER]; + _folder = options[STORJ_FOLDER]; } } @@ -162,16 +138,6 @@ namespace Duplicati.Library.Backend.Tardigrade get { return new List<ICommandLineArgument>(new ICommandLineArgument[] { - //Obsolete ones - new CommandLineArgument(TARDIGRADE_AUTH_METHOD, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjAuthMethodDescriptionShort, Strings.Storj.StorjAuthMethodDescriptionLong, "API key", null, null, "This is deprecated, use storj-auth-method instead"), - new CommandLineArgument(TARDIGRADE_SATELLITE, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjSatelliteDescriptionShort, Strings.Storj.StorjSatelliteDescriptionLong, "us1.storj.io:7777", null, null, "This is deprecated, use storj-satellite instead"), - new CommandLineArgument(TARDIGRADE_API_KEY, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjAPIKeyDescriptionShort, Strings.Storj.StorjAPIKeyDescriptionLong, null, null, null, "This is deprecated, use storj-api-key instead"), - new CommandLineArgument(TARDIGRADE_SECRET, CommandLineArgument.ArgumentType.Password, Strings.Storj.StorjSecretDescriptionShort, Strings.Storj.StorjSecretDescriptionLong, null, null, null, "This is deprecated, use storj-secret instead"), - new CommandLineArgument(TARDIGRADE_SHARED_ACCESS, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjSharedAccessDescriptionShort, Strings.Storj.StorjSharedAccessDescriptionLong, null, null, null, "This is deprecated, use storj-shared-access instead"), - new CommandLineArgument(TARDIGRADE_BUCKET, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjBucketDescriptionShort, Strings.Storj.StorjBucketDescriptionLong, null, null, null, "This is deprecated, use storj-bucket instead"), - new CommandLineArgument(TARDIGRADE_FOLDER, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjFolderDescriptionShort, Strings.Storj.StorjFolderDescriptionLong, null, null, null, "This is deprecated, use storj-folder instead"), - - //Current ones new CommandLineArgument(STORJ_AUTH_METHOD, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjAuthMethodDescriptionShort, Strings.Storj.StorjAuthMethodDescriptionLong, "API key"), new CommandLineArgument(STORJ_SATELLITE, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjSatelliteDescriptionShort, Strings.Storj.StorjSatelliteDescriptionLong, "us1.storj.io:7777"), new CommandLineArgument(STORJ_API_KEY, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjAPIKeyDescriptionShort, Strings.Storj.StorjAPIKeyDescriptionLong), diff --git a/Duplicati/Library/Backend/Storj/StorjConfig.cs b/Duplicati/Library/Backend/Storj/StorjConfig.cs index 5fea0da2d..7b449645f 100644 --- a/Duplicati/Library/Backend/Storj/StorjConfig.cs +++ b/Duplicati/Library/Backend/Storj/StorjConfig.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Duplicati.Library.Backend.Tardigrade +namespace Duplicati.Library.Backend.Storj { public class StorjConfig : IWebModule { @@ -56,11 +56,11 @@ namespace Duplicati.Library.Backend.Tardigrade switch (ct) { case ConfigType.Satellites: - return Tardigrade.KNOWN_STORJ_SATELLITES; + return Storj.KNOWN_STORJ_SATELLITES; case ConfigType.AuthenticationMethods: - return Tardigrade.KNOWN_AUTHENTICATION_METHODS; + return Storj.KNOWN_AUTHENTICATION_METHODS; default: - return Tardigrade.KNOWN_STORJ_SATELLITES; + return Storj.KNOWN_STORJ_SATELLITES; } } #endregion diff --git a/Duplicati/Library/Backend/Storj/StorjFile.cs b/Duplicati/Library/Backend/Storj/StorjFile.cs index 783273f16..626e25397 100644 --- a/Duplicati/Library/Backend/Storj/StorjFile.cs +++ b/Duplicati/Library/Backend/Storj/StorjFile.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Duplicati.Library.Backend.Tardigrade +namespace Duplicati.Library.Backend.Storj { public class StorjFile : IFileEntry { diff --git a/Duplicati/Library/Backend/Tardigrade/Duplicati.Library.Backend.Tardigrade.csproj b/Duplicati/Library/Backend/Tardigrade/Duplicati.Library.Backend.Tardigrade.csproj new file mode 100644 index 000000000..a37d1d2e1 --- /dev/null +++ b/Duplicati/Library/Backend/Tardigrade/Duplicati.Library.Backend.Tardigrade.csproj @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{AE035E01-C917-4F13-F35E-78F21C1A2F17}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Duplicati.Library.Backend.Tardigrade</RootNamespace> + <AssemblyName>Duplicati.Library.Backend.Tardigrade</AssemblyName> + <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <Deterministic>true</Deterministic> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="SQLite-net, Version=1.7.335.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\..\packages\sqlite-net-pcl.1.7.335\lib\netstandard2.0\SQLite-net.dll</HintPath> + </Reference> + <Reference Include="SQLitePCLRaw.batteries_v2, Version=2.0.3.851, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL"> + <HintPath>..\..\..\..\packages\SQLitePCLRaw.bundle_green.2.0.3\lib\net461\SQLitePCLRaw.batteries_v2.dll</HintPath> + </Reference> + <Reference Include="SQLitePCLRaw.core, Version=2.0.3.851, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL"> + <HintPath>..\..\..\..\packages\SQLitePCLRaw.core.2.0.3\lib\netstandard2.0\SQLitePCLRaw.core.dll</HintPath> + </Reference> + <Reference Include="SQLitePCLRaw.nativelibrary, Version=2.0.3.851, Culture=neutral, PublicKeyToken=502ed628492ab262, processorArchitecture=MSIL"> + <HintPath>..\..\..\..\packages\SQLitePCLRaw.bundle_green.2.0.3\lib\net461\SQLitePCLRaw.nativelibrary.dll</HintPath> + </Reference> + <Reference Include="SQLitePCLRaw.provider.dynamic_cdecl, Version=2.0.3.851, Culture=neutral, PublicKeyToken=b68184102cba0b3b, processorArchitecture=MSIL"> + <HintPath>..\..\..\..\packages\SQLitePCLRaw.provider.dynamic_cdecl.2.0.3\lib\netstandard2.0\SQLitePCLRaw.provider.dynamic_cdecl.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\..\..\..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath> + </Reference> + <Reference Include="System.Core" /> + <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\..\..\..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath> + </Reference> + <Reference Include="System.Numerics" /> + <Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\..\..\..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath> + </Reference> + <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\..\..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath> + </Reference> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xml" /> + <Reference Include="uplink.NET, Version=2.6.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\..\packages\uplink.NET.2.6.1451\lib\netstandard2.0\uplink.NET.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="Strings.cs" /> + <Compile Include="TardigradeBackend.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Common\Duplicati.Library.Common.csproj"> + <Project>{d63e53e4-a458-4c2f-914d-92f715f58acf}</Project> + <Name>Duplicati.Library.Common</Name> + </ProjectReference> + <ProjectReference Include="..\..\Interface\Duplicati.Library.Interface.csproj"> + <Project>{c5899f45-b0ff-483c-9d38-24a9fcaab237}</Project> + <Name>Duplicati.Library.Interface</Name> + </ProjectReference> + <ProjectReference Include="..\..\Localization\Duplicati.Library.Localization.csproj"> + <Project>{b68f2214-951f-4f78-8488-66e1ed3f50bf}</Project> + <Name>Duplicati.Library.Localization</Name> + </ProjectReference> + <ProjectReference Include="..\..\Utility\Duplicati.Library.Utility.csproj"> + <Project>{de3e5d4c-51ab-4e5e-bee8-e636cebfba65}</Project> + <Name>Duplicati.Library.Utility</Name> + </ProjectReference> + <ProjectReference Include="..\Storj\Duplicati.Library.Backend.Storj.csproj"> + <Project>{ae035e01-c917-4f13-a35e-78f21c1a2f17}</Project> + <Name>Duplicati.Library.Backend.Storj</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="libstorj_uplink.dylib"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="libstorj_uplink.so"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <Content Include="win-x64\storj_uplink.dll"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="win-x86\storj_uplink.dll"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\..\..\..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.3\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.3\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets'))" /> + </Target> + <Import Project="..\..\..\..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.3\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets" Condition="Exists('..\..\..\..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.3\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets')" /> +</Project>
\ No newline at end of file diff --git a/Duplicati/Library/Backend/Tardigrade/Properties/AssemblyInfo.cs b/Duplicati/Library/Backend/Tardigrade/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..5f3cc907e --- /dev/null +++ b/Duplicati/Library/Backend/Tardigrade/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("Duplicati.Library.Backend.Tardigrade")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Duplicati.Library.Backend.Tardigrade")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("ae035e01-c917-4f13-a35e-78f21c1a2f17")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Duplicati/Library/Backend/Tardigrade/Strings.cs b/Duplicati/Library/Backend/Tardigrade/Strings.cs new file mode 100644 index 000000000..4d4eda2f1 --- /dev/null +++ b/Duplicati/Library/Backend/Tardigrade/Strings.cs @@ -0,0 +1,15 @@ +using Duplicati.Library.Localization.Short; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Duplicati.Library.Backend.Strings +{ + internal static class Tardigrade + { + public static string DisplayName { get { return LC.L(@"Tardigrade Decentralised Cloud Storage"); } } + public static string Description { get { return LC.L(@"This backend can read and write data to the Tardigrade Decentralized Cloud Storage. It is deprecated - please move over to the new Storj DCS."); } } + } +} diff --git a/Duplicati/Library/Backend/Tardigrade/TardigradeBackend.cs b/Duplicati/Library/Backend/Tardigrade/TardigradeBackend.cs new file mode 100644 index 000000000..2ef32099f --- /dev/null +++ b/Duplicati/Library/Backend/Tardigrade/TardigradeBackend.cs @@ -0,0 +1,80 @@ +using Duplicati.Library.Interface; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Linq.Expressions; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using uplink.NET.Interfaces; +using uplink.NET.Models; +using uplink.NET.Services; + +namespace Duplicati.Library.Backend.Tardigrade +{ + + /// <summary> + /// This backend is deprecated! It will be removed in the future. + /// Tardigrade renamed to Storj DCS in Spring 2021 - but existing Tardigrade-Configurations could not be easily renamed. + /// So we decided to "copy" Tardigrade over to the new name Storj DCS. In order to reduce duplicate code, the old + /// Tardigrade-Backend hands it's logic over to Storj DCS. Only the UI-specific part, the config-parameters and + /// the protocol-key stay here named for Tardigrade. + /// </summary> + public class Tardigrade : Duplicati.Library.Backend.Storj.Storj + { + private const string TARDIGRADE_AUTH_METHOD = "tardigrade-auth-method"; + private const string TARDIGRADE_SATELLITE = "tardigrade-satellite"; + private const string TARDIGRADE_API_KEY = "tardigrade-api-key"; + private const string TARDIGRADE_SECRET = "tardigrade-secret"; + private const string TARDIGRADE_SHARED_ACCESS = "tardigrade-shared-access"; + private const string TARDIGRADE_BUCKET = "tardigrade-bucket"; + private const string TARDIGRADE_FOLDER = "tardigrade-folder"; + + private const string PROTOCOL_KEY = "tardigrade"; + + // ReSharper disable once UnusedMember.Global + // This constructor is needed by the BackendLoader. + public Tardigrade():base() + { + } + + // ReSharper disable once UnusedMember.Global + // This constructor is needed by the BackendLoader. + public Tardigrade(string url, Dictionary<string, string> options) :base(url, options) + { + } + + public new string DisplayName + { + get { return Strings.Tardigrade.DisplayName; } + } + + public new string ProtocolKey => PROTOCOL_KEY; + + public new IList<ICommandLineArgument> SupportedCommands + { + get + { + return new List<ICommandLineArgument>(new ICommandLineArgument[] { + new CommandLineArgument(TARDIGRADE_AUTH_METHOD, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjAuthMethodDescriptionShort, Strings.Storj.StorjAuthMethodDescriptionLong, "API key", null, null), + new CommandLineArgument(TARDIGRADE_SATELLITE, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjSatelliteDescriptionShort, Strings.Storj.StorjSatelliteDescriptionLong, "us1.storj.io:7777", null, null), + new CommandLineArgument(TARDIGRADE_API_KEY, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjAPIKeyDescriptionShort, Strings.Storj.StorjAPIKeyDescriptionLong, null, null, null), + new CommandLineArgument(TARDIGRADE_SECRET, CommandLineArgument.ArgumentType.Password, Strings.Storj.StorjSecretDescriptionShort, Strings.Storj.StorjSecretDescriptionLong, null, null, null), + new CommandLineArgument(TARDIGRADE_SHARED_ACCESS, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjSharedAccessDescriptionShort, Strings.Storj.StorjSharedAccessDescriptionLong, null, null, null), + new CommandLineArgument(TARDIGRADE_BUCKET, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjBucketDescriptionShort, Strings.Storj.StorjBucketDescriptionLong, null, null, null), + new CommandLineArgument(TARDIGRADE_FOLDER, CommandLineArgument.ArgumentType.String, Strings.Storj.StorjFolderDescriptionShort, Strings.Storj.StorjFolderDescriptionLong, null, null, null), + }); + } + } + + public new string Description + { + get + { + return Strings.Tardigrade.Description; + } + } + } +} diff --git a/Duplicati/Library/Backend/Tardigrade/libstorj_uplink.dylib b/Duplicati/Library/Backend/Tardigrade/libstorj_uplink.dylib Binary files differnew file mode 100644 index 000000000..a3e4de942 --- /dev/null +++ b/Duplicati/Library/Backend/Tardigrade/libstorj_uplink.dylib diff --git a/Duplicati/Library/Backend/Tardigrade/libstorj_uplink.so b/Duplicati/Library/Backend/Tardigrade/libstorj_uplink.so Binary files differnew file mode 100644 index 000000000..0ecab8ba8 --- /dev/null +++ b/Duplicati/Library/Backend/Tardigrade/libstorj_uplink.so diff --git a/Duplicati/Library/Backend/Tardigrade/packages.config b/Duplicati/Library/Backend/Tardigrade/packages.config new file mode 100644 index 000000000..1592ab1f8 --- /dev/null +++ b/Duplicati/Library/Backend/Tardigrade/packages.config @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="sqlite-net-pcl" version="1.7.335" targetFramework="net471" /> + <package id="SQLitePCLRaw.bundle_green" version="2.0.3" targetFramework="net471" /> + <package id="SQLitePCLRaw.core" version="2.0.3" targetFramework="net471" /> + <package id="SQLitePCLRaw.lib.e_sqlite3" version="2.0.3" targetFramework="net471" /> + <package id="SQLitePCLRaw.provider.dynamic_cdecl" version="2.0.3" targetFramework="net471" /> + <package id="System.Buffers" version="4.4.0" targetFramework="net471" /> + <package id="System.Memory" version="4.5.3" targetFramework="net471" /> + <package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net471" /> + <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net471" /> + <package id="uplink.NET" version="2.6.1451" targetFramework="net471" /> +</packages>
\ No newline at end of file diff --git a/Duplicati/Library/Backend/Tardigrade/win-x64/storj_uplink.dll b/Duplicati/Library/Backend/Tardigrade/win-x64/storj_uplink.dll Binary files differnew file mode 100644 index 000000000..8b42a9c6b --- /dev/null +++ b/Duplicati/Library/Backend/Tardigrade/win-x64/storj_uplink.dll diff --git a/Duplicati/Library/Backend/Tardigrade/win-x86/storj_uplink.dll b/Duplicati/Library/Backend/Tardigrade/win-x86/storj_uplink.dll Binary files differnew file mode 100644 index 000000000..c34a75d19 --- /dev/null +++ b/Duplicati/Library/Backend/Tardigrade/win-x86/storj_uplink.dll diff --git a/Duplicati/Server/Duplicati.Server.csproj b/Duplicati/Server/Duplicati.Server.csproj index c1b36fa4a..7344275c2 100644 --- a/Duplicati/Server/Duplicati.Server.csproj +++ b/Duplicati/Server/Duplicati.Server.csproj @@ -207,6 +207,10 @@ <Project>{ae035e01-c917-4f13-a35e-78f21c1a2f17}</Project>
<Name>Duplicati.Library.Backend.Storj</Name>
</ProjectReference>
+ <ProjectReference Include="..\Library\Backend\Tardigrade\Duplicati.Library.Backend.Tardigrade.csproj">
+ <Project>{ae035e01-c917-4f13-f35e-78f21c1a2f17}</Project>
+ <Name>Duplicati.Library.Backend.Tardigrade</Name>
+ </ProjectReference>
<ProjectReference Include="..\Library\Backend\TencentCOS\Duplicati.Library.Backend.TencentCOS.csproj">
<Project>{545dd6d4-9476-42d6-b51c-a28e000c489e}</Project>
<Name>Duplicati.Library.Backend.TencentCOS</Name>
diff --git a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js index 4f7a24bed..01b0ac1dc 100644 --- a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js +++ b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js @@ -29,8 +29,9 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo, EditUriBackendConfig.templates['box'] = 'templates/backends/oauth.html'; EditUriBackendConfig.templates['dropbox'] = 'templates/backends/oauth.html'; EditUriBackendConfig.templates['sia'] = 'templates/backends/sia.html'; - EditUriBackendConfig.templates['tardigrade'] = 'templates/backends/storj.html'; - EditUriBackendConfig.templates['rclone'] = 'templates/backends/rclone.html'; + EditUriBackendConfig.templates['storj'] = 'templates/backends/storj.html'; + EditUriBackendConfig.templates['tardigrade'] = 'templates/backends/tardigrade.html'; + EditUriBackendConfig.templates['rclone'] = 'templates/backends/rclone.html'; EditUriBackendConfig.templates['cos'] = 'templates/backends/cos.html'; EditUriBackendConfig.testers['s3'] = function(scope, callback) { @@ -157,7 +158,7 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo, scope.s3_client_options = s3_client_options; }; - EditUriBackendConfig.loaders['tardigrade'] = function (scope) { + EditUriBackendConfig.loaders['storj'] = function (scope) { if (scope.storj_satellites == null) { AppService.post('/webmodule/storj-getconfig', {'storj-config': 'Satellites'}).then(function (data) { scope.storj_satellites = data.data.Result; @@ -182,6 +183,32 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo, scope.storj_auth_method = 'API key'; } }; + + EditUriBackendConfig.loaders['tardigrade'] = function (scope) { + if (scope.tardigrade_satellites == null) { + AppService.post('/webmodule/storj-getconfig', {'storj-config': 'Satellites'}).then(function (data) { + scope.tardigrade_satellites = data.data.Result; + if (scope.tardigrade_satellite == undefined && scope.tardigrade_satellite_custom == undefined) + scope.tardigrade_satellite = 'us1.storj.io:7777'; + + }, AppUtils.connectionError); + } else { + if (scope.tardigrade_satellite == undefined && scope.tardigrade_satellite_custom == undefined) + scope.tardigrade_satellite = 'us1.storj.io:7777'; + } + + if (scope.tardigrade_auth_methods == null) { + AppService.post('/webmodule/storj-getconfig', {'storj-config': 'AuthenticationMethods'}).then(function (data) { + scope.tardigrade_auth_methods = data.data.Result; + if (scope.tardigrade_auth_method == undefined) + scope.tardigrade_auth_method = 'API key'; + + }, AppUtils.connectionError); + } else { + if (scope.tardigrade_auth_method == undefined) + scope.tardigrade_auth_method = 'API key'; + } + }; EditUriBackendConfig.loaders['oauth-base'] = function (scope) { scope.oauth_create_token = Math.random().toString(36).substr(2) + Math.random().toString(36).substr(2); @@ -486,25 +513,8 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo, delete options[nukeopts[x]]; } - EditUriBackendConfig.parsers['tardigrade'] = function (scope, module, server, port, path, options) { - if (options['--tardigrade-auth-method']) - scope.storj_auth_method = options['--tardigrade-auth-method']; - if (options['--tardigrade-satellite']) - scope.storj_satellite = options['--tardigrade-satellite']; - if (options['--tardigrade-api-key']) - scope.storj_api_key = options['--tardigrade-api-key']; - if (options['--tardigrade-secret']) - scope.storj_secret = options['--tardigrade-secret']; - if (options['--tardigrade-secret-verify']) - scope.storj_secret_verify = options['--tardigrade-secret-verify']; - if (options['--tardigrade-shared-access']) - scope.storj_shared_access = options['--tardigrade-shared-access']; - if (options['--tardigrade-bucket']) - scope.storj_bucket = options['--tardigrade-bucket']; - if (options['--tardigrade-folder']) - scope.storj_folder = options['--tardigrade-folder']; - - if (options['--storj-auth-method']) + EditUriBackendConfig.parsers['storj'] = function (scope, module, server, port, path, options) { + if (options['--storj-auth-method']) scope.storj_auth_method = options['--storj-auth-method']; if (options['--storj-satellite']) scope.storj_satellite = options['--storj-satellite']; @@ -521,8 +531,30 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo, if (options['--storj-folder']) scope.storj_folder = options['--storj-folder']; - var nukeopts = ['--tardigrade-auth-method','--tardigrade-satellite', '--tardigrade-api-key', '--tardigrade-secret', '--tardigrade-secret-verify', '--tardigrade-shared-access', '--tardigrade-bucket', '--tardigrade-folder', - '--storj-auth-method','--storj-satellite', '--storj-api-key', '--storj-secret', '--storj-secret-verify', '--storj-shared-access', '--storj-bucket', '--storj-folder']; + var nukeopts = ['--storj-auth-method','--storj-satellite', '--storj-api-key', '--storj-secret', '--storj-secret-verify', '--storj-shared-access', '--storj-bucket', '--storj-folder']; + for (var x in nukeopts) + delete options[nukeopts[x]]; + }; + + EditUriBackendConfig.parsers['tardigrade'] = function (scope, module, server, port, path, options) { + if (options['--tardigrade-auth-method']) + scope.tardigrade_auth_method = options['--tardigrade-auth-method']; + if (options['--tardigrade-satellite']) + scope.tardigrade_satellite = options['--tardigrade-satellite']; + if (options['--tardigrade-api-key']) + scope.tardigrade_api_key = options['--tardigrade-api-key']; + if (options['--tardigrade-secret']) + scope.tardigrade_secret = options['--tardigrade-secret']; + if (options['--tardigrade-secret-verify']) + scope.tardigrade_secret_verify = options['--tardigrade-secret-verify']; + if (options['--tardigrade-shared-access']) + scope.tardigrade_shared_access = options['--tardigrade-shared-access']; + if (options['--tardigrade-bucket']) + scope.tardigrade_bucket = options['--tardigrade-bucket']; + if (options['--tardigrade-folder']) + scope.tardigrade_folder = options['--tardigrade-folder']; + + var nukeopts = ['--tardigrade-auth-method','--tardigrade-satellite', '--tardigrade-api-key', '--tardigrade-secret', '--tardigrade-secret-verify', '--tardigrade-shared-access', '--tardigrade-bucket', '--tardigrade-folder']; for (var x in nukeopts) delete options[nukeopts[x]]; }; @@ -763,17 +795,8 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo, return url; } - EditUriBackendConfig.builders['tardigrade'] = function (scope) { + EditUriBackendConfig.builders['storj'] = function (scope) { var opts = { - 'tardigrade-auth-method': scope.tardigrade_auth_method, - 'tardigrade-satellite': scope.tardigrade_satellite, - 'tardigrade-api-key': scope.tardigrade_api_key, - 'tardigrade-secret': scope.tardigrade_secret, - 'tardigrade-secret-verify': scope.tardigrade_secret_verify, - 'tardigrade-shared-access': scope.tardigrade_shared_access, - 'tardigrade-bucket': scope.tardigrade_bucket, - 'tardigrade-folder': scope.tardigrade_folder, - 'storj-auth-method': scope.storj_auth_method, 'storj-satellite': scope.storj_satellite, 'storj-api-key': scope.storj_api_key, @@ -786,6 +809,28 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo, EditUriBackendConfig.merge_in_advanced_options(scope, opts); + var url = AppUtils.format('{0}://storj.io/config{1}', + scope.Backend.Key, + AppUtils.encodeDictAsUrl(opts) + ); + + return url; + }; + + EditUriBackendConfig.builders['tardigrade'] = function (scope) { + var opts = { + 'tardigrade-auth-method': scope.tardigrade_auth_method, + 'tardigrade-satellite': scope.tardigrade_satellite, + 'tardigrade-api-key': scope.tardigrade_api_key, + 'tardigrade-secret': scope.tardigrade_secret, + 'tardigrade-secret-verify': scope.tardigrade_secret_verify, + 'tardigrade-shared-access': scope.tardigrade_shared_access, + 'tardigrade-bucket': scope.tardigrade_bucket, + 'tardigrade-folder': scope.tardigrade_folder + }; + + EditUriBackendConfig.merge_in_advanced_options(scope, opts); + var url = AppUtils.format('{0}://tardigrade.io/config{1}', scope.Backend.Key, AppUtils.encodeDictAsUrl(opts) @@ -1140,7 +1185,7 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo, continuation(); }; - EditUriBackendConfig.validaters['tardigrade'] = function (scope, continuation) { + EditUriBackendConfig.validaters['storj'] = function (scope, continuation) { var res = true; if(res && !scope['storj_auth_method']){ @@ -1173,6 +1218,40 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo, if (res) continuation(); }; + + EditUriBackendConfig.validaters['tardigrade'] = function (scope, continuation) { + var res = true; + + if(res && !scope['tardigrade_auth_method']){ + res = EditUriBackendConfig.require_field(scope, 'tardigrade_auth_method', gettextCatalog.getString('Authentication method')); + } + + if(res && scope['tardigrade_auth_method'] == 'Access grant'){ + res = EditUriBackendConfig.require_field(scope, 'tardigrade_shared_access', gettextCatalog.getString('tardigrade_shared_access')) && + EditUriBackendConfig.require_field(scope, 'tardigrade_bucket', gettextCatalog.getString('Bucket')); + } + + if(res && scope['tardigrade_auth_method'] == 'API key'){ + res = EditUriBackendConfig.require_field(scope, 'tardigrade_api_key', gettextCatalog.getString('API key')) && + EditUriBackendConfig.require_field(scope, 'tardigrade_secret', gettextCatalog.getString('Encryption passphrase')) && + EditUriBackendConfig.require_field(scope, 'tardigrade_bucket', gettextCatalog.getString('Bucket')); + } + + if(res && scope['tardigrade_auth_method'] == 'API key' && !scope['tardigrade_satellite']){ + res = EditUriBackendConfig.require_field(scope, 'tardigrade_satellite_custom', gettextCatalog.getString('Custom Satellite')); + } + + if(res && scope['tardigrade_auth_method'] == 'API key' && scope['tardigrade_secret'] != scope['tardigrade_secret_verify']) + res = EditUriBackendConfig.show_error_dialog(gettextCatalog.getString('The encryption passphrases do not match')); + + var re = new RegExp('^([a-z0-9]+([a-z0-9\-][a-z0-9])*)+(.[a-z0-9]+([a-z0-9\-][a-z0-9])*)*$'); + if(res && scope['tardigrade_bucket'] && (!re.test(scope['tardigrade_bucket']) || !(scope['tardigrade_bucket'].length > 2 && scope['tardigrade_bucket'].length < 64))){ + res = EditUriBackendConfig.show_error_dialog(gettextCatalog.getString('Bucket name can only be between 3 and 63 characters long and contain only lower-case characters, numbers, periods and dashes')); + } + + if (res) + continuation(); + }; EditUriBackendConfig.validaters['rclone'] = function (scope, continuation) { var res = diff --git a/Duplicati/Server/webroot/ngax/templates/backends/tardigrade.html b/Duplicati/Server/webroot/ngax/templates/backends/tardigrade.html new file mode 100644 index 000000000..0131cab56 --- /dev/null +++ b/Duplicati/Server/webroot/ngax/templates/backends/tardigrade.html @@ -0,0 +1,43 @@ +<div class="input select"> + <label for="tardigrade_auth_method" translate>Authentication method</label> + <select name="tardigrade_auth_method" id="tardigrade_auth_method" ng-model="$parent.tardigrade_auth_method" + ng-options="v as k + ' (' + v + ')' for (k, v) in tardigrade_auth_methods | orderBy: k"> + <option value="" translate >Authentication method ({{auth_method}}) + </option> + </select> +</div> +<div class="input select" ng-show="$parent.tardigrade_auth_method == 'API key'"> + <label for="tardigrade_satellite" translate>Satellite</label> + <select name="tardigrade_satellite" id="tardigrade_satellite" ng-model="$parent.tardigrade_satellite" + ng-options="v as k + ' (' + v + ')' for (k, v) in tardigrade_satellites | orderBy: k"> + <option value="" translate translate-params-satellite="tardigrade_satellite_custom || ''">Custom Satellite ({{satellite}}) + </option> + </select> + + <input ng-hide="contains_value(tardigrade_satellites, tardigrade_satellite)" type="text" id="tardigrade_satellite_custom" + ng-model="$parent.tardigrade_satellite_custom" placeholder="{{'Custom Satellite' | translate}}"/> +</div> +<div class="input text" ng-show="$parent.tardigrade_auth_method == 'API key'"> + <label for="tardigrade_api_key" translate>API key</label> + <input type="text" name="tardigrade_api_key" id="tardigrade_api_key" ng-model="$parent.tardigrade_api_key" placeholder="{{'The API key' | translate}}" /> +</div> +<div class="input password" ng-show="$parent.tardigrade_auth_method == 'API key'"> + <label for="tardigrade_secret" translate>Encryption passphrase</label> + <input autocomplete="new-password" type="password" name="tardigrade_secret" id="tardigrade_secret" ng-model="$parent.tardigrade_secret" placeholder="{{'The encryption passphrase' | translate}}" /> +</div> +<div class="input password" ng-show="$parent.tardigrade_auth_method == 'API key'"> + <label for="tardigrade_secret_verify" translate>Verify encryption passphrase</label> + <input autocomplete="new-password" type="password" name="tardigrade_secret_verify" id="tardigrade_secret_verify" ng-model="$parent.tardigrade_secret_verify" placeholder="{{'The encryption passphrase (for verification)' | translate}}" /> +</div> +<div class="input text" ng-show="$parent.tardigrade_auth_method == 'Access grant'"> + <label for="tardigrade_shared_access" translate>Access grant</label> + <input type="text" name="tardigrade_shared_access" id="tardigrade_shared_access" ng-model="$parent.tardigrade_shared_access" placeholder="{{'The access grant instead of the info above'}}" /> +</div> +<div class="input text"> + <label for="tardigrade_bucket" translate>Bucket</label> + <input type="text" name="tardigrade_bucket" id="tardigrade_bucket" ng-model="$parent.tardigrade_bucket" placeholder="{{'The bucket for storing the backup'}}" /> +</div> +<div class="input text"> + <label for="tardigrade_folder" translate>Folder path</label> + <input type="text" name="tardigrade_folder" id="tardigrade_folder" ng-model="$parent.tardigrade_folder" placeholder="{{'The folder within the bucket for storing the backup'}}" /> +</div> |