newsboat / newsboat

An RSS/Atom feed reader for text terminals
https://newsboat.org/
MIT License
3.01k stars 215 forks source link

Can't mark article unread with Inoreader #1109

Closed Minoru closed 4 years ago

Minoru commented 4 years ago

Newsboat version (copy the output of newsboat -v or the first line of git show): r2.20.1-218-g2e8c2 (current HEAD)

Config file (copy from ~/.newsboat/config or ~/.config/newsboat/config):

urls-source "inoreader"
inoreader-app-id "[REDACTED]"
inoreader-app-key "[REDACTED]"
inoreader-login "[REDACTED]"
inoreader-password "[REDACTED]"

Steps to reproduce the issue:

  1. start Newsboat

  2. press R to reload all feed

  3. navigate to a feed with at least one read item, enter that feed

  4. find the read item, press N to mark it unread

  5. press r to reload this feed again

The item will become read again. Inoreader's web interface doesn't show the item as unread, either.

Other info you think is relevant: Reported by José Rui Barros on the mailing list.

Minoru commented 4 years ago

Inoreader uses the same API as The Old Reader and FeedHQ, and the code is the same. This means that either Inoreader is broken, or our code is broken for all three services.

josbarros commented 4 years ago

Hello @Minoru, I'm José Rui who sent you the message reporting this bug. I've been messing with the Inoreader API directly and it seems broken to me, so I'll contact them and then let you know here their answer. Cheers!

josbarros commented 4 years ago

Hey @Minoru, I've managed to mark items as unread directly though the API now. I was just not using it properly yesterday, as I did not know that I needed to change the tag parameter key from 'a' to 'r'. Ups :P.
Therefore it may be a code problem. Could you point me where to start looking, as I'm totally unfamiliar with it? Cheers!

Minoru commented 4 years ago

Sure, here you go: https://github.com/newsboat/newsboat/blob/2e8c2aa58eacc669f50733d681bbf571be1f4ab5/src/inoreaderapi.cpp#L220-L231

josbarros commented 4 years ago

Hey @Minoru, I believe I've found out the problem: I've tried to call the API on Postman the same way Newsboat does and it never returns an OK response, even though marking read works, marking unread does not. It seems to me the issue are the request parameters a=user/-/state/com.google/kept-unread", "a=user/-/state/com.google/tracking-kept-unread" and "ac=edit" that aren't even on the Inoreader API documentation https://www.inoreader.com/developers/edit-tag, if you remove them the feature works properly:

if (read) { postcontent = strprintf::fmt( "i=%s&a=user/-/state/com.google/read", guid); } else { postcontent = strprintf::fmt( "i=%s&r=user/-/state/com.google/read", guid); }

If this fix looks good to you can I make a pull request? Cheers!

Minoru commented 4 years ago

If this fix looks good to you can I make a pull request?

Yeah, this looks great. Looking forward to your PR. Thanks for figuring it out!

Minoru commented 4 years ago

Inoreader uses the same API as The Old Reader and FeedHQ, and the code is the same. This means that either Inoreader is broken, or our code is broken for all three services.

I checked The Old Reader, and toggling works fine there. I don't have a FeedHQ account, but it appears that this bug is limited to Inoreader.