stumpapp / stump

A free and open source comics, manga and digital book server with OPDS support (WIP)
https://stumpapp.dev
MIT License
843 stars 33 forks source link

:bug: Fix OPDS path detection regression #350

Closed aaronleopold closed 4 weeks ago

aaronleopold commented 4 weeks ago

Relates to https://github.com/stumpapp/stump/issues/346

The recent change to split the main OPDS router into sub-routers for each supported version caused some issues in the auth middleware. Specifically, the /opds prefix was missing which caused the conditional check which allows basic auth for OPDS-specific routes to fail.

Accessing the request parts uri in an extension seems to be scoped to the current router. This means when the auth middleware attempted to extract the uri, it was now relative to the new sub-router (which in this case, would be /v1.2/*). To correct this, I just used the OriginalUri extractor.

I also used this as an opportunity to fix some of the session handling logic in the OPDS auth flow