mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Proxy sources can now be toggled on/off.
This commit is contained in:
@@ -104,6 +104,7 @@
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
@@ -117,17 +118,18 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Column="0" Content="Url:" />
|
||||
<TextBox Grid.Column="1" Text="{Binding Url}" Margin="5 0"/>
|
||||
<ComboBox Tag="{Binding Id}" Grid.Column="2" x:Name="remoteProxyTypeCombobox" Margin="5 0" SelectionChanged="remoteProxyTypeCombobox_SelectionChanged" Loaded="remoteProxyTypeCombobox_Loaded"/>
|
||||
<CheckBox Grid.Column="0" IsChecked="{Binding Active}" VerticalAlignment="Center" />
|
||||
<Label Grid.Column="1" Content="Url:" />
|
||||
<TextBox Grid.Column="2" Text="{Binding Url}" Margin="5 0"/>
|
||||
<ComboBox Tag="{Binding Id}" Grid.Column="3" x:Name="remoteProxyTypeCombobox" Margin="5 0" SelectionChanged="remoteProxyTypeCombobox_SelectionChanged" Loaded="remoteProxyTypeCombobox_Loaded"/>
|
||||
|
||||
<Label Grid.Column="3" Content="Pattern:"/>
|
||||
<TextBox Grid.Column="4" Text="{Binding Pattern}" Margin="5 0" ToolTip="Must use capture groups (...)"/>
|
||||
<Label Grid.Column="4" Content="Pattern:"/>
|
||||
<TextBox Grid.Column="5" Text="{Binding Pattern}" Margin="5 0" ToolTip="Must use capture groups (...)"/>
|
||||
|
||||
<Label Grid.Column="5" Content="Output:"/>
|
||||
<TextBox Grid.Column="6" Text="{Binding Output}" Margin="5 0" ToolTip="[0] for full match, [1] for first group etc."/>
|
||||
<Label Grid.Column="6" Content="Output:"/>
|
||||
<TextBox Grid.Column="7" Text="{Binding Output}" Margin="5 0" ToolTip="[0] for full match, [1] for first group etc."/>
|
||||
|
||||
<Button Grid.Column="8" x:Name="removeRemoteProxySourceButton" Tag="{Binding Id}" Content="Remove" Click="removeRemoteProxySourceButton_Click" />
|
||||
<Button Grid.Column="9" x:Name="removeRemoteProxySourceButton" Tag="{Binding Id}" Content="Remove" Click="removeRemoteProxySourceButton_Click" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
|
||||
@@ -126,7 +126,10 @@ namespace OpenBullet
|
||||
private async void TestRemoteProxySourcesButton_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
List<string> prompt = new List<string>() { "Results:" };
|
||||
var tasks = vm.RemoteProxySources.Select(s => RunnerViewModel.GetProxiesFromRemoteSourceAsync(s.Url, s.Type, s.Pattern, s.Output)).ToList();
|
||||
var tasks = vm.RemoteProxySources
|
||||
.Where(s => s.Active)
|
||||
.Select(s => RunnerViewModel.GetProxiesFromRemoteSourceAsync(s.Url, s.Type, s.Pattern, s.Output))
|
||||
.ToList();
|
||||
|
||||
foreach(var result in await Task.WhenAll(tasks))
|
||||
{
|
||||
|
||||
@@ -25,6 +25,9 @@ namespace RuriLib.Models
|
||||
/// <summary>The unique ID of the RemoteProxySource.</summary>
|
||||
public int Id { get; set; } = 0;
|
||||
|
||||
/// <summary>Whether the RemoteProxySource is active or not.</summary>
|
||||
public bool Active { get; set; } = true;
|
||||
|
||||
/// <summary>The Url of the remote source.</summary>
|
||||
public string Url { get; set; } = "";
|
||||
|
||||
|
||||
@@ -1015,7 +1015,7 @@ namespace RuriLib.Runner
|
||||
|
||||
case ProxyReloadSource.Remote:
|
||||
List<CProxy> proxies = new List<CProxy>();
|
||||
Parallel.ForEach(Settings.Proxies.RemoteProxySources, s =>
|
||||
Parallel.ForEach(Settings.Proxies.RemoteProxySources.Where(s => s.Active), s =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user