Implement media rule management and enhance proxy handling

- Added methods to `IMediaStore` for loading, saving, and removing media rules, allowing users to manage rules for media items effectively.
- Updated `MediaFetcher` to utilize the new rule management system, integrating rule checks into the fetching process to handle geo-blocks and previously ruled items.
- Enhanced `ProxyPool` to support exclusion of proxies from specific countries during acquisition, improving the handling of geo-blocked content.
- Adjusted `FetchOptions` to include rules instead of tombstones, streamlining the decision-making process during media fetching.
- Updated UI components to support rule editing, providing users with a more interactive experience when managing media rules.

These changes improve the overall media collection process by allowing users to define rules for handling media items and enhancing the proxy management system for better content accessibility.
This commit is contained in:
Leonid Pershin
2026-08-15 15:10:55 +03:00
parent f72f08a7bc
commit 0fa8fb89f6
26 changed files with 947 additions and 46 deletions
@@ -201,6 +201,34 @@ public sealed class JsonSettingsServiceTests : IDisposable
options.ProbeUrl.ShouldBe(new ProxyOptions().ProbeUrl);
}
[Fact]
public void The_probe_opens_a_tunnel_the_way_the_collector_does()
{
// A plain-HTTP probe is a forwarded GET; an https one is a CONNECT. Free proxies routinely
// do the first and refuse the second, and every address this app collects is https — so an
// http probe marked them live and they then failed every real request.
new ProxyOptions().ProbeUrl.Scheme.ShouldBe("https");
new AppSettings().ToProxyOptions().ProbeUrl.Scheme.ShouldBe("https");
}
[Fact]
public void A_settings_file_still_holding_the_old_http_probe_is_upgraded()
{
// Nobody would think to edit this by hand, and leaving it would keep confirming proxies that
// cannot do the one thing the collector needs.
var options = new AppSettings(ProxyProbeUrl: "http://www.gstatic.com/generate_204").ToProxyOptions();
options.ProbeUrl.ShouldBe(new ProxyOptions().ProbeUrl);
}
[Fact]
public void A_probe_url_the_user_chose_is_left_alone()
{
var options = new AppSettings(ProxyProbeUrl: "http://example.test/ping").ToProxyOptions();
options.ProbeUrl.AbsoluteUri.ShouldBe("http://example.test/ping");
}
[Fact]
public void A_corrupt_file_falls_back_to_the_defaults_instead_of_failing_to_start()
{