mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Added random syntax support to custom uploader request URL
This commit is contained in:
parent
1e0398cce0
commit
f295d58a6a
1 changed files with 28 additions and 21 deletions
|
@ -1,4 +1,4 @@
|
||||||
#region License Information (GPL v3)
|
#region License Information (GPL v3)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ShareX - A program that allows you to take screenshots and share any file type
|
ShareX - A program that allows you to take screenshots and share any file type
|
||||||
|
@ -91,7 +91,9 @@ public string GetRequestURL()
|
||||||
throw new Exception("'Request URL' must be not empty.");
|
throw new Exception("'Request URL' must be not empty.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return URLHelpers.FixPrefix(RequestURL);
|
string url = ParseURL(RequestURL, false);
|
||||||
|
|
||||||
|
return URLHelpers.FixPrefix(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetFileFormName()
|
public string GetFileFormName()
|
||||||
|
@ -153,7 +155,7 @@ public void ParseResponse(UploadResult result, bool isShortenedURL = false)
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(URL))
|
if (!string.IsNullOrEmpty(URL))
|
||||||
{
|
{
|
||||||
url = ParseURL(URL);
|
url = ParseURL(URL, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -169,8 +171,8 @@ public void ParseResponse(UploadResult result, bool isShortenedURL = false)
|
||||||
result.URL = url;
|
result.URL = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.ThumbnailURL = ParseURL(ThumbnailURL);
|
result.ThumbnailURL = ParseURL(ThumbnailURL, true);
|
||||||
result.DeletionURL = ParseURL(DeletionURL);
|
result.DeletionURL = ParseURL(DeletionURL, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +189,7 @@ private void ParseRegexList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ParseURL(string url)
|
private string ParseURL(string url, bool output)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url))
|
if (string.IsNullOrEmpty(url))
|
||||||
{
|
{
|
||||||
|
@ -242,23 +244,28 @@ private string ParseURL(string url)
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(parseText))
|
if (!string.IsNullOrEmpty(parseText))
|
||||||
{
|
{
|
||||||
string resultText;
|
string resultText = null;
|
||||||
|
|
||||||
switch (parseType)
|
if (output)
|
||||||
{
|
{
|
||||||
default:
|
switch (parseType)
|
||||||
case CustomUploaderResponseParseType.Regex:
|
{
|
||||||
resultText = ParseRegexSyntax(parseText);
|
default:
|
||||||
break;
|
case CustomUploaderResponseParseType.Regex:
|
||||||
case CustomUploaderResponseParseType.Json:
|
resultText = ParseRegexSyntax(parseText);
|
||||||
resultText = ParseJsonSyntax(parseText);
|
break;
|
||||||
break;
|
case CustomUploaderResponseParseType.Json:
|
||||||
case CustomUploaderResponseParseType.Xml:
|
resultText = ParseJsonSyntax(parseText);
|
||||||
resultText = ParseXmlSyntax(parseText);
|
break;
|
||||||
break;
|
case CustomUploaderResponseParseType.Xml:
|
||||||
case CustomUploaderResponseParseType.Random:
|
resultText = ParseXmlSyntax(parseText);
|
||||||
resultText = ParseRandomSyntax(parseText);
|
break;
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parseType == CustomUploaderResponseParseType.Random)
|
||||||
|
{
|
||||||
|
resultText = ParseRandomSyntax(parseText);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(resultText))
|
if (!string.IsNullOrEmpty(resultText))
|
||||||
|
|
Loading…
Reference in a new issue