mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Added UserAgent field in the CAPTCHA block.
This commit is contained in:
@@ -18,6 +18,10 @@
|
||||
<Label Content="Captcha URL:" />
|
||||
<TextBox Text="{Binding Url, UpdateSourceTrigger=PropertyChanged}" ToolTip="URL to download the captcha image from (using the assigned proxy)"/>
|
||||
</DockPanel>
|
||||
<DockPanel Margin="0 5 0 0">
|
||||
<Label Content="User Agent:" />
|
||||
<TextBox Text="{Binding UserAgent, UpdateSourceTrigger=PropertyChanged}" ToolTip="User Agent to use during the download request"/>
|
||||
</DockPanel>
|
||||
<CheckBox Content="Base 64 Captcha in Url box" IsChecked="{Binding Base64}" VerticalContentAlignment="Center" ToolTip="Whether in the box above there is a base64-encoded representation of an image"/>
|
||||
<CheckBox Content="Use Previously Saved Screenshot" IsChecked="{Binding SendScreenshot}" VerticalContentAlignment="Center" ToolTip="Whether to use a screenshot that was previously saved via selenium"/>
|
||||
</StackPanel>
|
||||
|
||||
@@ -31,6 +31,10 @@ namespace RuriLib
|
||||
/// <summary>Whether the captcha image needs to be taken by the last screenshot taken by selenium.</summary>
|
||||
public bool SendScreenshot { get { return sendScreenshot; } set { sendScreenshot = value; OnPropertyChanged(); } }
|
||||
|
||||
private string userAgent = "";
|
||||
/// <summary>The user agent to use in the image download request.</summary>
|
||||
public string UserAgent { get { return userAgent; } set { userAgent = value; OnPropertyChanged(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Creates an Image Captcha block.
|
||||
/// </summary>
|
||||
@@ -56,6 +60,11 @@ namespace RuriLib
|
||||
|
||||
Url = LineParser.ParseLiteral(ref input, "URL");
|
||||
|
||||
if (LineParser.Lookahead(ref input) == TokenType.Literal)
|
||||
{
|
||||
UserAgent = LineParser.ParseLiteral(ref input, "UserAgent");
|
||||
}
|
||||
|
||||
while (LineParser.Lookahead(ref input) == TokenType.Boolean)
|
||||
LineParser.SetBool(ref input, this);
|
||||
|
||||
@@ -75,12 +84,16 @@ namespace RuriLib
|
||||
writer
|
||||
.Label(Label)
|
||||
.Token("CAPTCHA")
|
||||
.Literal(Url)
|
||||
.Boolean(Base64, "Base64")
|
||||
.Literal(Url);
|
||||
|
||||
if (UserAgent != "") writer.Literal(UserAgent);
|
||||
|
||||
writer.Boolean(Base64, "Base64")
|
||||
.Boolean(SendScreenshot, "SendScreenshot")
|
||||
.Arrow()
|
||||
.Token("VAR")
|
||||
.Literal(VariableName);
|
||||
|
||||
return writer.ToString();
|
||||
}
|
||||
|
||||
@@ -180,6 +193,7 @@ namespace RuriLib
|
||||
{
|
||||
HttpRequest request = new HttpRequest();
|
||||
|
||||
if (UserAgent != "") request.UserAgent = ReplaceValues(UserAgent, data);
|
||||
request.Cookies = new CookieDictionary();
|
||||
foreach (var cookie in data.Cookies)
|
||||
request.Cookies.Add(cookie.Key, cookie.Value);
|
||||
|
||||
Reference in New Issue
Block a user