Covers the parts that are dangerous to get wrong and cheap to test,
which is why the validators and the origin matcher are pure functions:
- override precedence: no row keeps the environment value, a row wins,
a stored empty list is an override rather than absence;
- decoding: a row that is not JSON, not a list, or holds a malformed
playlist ID or a CIDR proxy is reported and ignored instead of raised,
so it can never stop the instance from booting;
- validators: CIDR ranges, a host name where an IP belongs, header auth
enabled with no trusted proxy, and origins carrying a path, query,
fragment or credentials;
- origin matching: the near misses, "…ariksen.dk.evil.com",
"…ariksen.dk@evil.com", the origin hidden in a path or query, another
scheme, another port, a subdomain;
- the gating of both waivers: header auth off, empty list, no assertion,
an assertion for somebody else.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Remove sort by rating and date in video search filters
Closes https://github.com/iv-org/invidious/issues/5626
* Remove check of protobug generation of rating and date sort filters in Invidious spec
Summing the sizes of each cached file every time is very inefficient.
Instead we can simply store the cache size in an constant and increase
it everytime a file is added into the cache.
Running `crystal spec` without a file argument essentially produces one
big program that combines every single spec file, their imports, and
the files that those imports themselves depend on. Most of the types
within this combined program will get ignored by the compiler due to a
lack of any calls to them from the spec files.
But for some types, partially the HTTP module ones, using them within
the spec files will suddenly make the compiler enable a bunch of
previously ignored code. And those code will suddenly require the
presence of additional types, constants, etc. This not only make it
annoying for getting the specs working but also makes it difficult to
isolate behaviors for testing.
The `static_assets_handler_spec.cr` causes this issue and so will be
marked as an isolated spec for now. In the future all of the tests
should be organized into independent groupings similar to how the
Crystal compiler splits their tests into std, compiler, primitives and
interpreter.
* Fix 0 view count on related videos
* Remove view_count variable since it's unused by Innertube
* Remove view_count from specs and API
---------
Co-authored-by: Fijxu <fijxu@nadeko.net>