mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Added BanLoopEvasionOverride to config proxy settings
This commit is contained in:
@@ -26,6 +26,10 @@
|
||||
<xctk:IntegerUpDown Background="Transparent" Width="50" Margin="10 0 0 0" Value="{Binding MaxProxyUses}" Foreground="{DynamicResource ForegroundMain}" HorizontalAlignment="Right"/>
|
||||
</DockPanel>
|
||||
<CheckBox Content="Ban Proxy after Good Status" IsChecked="{Binding BanProxyAfterGoodStatus}" VerticalContentAlignment="Center" ToolTip="Bans a Proxy after a SUCCESS, CUSTOM or TOCHECK result."/>
|
||||
<DockPanel>
|
||||
<Label Content="Ban Loop Evasion (-1 = default)" />
|
||||
<xctk:IntegerUpDown Background="Transparent" Width="50" Margin="10 0 0 0" Minimum="-1" Value="{Binding BanLoopEvasionOverride}" Foreground="{DynamicResource ForegroundMain}" HorizontalAlignment="Right"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -89,6 +89,13 @@ namespace RuriLib
|
||||
private bool banProxyAfterGoodStatus = false;
|
||||
/// <summary>Whether to ban the proxy after a SUCCESS, CUSTOM or NONE status (not FAIL or RETRY).</summary>
|
||||
public bool BanProxyAfterGoodStatus { get { return banProxyAfterGoodStatus; } set { banProxyAfterGoodStatus = value; OnPropertyChanged(); } }
|
||||
|
||||
private int banLoopEvasionOverride = -1;
|
||||
/// <summary>
|
||||
/// The maximum amount of times a data line ends up with a BAN status before it's marked as ToCheck.
|
||||
/// Overrides the global setting unless set to -1.
|
||||
/// </summary>
|
||||
public int BanLoopEvasionOverride { get { return banLoopEvasionOverride; } set { banLoopEvasionOverride = value; OnPropertyChanged(); } }
|
||||
#endregion
|
||||
|
||||
#region Data
|
||||
|
||||
@@ -931,7 +931,7 @@ namespace RuriLib.Runner
|
||||
RetryCount++;
|
||||
}
|
||||
|
||||
if (currentData.Retries < Settings.Proxies.BanLoopEvasion || Settings.Proxies.BanLoopEvasion == 0)
|
||||
if (ShouldTriggerEvasion(currentData.Retries))
|
||||
{
|
||||
currentData.Retries++;
|
||||
goto GETPROXY;
|
||||
@@ -1269,6 +1269,15 @@ namespace RuriLib.Runner
|
||||
|
||||
return proxies;
|
||||
}
|
||||
|
||||
private bool ShouldTriggerEvasion(int retries)
|
||||
{
|
||||
var evasionValue = Config.Settings.BanLoopEvasionOverride == -1
|
||||
? Settings.Proxies.BanLoopEvasion
|
||||
: Config.Settings.BanLoopEvasionOverride;
|
||||
|
||||
return retries < evasionValue || evasionValue == 0;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Bot Management Methods
|
||||
|
||||
Reference in New Issue
Block a user