mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Reused new OAuth 2 code for the Box plug-in, this was possible by adding the embedded browser. Also refactored code to be more readable, and have more reuse. Fixed problems with Picasa upload and pressing cancel on the PleaseWaitForm. [skip ci]
This commit is contained in:
parent
9d7299e5ea
commit
1f80d56b10
16 changed files with 408 additions and 277 deletions
|
@ -122,8 +122,7 @@ namespace GreenshotImgurPlugin {
|
|||
if (config.AnonymousAccess) {
|
||||
// add key, we only use the other parameters for the AnonymousAccess
|
||||
otherParameters.Add("key", IMGUR_ANONYMOUS_API_KEY);
|
||||
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(config.ImgurApiUrl + "/upload.xml?" + NetworkHelper.GenerateQueryParameters(otherParameters));
|
||||
webRequest.Method = "POST";
|
||||
HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(config.ImgurApiUrl + "/upload.xml?" + NetworkHelper.GenerateQueryParameters(otherParameters), HTTPMethod.POST);
|
||||
webRequest.ContentType = "image/" + outputSettings.Format.ToString();
|
||||
webRequest.ServicePoint.Expect100Continue = false;
|
||||
|
||||
|
@ -194,8 +193,7 @@ namespace GreenshotImgurPlugin {
|
|||
return;
|
||||
}
|
||||
LOG.InfoFormat("Retrieving Imgur image for {0} with url {1}", imgurInfo.Hash, imgurInfo.SmallSquare);
|
||||
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(imgurInfo.SmallSquare);
|
||||
webRequest.Method = "GET";
|
||||
HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(imgurInfo.SmallSquare, HTTPMethod.GET);
|
||||
webRequest.ServicePoint.Expect100Continue = false;
|
||||
SetClientId(webRequest);
|
||||
using (WebResponse response = webRequest.GetResponse()) {
|
||||
|
@ -215,8 +213,7 @@ namespace GreenshotImgurPlugin {
|
|||
public static ImgurInfo RetrieveImgurInfo(string hash, string deleteHash) {
|
||||
string url = config.ImgurApiUrl + "/image/" + hash;
|
||||
LOG.InfoFormat("Retrieving Imgur info for {0} with url {1}", hash, url);
|
||||
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(url);
|
||||
webRequest.Method = "GET";
|
||||
HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(url, HTTPMethod.GET);
|
||||
webRequest.ServicePoint.Expect100Continue = false;
|
||||
SetClientId(webRequest);
|
||||
string responseString;
|
||||
|
@ -250,10 +247,7 @@ namespace GreenshotImgurPlugin {
|
|||
|
||||
try {
|
||||
string url = config.ImgurApiUrl + "/delete/" + imgurInfo.DeleteHash;
|
||||
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(url);
|
||||
|
||||
//webRequest.Method = "DELETE";
|
||||
webRequest.Method = "GET";
|
||||
HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(url, HTTPMethod.GET);
|
||||
webRequest.ServicePoint.Expect100Continue = false;
|
||||
SetClientId(webRequest);
|
||||
string responseString;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue