The exception handling for database connections results in an
`ex` variable which Ameba sees as overshadowing the `ex` used by the
`ex` block arg used to define the HTTP status code 500 handler below.
Although this is a non-issue since the db connection exception handling
will cause Invidious to exit, Ameba's nature as a static checker means
that it isn't aware of this.
The simplest fix without a dirty ameba ignore comment is to rename `ex`
within the Kemal handler block below, since `ex` within a begin rescue
block is a Crystal convention that will also cause Ameba to raise when
not adhered to.
`update_ticker_count` used to use STORAGE_KEY_STREAM to get the number of notifications which is a boolean value, now it uses STORAGE_KEY_NOTIF_COUNT which is an integer
Crystal 1.16.0 fixed the parsing of some weird-looking paths meaning
that `//api/v1/storyboards/sb/i/...` will no longer get parsed into a
request target of `/v1/storyboards/sb/i/...` within requests.
But the fix is a bit more convoluted than just changing a path. The new
presence of double slash means that `StaticFileHandler` will process and
redirect the request to a normalized path with only a single slash.
This redirect however does not preserve url query parameters which are
needed to request storyboards from YouTube.
Then there's the fact that the status code error handlers are disabled
for the API routes, meaning that there is no handler to actually process
the request with.
This PR patches Kemal's `StaticFileHandler` to preserve query parameters
when redirecting, and adds the `/api/v1/storyboard/sb/*` ->
`/sb/i/*/` redirect directly into Kemal's `ExceptionHandler` for now.
In the future a dedicated handler should be created to properly handle
http status code conditions on the API routes.
textcaptcha.com seems to be down since April and it does not appear that
service will be restored.
Text captchas can be easily automated using free LLMs, so keeping the
text captcha is more like a gate to create accounts in mass on public
Invidious instances.
It also gives headaches like bots automating account creation to modify
the videos that appear popular page of each instance (since the popular
page is based on the subscriptions of the registered users).