mitshel / sopds

Simple opds catalog
http://www.sopds.ru/
Other
210 stars 79 forks source link

Fixed OPDS basic auth for android Coolreader #85

Open ignis32 opened 2 years ago

ignis32 commented 2 years ago

The following issue from this forum thread is still actual fo me 4 years after: http://www.sopds.ru/index.php/forum/razdel-predlozhenij/421-ne-avtorizuet-v-soopds-iz-coolreader

I've bumped into this issue using latest sopds from git and Coolreader from the google play market.

Looks like issue is that Coolreader does not send "Basic" keyword before actuatal base64 credentials. I've compared data that browser sends and what Coolreader sends - and they end up in authentication = request.META differently. In browser it is like authentication = "Basic AaaAaAaaBase64EncodedCreds" With coolreader it is just authentication = "AaaAaAaaBase64EncodedCreds".

This causes 500 error with (auth_meth, auth_data) = authentication.split(' ',1) line in middlware.py not able to split the string.

Fix that I suggest enabled auth Coolreader, and it does not break regular auth for me.

Вот эта проблема 4хлетней давности с форума все еще похоже актуальна: http://www.sopds.ru/index.php/forum/razdel-predlozhenij/421-ne-avtorizuet-v-soopds-iz-coolreader

Я воспроизвел ее с обычным Coolreaderом из гугломаркета и sopds из гита, на совершенно чистой новой машине. Суть в том, что Coolreader шлет только base64 строку с логином и паролем, а слово Basic не шлет. Фикс который я предлагаю - порешал для меня это проблему.

ignis32 commented 2 years ago

Looks like CoolReader auth is fixed by Peter Voronov in https://github.com/mitshel/sopds/pull/75 already, and also it fixes telegram bot that did not work for me from the original sources Probably it is better to use his fix.

Похоже аутентификацию уже починили в https://github.com/mitshel/sopds/pull/75 и сделали это лучше, заодно починив телеграм бота. Видимо лучше использовать его пулл реквест.