From a9fd39fd454e2b98ea7b57c2ec767c5aa25175e4 Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 14 Nov 2016 20:53:16 +0100 Subject: [PATCH] BUG-1894: Fixing excessive Imgur thumbnail downloading, which was wasting "credits", and caused 429 errors. --- .../additional_files/readme.txt.template | 40 ++++--------------- GreenshotImgurPlugin/ImgurUtils.cs | 12 +++--- appveyor12.yml | 2 +- 3 files changed, 14 insertions(+), 40 deletions(-) diff --git a/Greenshot/releases/additional_files/readme.txt.template b/Greenshot/releases/additional_files/readme.txt.template index c8c6bc14d..cbc4bce74 100644 --- a/Greenshot/releases/additional_files/readme.txt.template +++ b/Greenshot/releases/additional_files/readme.txt.template @@ -12,7 +12,7 @@ All details to our tickets can be found here: https://greenshot.atlassian.net This is a release candidate for the coming release of Greenshot. **Testing is not finished, use at your own risk...** -Changes for the following reported tickets were added since 1.2.8.12: +Changes for the following reported tickets were added since 1.2.8.14: Fixed bugs: * BUG-1762 Dropshadow & tornedge prompts for settings every time @@ -22,6 +22,7 @@ Fixed bugs: * BUG-1887 Editor hangs on exit - hang time proportional to number of objects * BUG-1890 Slight cropping around window on Windows 10 * BUG-1892 Greenshot saves blank JPG file with reduce colors +* BUG-1894 Imgur remote server error 429 * BUG-1896 JIRA Plugin doesn't work with JIRA Server v7.0 * BUG-1898 Specify GPLv3 in the license text * BUG-1908 External Command, add commands at startup @@ -50,41 +51,14 @@ Added translation: * Nederlands by Stephan Paternotte -1.2.8.12-cab854b RELEASE +1.2.8.14-b7c8384 RELEASE -There were some major issues with the authenticated (non anonymous) uploads to Imgur. -After contacting Imgur they told us that their old API was deprecated or disabled, unfortunately this was not communicated. -Although we are working hard on Greenshot 1.3, where we changed most of the Imgur code already, we can't release it. -We did see a need to fix the imgur uploads, so in this release we quickly updated the Imgur API. -This should resolve a lot of tickets that were reported to us. - -Additionally our website http://getgreenshot.org is hosted by sourceforge and they seem to have a lot of stability problems. -Due to these problems a bug in the Greenshot update check manifested itself and causes Greenshot to get slow or even stop responding. -In this version we fix the bug in the update check, and we are also working on a solution for the instability with our website. - -Here is the list of chances: - -This is a pre-release for the comming bug-fix release of Greenshot. - -This version has changes, compared to 1.2.8.12, for the following reported tickets: - -* BUG-1884: OCR has trailing blank spaces| -* BUG-1890: Slight cropping around window on Windows 10| -* BUG-1892: Greenshot saves blank JPG file with reduce colors| -* BUG-1898: Specify GPLv3 in the license text| -* BUG-1918: Speechbubble issue: Artifacts appeared when shadow is on and transparency is used| -* BUG-1933: Greenshot Installer sets bad registry key permission| -* BUG-1935: Delay when pasting and ShapeShifter from FlameFusion is running| -* BUG-1941: Error when creating speech bubble| -* BUG-1945: Failure starting Greenshot at system startup| -* BUG-1949: Can't delete Imgur upload -* BUG-1965: Activation border around window is visible in the capture -* FEATURE-945: Added environment variables to the external command - -Testing is not finished, use at your own risk... +Changes for this release: +This has Imgur improvements for the newer API version, this is a backport from Greenshot 1.2.9 +With the move to a new hosting platform, we also noticed our update checks are way to often, this needed to be reduced. -1.2.8.12 Release +1.2.8.12-cab854b Release Bugs Resolved: diff --git a/GreenshotImgurPlugin/ImgurUtils.cs b/GreenshotImgurPlugin/ImgurUtils.cs index c32c0afba..aee304ec3 100644 --- a/GreenshotImgurPlugin/ImgurUtils.cs +++ b/GreenshotImgurPlugin/ImgurUtils.cs @@ -46,7 +46,7 @@ namespace GreenshotImgurPlugin { return; } // Load the ImUr history - List hashes = new List(); + IList hashes = new List(); foreach(string hash in Config.ImgurUploadHistory.Keys) { hashes.Add(hash); } @@ -62,7 +62,7 @@ namespace GreenshotImgurPlugin { ImgurInfo imgurInfo = RetrieveImgurInfo(hash, Config.ImgurUploadHistory[hash]); if (imgurInfo != null) { RetrieveImgurThumbnail(imgurInfo); - Config.runtimeImgurHistory.Add(hash, imgurInfo); + Config.runtimeImgurHistory[hash] = imgurInfo; } else { Log.DebugFormat("Deleting not found ImgUr {0} from config.", hash); Config.ImgurUploadHistory.Remove(hash); @@ -113,11 +113,11 @@ namespace GreenshotImgurPlugin { IDictionary otherParameters = new Dictionary(); // add title if (title != null && Config.AddTitle) { - otherParameters.Add("title", title); + otherParameters["title"]= title; } // add filename if (filename != null && Config.AddFilename) { - otherParameters.Add("name", filename); + otherParameters["name"] = filename; } string responseString = null; if (Config.AnonymousAccess) { @@ -171,7 +171,7 @@ namespace GreenshotImgurPlugin { try { var webRequest = OAuth2Helper.CreateOAuth2WebRequest(HTTPMethod.POST, Config.ImgurApi3Url + "/upload.xml", oauth2Settings); - otherParameters.Add("image", new SurfaceContainer(surfaceToUpload, outputSettings, filename)); + otherParameters["image"] = new SurfaceContainer(surfaceToUpload, outputSettings, filename); NetworkHelper.WriteMultipartFormData(webRequest, otherParameters); @@ -307,7 +307,7 @@ namespace GreenshotImgurPlugin { /// private static void LogHeader(IDictionary nameValues, string key) { if (nameValues.ContainsKey(key)) { - Log.InfoFormat("key={0}", nameValues[key]); + Log.InfoFormat("{0}={1}", key, nameValues[key]); } } diff --git a/appveyor12.yml b/appveyor12.yml index fe72fc804..d8e129c14 100644 --- a/appveyor12.yml +++ b/appveyor12.yml @@ -38,7 +38,7 @@ environment: secure: bjKXhFZkDqaq98XBrz5oQKQfT8CLpuv2ZAiBIwkzloaAPUs97b5yx6h/xFaE4NLS credentials_picasa_consumer_secret: secure: yNptTpmJWypbu9alOQtetxU66drr2FKxoPflNgRJdag= - build_type: RC2 + build_type: RC3 rsakey: secure: GNomwdlwZOCyd8d7xEWTnMVs1lpOeHvF+tlnvcbXGovLRtwAp2Ufu0r7paGY7BHGGkIs2WE7xUfyQ9UauVB+58JZ6fwVega8ucUgVJhl4x0QQNN2d6sULUhHfhuEHmxw+FDO/FxKFE6Lmf+ZRY+OGiw0wKIl4qD7mGRHcDQTipNEsTbau8HzqRVCdu3dx7pODC61DlsbO71xLF7UlqnmuZE+91Zz3V6AgaqE246n1499d6bXBYw1AH+8opNnKDFLnTHf7hUVcZn9mj6tKZXeTCuVUOr/SVQcgHKxlBlqzhfaEkxCR5GPtzQRqwDMxEycmFvj2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