readrops / Readrops

Android multi-services RSS client
GNU General Public License v3.0
308 stars 21 forks source link

[Bug] Error parsing yarr fever API feeds response #228

Closed fenuks closed 3 hours ago

fenuks commented 1 day ago

Describe the bug yarr is a server with fever API support. Its fever implementation seems to be correct, and it works with NewsFlash and Read You.

Trying to fetch/refresh feeds yields JsonDataException with message Expected BEGIN_ARRAY but was NUMBER at path $.last_refreshed_on_time. As I understand, assumption that the first three fields of the feeds response are api_version, auth, last_refreshed made here is incorrect. In general, assuming any order doesn't seem like a good idea. In case of yarr, field order is different:

{
    "api_version": 3,
    "auth": 1,
    "feeds": [],
    "feeds_groups": [],
    "last_refreshed_on_time": 1731858050
}

To Reproduce Steps to reproduce the behaviour:

  1. Add yarr account (default URL is http://my_ip:7070/fever/), by default auth is not enabled, so any login/password combination will work
  2. Tap refresh feeds button
  3. See error

Environment information (please complete the following information):

Shinokuni commented 4 hours ago

Indeed, you're right, I fixed this behavior in FeverItemsAdapter, but not in FeverFeedsAdapter, thanks for reporting! A fix will be available in the next version.

Shinokuni commented 3 hours ago

Fixed in d2dff633e1a2d68b6882b83762db9beff550d336.

fenuks commented 58 minutes ago

Thank you for the quick fix!

Are you certain that this will work for any order of fields? I don't know how exactly Reader works, but it seems to me that now parser expects that feeds field goes first, then feed_groups – so order still matters, just differently. When I moved feed_groups before feeds in api/src/test/resources/services/fever/feeds.json, parsing test failed.