mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 22:13:23 -07:00
Changed the dropbox code to use the Greenshot OAuth redirect, added a test for some of the ini values, this fails as there seems to be an issue.
This commit is contained in:
parent
80ebc2f3a9
commit
ebcf4f4fdb
6 changed files with 90 additions and 3 deletions
|
@ -94,17 +94,19 @@ namespace Greenshot.Addon.Dropbox
|
|||
{"response_type", "code"},
|
||||
{"client_id", "{ClientId}"},
|
||||
{"redirect_uri", "{RedirectUrl}"},
|
||||
// TODO: Add version?
|
||||
{"state", "{State}"}
|
||||
}),
|
||||
TokenUrl = DropboxApiUri.AppendSegments("1", "oauth2", "token"),
|
||||
CloudServiceName = "Dropbox",
|
||||
ClientId = dropboxPluginConfiguration.ClientId,
|
||||
ClientSecret = dropboxPluginConfiguration.ClientSecret,
|
||||
AuthorizeMode = AuthorizeModes.LocalhostServer,
|
||||
RedirectUrl = "http://localhost:47336",
|
||||
AuthorizeMode = AuthorizeModes.OutOfBoundAuto,
|
||||
RedirectUrl = "https://getgreenshot.org/oauth/dropbox",
|
||||
Token = dropboxPluginConfiguration
|
||||
};
|
||||
var httpBehaviour = OAuth2HttpBehaviourFactory.Create(_oAuth2Settings);
|
||||
|
||||
var httpBehaviour = OAuth2HttpBehaviourFactory.Create(_oAuth2Settings);
|
||||
|
||||
_oAuthHttpBehaviour = httpBehaviour;
|
||||
// Use the default network settings
|
||||
|
|
|
@ -52,6 +52,12 @@
|
|||
<Reference Include="Dapplo.CaliburnMicro.Translations, Version=1.0.72.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.CaliburnMicro.Translations.1.0.72\lib\net461\Dapplo.CaliburnMicro.Translations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.HttpExtensions, Version=0.8.43.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.0.8.43\lib\net46\Dapplo.HttpExtensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.HttpExtensions.OAuth, Version=0.8.43.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.OAuth.0.8.43\lib\net46\Dapplo.HttpExtensions.OAuth.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -70,6 +76,9 @@
|
|||
<Reference Include="Dapplo.Windows, Version=0.5.109.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.0.5.109\lib\net461\Dapplo.Windows.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Windows.Com, Version=0.5.80.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.Com.0.5.80\lib\net46\Dapplo.Windows.Com.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Windows.Common, Version=0.5.109.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.Common.0.5.109\lib\net461\Dapplo.Windows.Common.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -79,6 +88,9 @@
|
|||
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.109.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.109\lib\net461\Dapplo.Windows.Dpi.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Windows.EmbeddedBrowser, Version=0.5.80.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.EmbeddedBrowser.0.5.80\lib\net46\Dapplo.Windows.EmbeddedBrowser.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.109.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.109\lib\net461\Dapplo.Windows.Gdi32.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -157,6 +169,7 @@
|
|||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Reactive, Version=4.1.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Reactive.4.1.0\lib\net46\System.Reactive.dll</HintPath>
|
||||
|
@ -208,6 +221,7 @@
|
|||
<Reference Include="System.Security.Principal.Windows, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Principal.Windows.4.5.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Text.Encoding.CodePages, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encoding.CodePages.4.5.0\lib\net461\System.Text.Encoding.CodePages.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
|
@ -12,15 +12,19 @@
|
|||
<package id="Dapplo.Addons.Bootstrapper" version="1.0.72" targetFramework="net461" />
|
||||
<package id="Dapplo.CaliburnMicro" version="1.0.72" targetFramework="net461" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.72" targetFramework="net461" />
|
||||
<package id="Dapplo.HttpExtensions" version="0.8.43" targetFramework="net461" />
|
||||
<package id="Dapplo.HttpExtensions.OAuth" version="0.8.43" targetFramework="net461" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net461" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net461" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net461" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net461" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Com" version="0.5.80" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Common" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Dpi" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.EmbeddedBrowser" version="0.5.80" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Gdi32" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Input" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Kernel32" version="0.5.109" targetFramework="net461" />
|
||||
|
|
|
@ -87,6 +87,9 @@
|
|||
<Reference Include="Dapplo.HttpExtensions, Version=0.8.43.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.0.8.43\lib\net46\Dapplo.HttpExtensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.HttpExtensions.OAuth, Version=0.8.43.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.HttpExtensions.OAuth.0.8.43\lib\net46\Dapplo.HttpExtensions.OAuth.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Ini, Version=0.5.28.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Ini.0.5.28\lib\net45\Dapplo.Ini.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -105,6 +108,9 @@
|
|||
<Reference Include="Dapplo.Windows, Version=0.5.109.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.0.5.109\lib\net461\Dapplo.Windows.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Windows.Com, Version=0.5.109.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.Com.0.5.109\lib\net461\Dapplo.Windows.Com.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Windows.Common, Version=0.5.109.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.Common.0.5.109\lib\net461\Dapplo.Windows.Common.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -114,6 +120,9 @@
|
|||
<Reference Include="Dapplo.Windows.Dpi, Version=0.5.109.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.Dpi.0.5.109\lib\net461\Dapplo.Windows.Dpi.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Windows.EmbeddedBrowser, Version=0.5.109.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.EmbeddedBrowser.0.5.109\lib\net461\Dapplo.Windows.EmbeddedBrowser.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Dapplo.Windows.Gdi32, Version=0.5.109.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapplo.Windows.Gdi32.0.5.109\lib\net461\Dapplo.Windows.Gdi32.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -310,6 +319,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CommandlineTests.cs" />
|
||||
<Compile Include="IniTests.cs" />
|
||||
<Compile Include="QuantizeTests.cs" />
|
||||
<Compile Include="Extensions\ByteArrayExtensions.cs" />
|
||||
<Compile Include="BlurTests.cs" />
|
||||
|
@ -321,6 +331,10 @@
|
|||
<Compile Include="UpdateTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Greenshot.Addon.Dropbox\Greenshot.Addon.Dropbox.csproj">
|
||||
<Project>{ad7cffe2-40e7-46cf-a172-d48cf7ae9a12}</Project>
|
||||
<Name>Greenshot.Addon.Dropbox</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Greenshot.Addons\Greenshot.Addons.csproj">
|
||||
<Project>{5b924697-4dcd-4f98-85f1-105cb84b7341}</Project>
|
||||
<Name>Greenshot.Addons</Name>
|
||||
|
|
50
src/Greenshot.Tests/IniTests.cs
Normal file
50
src/Greenshot.Tests/IniTests.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
#region Greenshot GNU General Public License
|
||||
|
||||
// Greenshot - a free and open source screenshot tool
|
||||
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
|
||||
//
|
||||
// For more information see: http://getgreenshot.org/
|
||||
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program 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 General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Dapplo.Ini;
|
||||
using Dapplo.Ini.Converters;
|
||||
using Greenshot.Addon.Dropbox;
|
||||
using Xunit;
|
||||
|
||||
namespace Greenshot.Tests
|
||||
{
|
||||
public class IniTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task ConstIniTest()
|
||||
{
|
||||
// TODO: Set via build
|
||||
StringEncryptionTypeConverter.RgbIv = "dlgjowejgogkklwj";
|
||||
StringEncryptionTypeConverter.RgbKey = "lsjvkwhvwujkagfauguwcsjgu2wueuff";
|
||||
|
||||
using (var iniConfig = new IniConfig("greenshot", "greenshot"))
|
||||
{
|
||||
await iniConfig.LoadIfNeededAsync();
|
||||
var dropboxConfiguration = iniConfig.Get<IDropboxConfiguration>();
|
||||
// TODO: Fix this!!
|
||||
Assert.NotEqual("@credentials_dropbox_consumer_key@", dropboxConfiguration.ClientId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,15 +15,18 @@
|
|||
<package id="Dapplo.CaliburnMicro" version="1.0.72" targetFramework="net461" />
|
||||
<package id="Dapplo.CaliburnMicro.Translations" version="1.0.72" targetFramework="net461" />
|
||||
<package id="Dapplo.HttpExtensions" version="0.8.43" targetFramework="net461" />
|
||||
<package id="Dapplo.HttpExtensions.OAuth" version="0.8.43" targetFramework="net461" />
|
||||
<package id="Dapplo.Ini" version="0.5.28" targetFramework="net461" />
|
||||
<package id="Dapplo.InterfaceImpl" version="0.2.12" targetFramework="net461" />
|
||||
<package id="Dapplo.Language" version="0.5.28" targetFramework="net461" />
|
||||
<package id="Dapplo.Log" version="1.2.1" targetFramework="net461" />
|
||||
<package id="Dapplo.Utils" version="1.0.158" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Com" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Common" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.DesktopWindowsManager" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Dpi" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.EmbeddedBrowser" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Gdi32" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Input" version="0.5.109" targetFramework="net461" />
|
||||
<package id="Dapplo.Windows.Kernel32" version="0.5.109" targetFramework="net461" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue