mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Added a script for replacing the credentials via the environment variables which can be set before the build. Changed the way the build works, only if private-credentials files are stored they will be used where before there would be an error if none were available.
The current credentials files now have replacement tokens, a build without replacement will work but the credentials will be invalid.
This commit is contained in:
parent
4a22a01d31
commit
848c77890a
13 changed files with 77 additions and 176 deletions
|
@ -23,10 +23,10 @@ using System;
|
|||
namespace GreenshotBoxPlugin {
|
||||
/// <summary>
|
||||
/// This class is merely a placeholder for the file keeping the API key and secret for Box integration.
|
||||
/// Copy this file to BoxCredentials.private.cs and fill in valid credentials. (Or empty strings, but of course you won't be able to use the plugin then.)
|
||||
/// You can set your own values here
|
||||
/// </summary>
|
||||
public static class BoxCredentials {
|
||||
public static string ClientId = string.Empty;
|
||||
public static string ClientSecret = string.Empty;
|
||||
public static string ClientId = "1234";
|
||||
public static string ClientSecret = "@credentials_box_client_secret@";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<PostBuildEvent>if exist "$(ProjectDir)BoxCredentials.orig.cs" (
|
||||
rename "$(ProjectDir)BoxCredentials.cs" "BoxCredentials.private.cs"
|
||||
rename "$(ProjectDir)BoxCredentials.orig.cs" "BoxCredentials.cs"
|
||||
) else exit /b -1
|
||||
)
|
||||
|
||||
mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
|
@ -80,34 +80,6 @@ copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Language
|
|||
if exist "$(ProjectDir)BoxCredentials.private.cs" (
|
||||
rename "$(ProjectDir)BoxCredentials.cs" "BoxCredentials.orig.cs"
|
||||
rename "$(ProjectDir)BoxCredentials.private.cs" "BoxCredentials.cs"
|
||||
) else exit /b -1</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<Optimize>False</Optimize>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
<DebugType>Full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>True</Optimize>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
)</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -22,10 +22,10 @@
|
|||
namespace GreenshotDropboxPlugin {
|
||||
/// <summary>
|
||||
/// This class is merely a placeholder for the file keeping the API key and secret for dropbox integration.
|
||||
/// Copy this file to DropBoxCredentials.private.cs and fill in valid credentials. (Or empty strings, but of course you won't be able to use the DropBox plugin then.)
|
||||
/// You can set your own values here
|
||||
/// </summary>
|
||||
public static class DropBoxCredentials {
|
||||
public static string CONSUMER_KEY = empty;
|
||||
public static string CONSUMER_SECRET = empty;
|
||||
public static string CONSUMER_KEY = "@credentials_dropbox_consumer_key@";
|
||||
public static string CONSUMER_SECRET = "@credentials_dropbox_consumer_secret@";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,8 +61,7 @@
|
|||
<PostBuildEvent>if exist "$(ProjectDir)DropBoxCredentials.orig.cs" (
|
||||
rename "$(ProjectDir)DropBoxCredentials.cs" "DropBoxCredentials.private.cs"
|
||||
rename "$(ProjectDir)DropBoxCredentials.orig.cs" "DropBoxCredentials.cs"
|
||||
) else exit /b -1
|
||||
|
||||
)
|
||||
mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\"
|
||||
|
@ -73,34 +72,6 @@ copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Language
|
|||
if exist "$(ProjectDir)DropBoxCredentials.private.cs" (
|
||||
rename "$(ProjectDir)DropBoxCredentials.cs" "DropBoxCredentials.orig.cs"
|
||||
rename "$(ProjectDir)DropBoxCredentials.private.cs" "DropBoxCredentials.cs"
|
||||
) else exit /b -1</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<Optimize>False</Optimize>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
<DebugType>Full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>True</Optimize>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
)</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -22,10 +22,10 @@
|
|||
namespace GreenshotFlickrPlugin {
|
||||
/// <summary>
|
||||
/// This class is merely a placeholder for the file keeping the API key and secret for dropbox integration.
|
||||
/// Copy this file to FlickrCredentials.private.cs and fill in valid credentials. (Or empty strings, but of course you won't be able to use the DropBox plugin then.)
|
||||
/// You can set your own values here
|
||||
/// </summary>
|
||||
public static class FlickrCredentials {
|
||||
public static string ConsumerKey = empty;
|
||||
public static string ConsumerSecret = empty;
|
||||
public static string ConsumerKey = "@credentials_flickr_consumer_key@";
|
||||
public static string ConsumerSecret = "@credentials_flickr_consumer_secret@";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
<PostBuildEvent>if exist "$(ProjectDir)FlickrCredentials.orig.cs" (
|
||||
rename "$(ProjectDir)FlickrCredentials.cs" "FlickrCredentials.private.cs"
|
||||
rename "$(ProjectDir)FlickrCredentials.orig.cs" "FlickrCredentials.cs"
|
||||
) else exit /b -1
|
||||
)
|
||||
|
||||
mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
|
@ -76,34 +76,6 @@ copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Language
|
|||
if exist "$(ProjectDir)FlickrCredentials.private.cs" (
|
||||
rename "$(ProjectDir)FlickrCredentials.cs" "FlickrCredentials.orig.cs"
|
||||
rename "$(ProjectDir)FlickrCredentials.private.cs" "FlickrCredentials.cs"
|
||||
) else exit /b -1</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<Optimize>False</Optimize>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
<DebugType>Full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>True</Optimize>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
)</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -81,11 +81,11 @@
|
|||
if exist "$(ProjectDir)ImgurCredentials.private.cs" (
|
||||
rename "$(ProjectDir)ImgurCredentials.cs" "ImgurCredentials.orig.cs"
|
||||
rename "$(ProjectDir)ImgurCredentials.private.cs" "ImgurCredentials.cs"
|
||||
) else exit /b -1</PreBuildEvent>
|
||||
)</PreBuildEvent>
|
||||
<PostBuildEvent>if exist "$(ProjectDir)ImgurCredentials.orig.cs" (
|
||||
rename "$(ProjectDir)ImgurCredentials.cs" "ImgurCredentials.private.cs"
|
||||
rename "$(ProjectDir)ImgurCredentials.orig.cs" "ImgurCredentials.cs"
|
||||
) else exit /b -1
|
||||
)
|
||||
|
||||
mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
|
@ -93,32 +93,4 @@ copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)bin\$
|
|||
mkdir "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<Optimize>False</Optimize>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
<DebugType>Full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<Optimize>True</Optimize>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -22,10 +22,10 @@
|
|||
namespace GreenshotImgurPlugin {
|
||||
/// <summary>
|
||||
/// This class is merely a placeholder for the file keeping the API key and secret for imgur integration.
|
||||
/// Copy this file to ImgurCredentials.private.cs and fill in valid credentials. (Or empty strings, but of course you won't be able to use the Imgur plugin then.)
|
||||
/// You can set your own values here
|
||||
/// </summary>
|
||||
public static class ImgurCredentials {
|
||||
public static string CONSUMER_KEY = empty;
|
||||
public static string CONSUMER_SECRET = empty;
|
||||
public static string CONSUMER_KEY = "@credentials_imgur_consumer_key@";
|
||||
public static string CONSUMER_SECRET = "@credentials_imgur_consumer_secret@";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
namespace GreenshotPhotobucketPlugin {
|
||||
/// <summary>
|
||||
/// This class is merely a placeholder for the file keeping the API key and secret for photobucket integration.
|
||||
/// Copy this file to PhotobucketCredentials.private.cs and fill in valid credentials. (Or empty strings, but of course you won't be able to use the Photobucket plugin then.)
|
||||
/// You can set your own values here
|
||||
/// </summary>
|
||||
public static class PhotobucketCredentials {
|
||||
public static string ConsumerKey = empty;
|
||||
public static string ConsumerSecret = empty;
|
||||
public static string ConsumerKey = "@credentials_photobucket_consumer_key@";
|
||||
public static string ConsumerSecret = "@credentials_photobucket_consumer_secret@";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<PostBuildEvent>if exist "$(ProjectDir)PicasaCredentials.orig.cs" (
|
||||
rename "$(ProjectDir)PicasaCredentials.cs" "PicasaCredentials.private.cs"
|
||||
rename "$(ProjectDir)PicasaCredentials.orig.cs" "PicasaCredentials.cs"
|
||||
) else exit /b -1
|
||||
)
|
||||
|
||||
mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
|
||||
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
|
||||
|
@ -83,34 +83,6 @@ copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Language
|
|||
if exist "$(ProjectDir)PicasaCredentials.private.cs" (
|
||||
rename "$(ProjectDir)PicasaCredentials.cs" "PicasaCredentials.orig.cs"
|
||||
rename "$(ProjectDir)PicasaCredentials.private.cs" "PicasaCredentials.cs"
|
||||
) else exit /b -1</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<Optimize>False</Optimize>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>Full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<Optimize>True</Optimize>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
)</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -22,10 +22,10 @@
|
|||
namespace GreenshotPicasaPlugin {
|
||||
/// <summary>
|
||||
/// This class is merely a placeholder for the file keeping the API key and secret for dropbox integration.
|
||||
/// Copy this file to PicasaCredentials.private.cs and fill in valid credentials. (Or empty strings, but of course you won't be able to use the DropBox plugin then.)
|
||||
/// You can set your own values here
|
||||
/// </summary>
|
||||
public static class PicasaCredentials {
|
||||
public static string ConsumerKey = empty;
|
||||
public static string ConsumerSecret = empty;
|
||||
public static string ConsumerKey = "@credentials_picasa_consumer_key@";
|
||||
public static string ConsumerSecret = "@credentials_picasa_consumer_secret@";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,8 +217,4 @@ echo "Generating ZIP"
|
|||
PackageZip
|
||||
|
||||
echo "Generating Portable"
|
||||
PackagePortable
|
||||
|
||||
echo "Ready, press any key to continue!"
|
||||
|
||||
WaitForKey
|
||||
PackagePortable
|
46
prebuild.ps1
Normal file
46
prebuild.ps1
Normal file
|
@ -0,0 +1,46 @@
|
|||
################################################################
|
||||
# Greenshot PRE-BUILD script, written for the Windows Power Shell
|
||||
# Assumes the installation of Microsoft .NET Framework 4.5
|
||||
################################################################
|
||||
# Greenshot - a free and open source screenshot tool
|
||||
# Copyright (C) 2007-2014 Thomas Braun, Jens Klingen, Robin Krom
|
||||
#
|
||||
# For more information see: http://getgreenshot.org/
|
||||
# The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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/>.
|
||||
################################################################
|
||||
|
||||
# Fill the credentials
|
||||
Function FillCredentials {
|
||||
Write-Host "Filling credentials with Environment variable values`n`n"
|
||||
Get-ChildItem . -recurse *Credentials.cs | foreach {
|
||||
$template = Get-Content $_.FullName
|
||||
# Create an empty array, this will contain the replaced lines
|
||||
$newtext = @()
|
||||
foreach ($line in $template) {
|
||||
get-childitem -path env:credentials_* | foreach {
|
||||
$varname=$_.Name
|
||||
$varvalue=$_.Value
|
||||
$line = $line -replace "\@$varname\@", $varvalue
|
||||
}
|
||||
$newtext += $line
|
||||
}
|
||||
# Write the new information to the file
|
||||
Write-Host "Updating $_.FullName`n"
|
||||
$newtext | Set-Content $_.FullName -encoding UTF8
|
||||
}
|
||||
}
|
||||
|
||||
FillCredentials
|
Loading…
Add table
Add a link
Reference in a new issue