Files
Leonid Pershin eb5061ee23 Refactor media source handling and update collection options
- Updated `IMediaSourceCatalog` to support user-added media sources, allowing dynamic editing and management of sources.
- Removed the `UrlListSource` class as its functionality is now integrated into the new catalog structure.
- Enhanced `CollectOptions` to default `RequireProxy` to true, ensuring stricter handling of proxy requirements.
- Improved error handling in `ParseError` to include a `Subject` field for better context on failures.
- Adjusted dependency injection to reflect changes in media source management, removing old source registrations.
- Introduced background proxy checks to ensure a more robust proxy pool management during collection processes.

These changes streamline the media collection process and improve the overall user experience by providing clearer error reporting and more flexible source management.
2026-08-15 14:20:06 +03:00

2.2 KiB
Raw Permalink Blame History

AvParser image test service

A tiny, dependency-free web service that serves a deterministic image for any id matching a configured pattern. It exists as a target for the app's pattern sources: point a source at one of its endpoints and let the collector generate ids.

Each valid id returns a unique identicon PNG (derived from SHA-256(id)), so fetching the same id twice yields the same bytes — which is what makes the collector's duplicate detection observable.

Endpoints

Endpoints are declared in appsettings.json under ImgTest:Endpoints. The defaults:

Path Id length Characters Extension
/test1/{id} 68 letters + digits .jpg
/test2/{id} 812 digits only none
/test3/{id} 8 hex (0-9a-f) .png

Anything not matching a pattern (/test1/xx, /test2/abcd1234) returns 404. GET / lists the endpoints; GET /healthz returns ok.

Example: GET /test1/2dfhyuj.jpg200 image/png.

Adding an endpoint

Add an object to ImgTest:Endpoints:

{ "Path": "test4", "MinLength": 4, "MaxLength": 6, "Alphabet": "Custom", "Chars": "abcdef012", "Extensions": [".png"] }

Alphabet is one of LettersLower, LettersUpper, Letters, Digits, Alphanumeric, HexLower, or Custom (which uses Chars).

Miss rate

Set ImgTest:MissRate (0..1) to make a deterministic fraction of otherwise-valid ids answer 404, emulating a site where most guessed ids do not exist. It is stable per id, so a run is repeatable. Override at deploy time with the ImgTest__MissRate environment variable.

Run

docker compose up --build

The container listens on http://localhost:8080. It speaks plain HTTP — TLS for a public domain such as https://imgtest.example is terminated by your own reverse proxy, which forwards to this container. A Caddy example:

imgtest.example {
    reverse_proxy localhost:8080
}

Or run it directly without Docker:

dotnet run

This service is intentionally not part of AvParser.slnx and is not built by ./build.ps1. It is a standalone support tool with its own Docker context.