Add Error on 302 for CF Bypass

This commit is contained in:
meinname
2019-10-13 19:15:59 +02:00
parent 5dfcfdb1d7
commit fedcb5f73b
2 changed files with 12 additions and 1 deletions
@@ -23,6 +23,7 @@
<TextBox Text="{Binding UserAgent, UpdateSourceTrigger=PropertyChanged}" />
</DockPanel>
<CheckBox IsChecked="{Binding PrintResponseInfo}" Content="Print Response Info" VerticalContentAlignment="Center" />
<CheckBox IsChecked="{Binding ErrorOn302}" Content="Set Error Status on 302" VerticalContentAlignment="Center" />
<TextBlock
FontSize="12"
+11 -1
View File
@@ -29,6 +29,10 @@ namespace RuriLib
/// <summary>Whether to print the full response info to the log.</summary>
public bool PrintResponseInfo { get { return printResponseInfo; } set { printResponseInfo = value; OnPropertyChanged(); } }
private bool errorOn302 = true;
/// <summary>Whether to set ERROR Status on 302.</summary>
public bool ErrorOn302 { get { return errorOn302; } set { errorOn302 = value; OnPropertyChanged(); } }
/// <summary>
/// Creates a Cloudflare bypass block.
/// </summary>
@@ -76,7 +80,8 @@ namespace RuriLib
.Token("BYPASSCF")
.Literal(Url)
.Literal(UserAgent, "UserAgent")
.Boolean(PrintResponseInfo, "PrintResponseInfo");
.Boolean(PrintResponseInfo, "PrintResponseInfo")
.Boolean(ErrorOn302, "ErrorOn302");
return writer.ToString();
}
@@ -215,6 +220,11 @@ namespace RuriLib
data.Log(new LogEntry("Response Source:", Colors.Green));
data.Log(new LogEntry(data.ResponseSource, Colors.GreenYellow));
}
if (ErrorOn302 && data.ResponseCode.Contains("302"))
{
data.Status = BotStatus.ERROR;
};
}
}
}