diff options
12 files changed, 184 insertions, 1 deletions
diff --git a/Duplicati.sln b/Duplicati.sln index 54076738b..32fea2228 100644 --- a/Duplicati.sln +++ b/Duplicati.sln @@ -67,6 +67,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.G EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.OpenStack", "Duplicati\Library\Backend\OpenStack\Duplicati.Library.Backend.OpenStack.csproj", "{D9E4E686-423C-48EC-A392-404E7C00860C}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.HubiC", "Duplicati\Library\Backend\HubiC\Duplicati.Library.Backend.HubiC.csproj", "{D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -218,6 +220,12 @@ Global {D4C37C33-5E73-4B56-B2C3-DC4A6BAA36BB}.Release|Any CPU.Build.0 = Release|Any CPU
{D4C37C33-5E73-4B56-B2C3-DC4A6BAA36BB}.Test|Any CPU.ActiveCfg = Debug|Any CPU
{D4C37C33-5E73-4B56-B2C3-DC4A6BAA36BB}.Test|Any CPU.Build.0 = Debug|Any CPU
+ {D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}.Test|Any CPU.ActiveCfg = Debug|Any CPU
+ {D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}.Test|Any CPU.Build.0 = Debug|Any CPU
{D63E53E4-A458-4C2F-914D-92F715F58ACE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D63E53E4-A458-4C2F-914D-92F715F58ACE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D63E53E4-A458-4C2F-914D-92F715F58ACE}.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 a451c4582..3e329dd3f 100644 --- a/Duplicati/CommandLine/BackendTester/Duplicati.CommandLine.BackendTester.csproj +++ b/Duplicati/CommandLine/BackendTester/Duplicati.CommandLine.BackendTester.csproj @@ -104,6 +104,10 @@ <Project>{D9E4E686-423C-48EC-A392-404E7C00860C}</Project>
<Name>Duplicati.Library.Backend.OpenStack</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Library\Backend\HubiC\Duplicati.Library.Backend.HubiC.csproj">
+ <Project>{D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}</Project>
+ <Name>Duplicati.Library.Backend.HubiC</Name>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
diff --git a/Duplicati/CommandLine/BackendTool/Duplicati.CommandLine.BackendTool.csproj b/Duplicati/CommandLine/BackendTool/Duplicati.CommandLine.BackendTool.csproj index 101c1ef7c..fe252442a 100644 --- a/Duplicati/CommandLine/BackendTool/Duplicati.CommandLine.BackendTool.csproj +++ b/Duplicati/CommandLine/BackendTool/Duplicati.CommandLine.BackendTool.csproj @@ -115,6 +115,10 @@ <Project>{D9E4E686-423C-48EC-A392-404E7C00860C}</Project>
<Name>Duplicati.Library.Backend.OpenStack</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Library\Backend\HubiC\Duplicati.Library.Backend.HubiC.csproj">
+ <Project>{D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}</Project>
+ <Name>Duplicati.Library.Backend.HubiC</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
diff --git a/Duplicati/CommandLine/Duplicati.CommandLine.csproj b/Duplicati/CommandLine/Duplicati.CommandLine.csproj index 0a3a511b4..6434b8ae3 100644 --- a/Duplicati/CommandLine/Duplicati.CommandLine.csproj +++ b/Duplicati/CommandLine/Duplicati.CommandLine.csproj @@ -157,6 +157,10 @@ <Project>{D9E4E686-423C-48EC-A392-404E7C00860C}</Project>
<Name>Duplicati.Library.Backend.OpenStack</Name>
</ProjectReference>
+ <ProjectReference Include="..\Library\Backend\HubiC\Duplicati.Library.Backend.HubiC.csproj">
+ <Project>{D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}</Project>
+ <Name>Duplicati.Library.Backend.HubiC</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Duplicati.snk" />
diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/Duplicati.GUI.TrayIcon.csproj b/Duplicati/GUI/Duplicati.GUI.TrayIcon/Duplicati.GUI.TrayIcon.csproj index 53f91155d..ca386af17 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/Duplicati.GUI.TrayIcon.csproj +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/Duplicati.GUI.TrayIcon.csproj @@ -272,6 +272,10 @@ <Project>{D9E4E686-423C-48EC-A392-404E7C00860C}</Project>
<Name>Duplicati.Library.Backend.OpenStack</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Library\Backend\HubiC\Duplicati.Library.Backend.HubiC.csproj">
+ <Project>{D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}</Project>
+ <Name>Duplicati.Library.Backend.HubiC</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
diff --git a/Duplicati/Library/Backend/HubiC/Duplicati.Library.Backend.HubiC.csproj b/Duplicati/Library/Backend/HubiC/Duplicati.Library.Backend.HubiC.csproj new file mode 100644 index 000000000..9de54bb16 --- /dev/null +++ b/Duplicati/Library/Backend/HubiC/Duplicati.Library.Backend.HubiC.csproj @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}</ProjectGuid> + <OutputType>Library</OutputType> + <RootNamespace>Duplicati.Library.Backend.HubiC</RootNamespace> + <AssemblyName>Duplicati.Library.Backend.HubiC</AssemblyName> + <SignAssembly>true</SignAssembly> + <AssemblyOriginatorKeyFile>Duplicati.snk</AssemblyOriginatorKeyFile> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>full</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="HubiCBackend.cs" /> + <Compile Include="Strings.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <ItemGroup> + <ProjectReference Include="..\..\Interface\Duplicati.Library.Interface.csproj"> + <Project>{C5899F45-B0FF-483C-9D38-24A9FCAAB237}</Project> + <Name>Duplicati.Library.Interface</Name> + </ProjectReference> + <ProjectReference Include="..\OAuthHelper\Duplicati.Library.OAuthHelper.csproj"> + <Project>{D4C37C33-5E73-4B56-B2C3-DC4A6BAA36BB}</Project> + <Name>Duplicati.Library.OAuthHelper</Name> + </ProjectReference> + <ProjectReference Include="..\OpenStack\Duplicati.Library.Backend.OpenStack.csproj"> + <Project>{D9E4E686-423C-48EC-A392-404E7C00860C}</Project> + <Name>Duplicati.Library.Backend.OpenStack</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> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Duplicati/Library/Backend/HubiC/HubiCBackend.cs b/Duplicati/Library/Backend/HubiC/HubiCBackend.cs new file mode 100644 index 000000000..36fcabc27 --- /dev/null +++ b/Duplicati/Library/Backend/HubiC/HubiCBackend.cs @@ -0,0 +1,26 @@ +// Copyright (C) 2015, The Duplicati Team
+// http://www.duplicati.com, info@duplicati.com
+//
+// This library is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; either version 2.1 of the
+// License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+using System;
using Duplicati.Library.Interface;
using Duplicati.Library;
using Duplicati.Library.Backend.OpenStack;
using System.Collections.Generic;
+
+namespace Duplicati.Library.Backend.HubiC
+{
+ public class HubiCBackend : IBackend, IStreamingBackend
+ {
private const string AUTHID_OPTION = "authid";
private const string HUBIC_API_URL = "https://api.hubic.com/1.0/";
private const string HUBIC_API_CREDENTIAL_URL = HUBIC_API_URL + "account/credentials";
private OpenStackStorage m_openstack;
private class HubiCAuthResponse
{
public string token { get; set; }
public string endpoint { get; set; }
public DateTime? expires { get; set;}
}
private class OpenStackHelper : OpenStackStorage
{
private OAuthHelper m_helper;
private HubiCAuthResponse m_token;
public OpenStackHelper(string authid, string url)
: base(url, MockOptions())
{
m_helper = new OAuthHelper(authid, "hubic") { AutoAuthHeader = true };
}
private static Dictionary<string, string> MockOptions()
{
var res = new Dictionary<string, string>();
res["openstack-authuri"] = "invalid://dont-use";
res["openstack-apikey"] = "invalid";
res["auth-username"] = "invalid";
return res;
}
private HubiCAuthResponse AuthToken
{
get
{
if (m_token == null || (m_token.expires != null && (m_token.expires.Value - DateTime.UtcNow).TotalSeconds < 30))
m_token = m_helper.ReadJSONResponse<HubiCAuthResponse>(HUBIC_API_CREDENTIAL_URL);
return m_token;
}
}
protected override string AccessToken
{
get { return AuthToken.token; }
}
protected override string SimpleStorageEndPoint
{
get { return AuthToken.endpoint; }
}
}
public HubiCBackend()
+ {
}
+
public HubiCBackend(string url, Dictionary<string, string> options)
{
string authid = null;
if (options.ContainsKey(AUTHID_OPTION))
authid = options[AUTHID_OPTION];
m_openstack = new OpenStackHelper(authid, url);
}
#region IStreamingBackend implementation
public void Put(string remotename, System.IO.Stream stream)
{
m_openstack.Put(remotename, stream);
}
public void Get(string remotename, System.IO.Stream stream)
{
m_openstack.Get(remotename, stream);
}
#endregion
#region IBackend implementation
public List<IFileEntry> List()
{
return m_openstack.List();
}
public void Put(string remotename, string filename)
{
m_openstack.Put(remotename, filename);
}
public void Get(string remotename, string filename)
{
m_openstack.Get(remotename, filename);
}
public void Delete(string remotename)
{
m_openstack.Delete(remotename);
}
public void Test()
{
m_openstack.Test();
}
public void CreateFolder()
{
m_openstack.CreateFolder();
}
public string DisplayName
{
get
{
return Strings.HubiC.DisplayName;
}
}
public string ProtocolKey
{
get
{
return "hubic";
}
}
public System.Collections.Generic.IList<ICommandLineArgument> SupportedCommands
{
get {
return new List<ICommandLineArgument>(new ICommandLineArgument[] {
new CommandLineArgument(AUTHID_OPTION, CommandLineArgument.ArgumentType.Password, Strings.HubiC.AuthidShort, Strings.HubiC.AuthidLong(OAuthHelper.OAUTH_LOGIN_URL("hubic"))),
});
}
}
public string Description
{
get
{
return Strings.HubiC.Description;
}
}
#endregion
#region IDisposable implementation
public void Dispose()
{
if (m_openstack != null)
{
m_openstack.Dispose();
m_openstack = null;
}
}
#endregion
}
+}
+
diff --git a/Duplicati/Library/Backend/HubiC/Properties/AssemblyInfo.cs b/Duplicati/Library/Backend/HubiC/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..5a3721064 --- /dev/null +++ b/Duplicati/Library/Backend/HubiC/Properties/AssemblyInfo.cs @@ -0,0 +1,43 @@ +// Copyright (C) 2015, The Duplicati Team
+// http://www.duplicati.com, info@duplicati.com
+//
+// This library is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; either version 2.1 of the
+// License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("Duplicati.Library.Backend.HubiC")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("kenneth")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
diff --git a/Duplicati/Library/Backend/HubiC/Strings.cs b/Duplicati/Library/Backend/HubiC/Strings.cs new file mode 100644 index 000000000..ce5cb5b1f --- /dev/null +++ b/Duplicati/Library/Backend/HubiC/Strings.cs @@ -0,0 +1,20 @@ +// Copyright (C) 2015, The Duplicati Team
+// http://www.duplicati.com, info@duplicati.com
+//
+// This library is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; either version 2.1 of the
+// License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
using Duplicati.Library.Localization.Short;
+namespace Duplicati.Library.Backend.Strings
+{
+ internal static class HubiC {
public static string Description { get { return LC.L(@"This backend can read and write data to HubiC. Supported format is ""hubic://container/folder""."); } }
public static string DisplayName { get { return LC.L(@"HubiC"); } }
public static string MissingAuthID(string url) { return LC.L(@"You need an AuthID, you can get it from: {0}"); }
public static string AuthidShort { get { return LC.L(@"The authorization code"); } }
public static string AuthidLong(string url) { return LC.L(@"The authorization token retrieved from {0}", url); }
}
}
+
diff --git a/Duplicati/Server/Duplicati.Server.csproj b/Duplicati/Server/Duplicati.Server.csproj index 9e684f75e..90d9a959f 100644 --- a/Duplicati/Server/Duplicati.Server.csproj +++ b/Duplicati/Server/Duplicati.Server.csproj @@ -221,6 +221,10 @@ <Project>{D9E4E686-423C-48EC-A392-404E7C00860C}</Project>
<Name>Duplicati.Library.Backend.OpenStack</Name>
</ProjectReference>
+ <ProjectReference Include="..\Library\Backend\HubiC\Duplicati.Library.Backend.HubiC.csproj">
+ <Project>{D60AD540-0E7D-40CE-83AE-D26E01FFE9B8}</Project>
+ <Name>Duplicati.Library.Backend.HubiC</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="webroot\" />
diff --git a/Duplicati/Server/webroot/greeno/scripts/edituri.js b/Duplicati/Server/webroot/greeno/scripts/edituri.js index 99f223ea8..ca2b1efe8 100644 --- a/Duplicati/Server/webroot/greeno/scripts/edituri.js +++ b/Duplicati/Server/webroot/greeno/scripts/edituri.js @@ -364,7 +364,7 @@ $(document).ready(function() { } } - for (var i in { 's3': 0, 'azure': 0, 'googledrive': 0, 'onedrive': 0, 'cloudfiles': 0, 'gcs': 0, 'openstack': 0 }) { + for (var i in { 's3': 0, 'azure': 0, 'googledrive': 0, 'onedrive': 0, 'cloudfiles': 0, 'gcs': 0, 'openstack': 0, 'hubic': 0 }) { if (BACKEND_STATE.module_lookup[i]) { used[i] = true; group_prop.append($("<option></option>").attr("value", i).text(BACKEND_STATE.module_lookup[i].DisplayName)); diff --git a/Duplicati/Server/webroot/greeno/scripts/plugins.js b/Duplicati/Server/webroot/greeno/scripts/plugins.js index 0d9ba9a29..30b9976b5 100644 --- a/Duplicati/Server/webroot/greeno/scripts/plugins.js +++ b/Duplicati/Server/webroot/greeno/scripts/plugins.js @@ -223,6 +223,7 @@ $(document).ready(function() { } APP_DATA.plugins.backend['googledrive'] = APP_DATA.plugins.backend['onedrive']; + APP_DATA.plugins.backend['hubic'] = APP_DATA.plugins.backend['onedrive']; APP_DATA.plugins.backend['s3'] = { |