JellyBookOrg / JellyBook

A nice way to read books and comics from Jellyfin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error parsing Jellyfin response.

jpuerto opened this issue · comments

I/flutter (23107): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (23107): │ #0   _MainMenuState.build.<anonymous closure> (package:jellybook/screens/MainScreens/mainMenu.dart:512:26)
I/flutter (23107): │ #1   _FutureBuilderState.build (package:flutter/src/widgets/async.dart:616:55)
I/flutter (23107): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (23107): │ ⛔ Error: FormatException: Unexpected character (at character 1)
I/flutter (23107): │ ⛔ <html>
I/flutter (23107): │ ⛔ ^
I/flutter (23107): │ ⛔ 
I/flutter (23107): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

I got an error status 400 (bad request). So authentication works but somehow it the request is not being able to be processed by Jellyfin server. I did not found anything in Jellyfin logs.

As concept I have created an automatic Jellifin client generation with openapi_generator plugin based on the specs from version 10.8.8 from https://api.jellyfin.org/openapi/.

I had no time to test it, but if the automatic client works, the openapi.json file can be edited with a sub set of methods that are useful for Jellybook only.

The branch with the changes is here: https://github.com/jpuerto/JellyBook/tree/openapi-client

I'll take a look into a openapi generated API. I think what might be better to do is to have all the modules there and as a package and then have it used as a dependency in this project. will have to explore further tho.

I'll take a look into a openapi generated API. I think what might be better to do is to have all the modules there and as a package and then have it used as a dependency in this project. will have to explore further tho.

I think it could be a good help, I have used a similar approach in others projects with great results. I created it because I realized that the Jellifin REST API documentation is really bad. Even the openapi specs are invalid (I had to fix it locally).

Anyway, it seems to be working fine with the patch I created. Problem seems to be when populating the "Host" header if the URL contains a subpath, like it is my case. It should work fine for all cases now.

fixed in #15