diff options
author | Edwin van Leeuwen <edwinvanl@tuta.io> | 2022-09-23 19:29:04 +0000 |
---|---|---|
committer | Edwin van Leeuwen <edwinvanl@tuta.io> | 2022-09-23 19:29:04 +0000 |
commit | a8afcd9387754f989288236ca9ca674ca62a9267 (patch) | |
tree | 4b16e0ca2eda6967c4a2ae76d4548c50ba622a73 | |
parent | c6288c5d21c37f5c86928f52a0ec3b364569d983 (diff) |
bug: Fix rss feed reading
Fixes #33
-rw-r--r-- | src/rttt/rss.hpp | 10 | ||||
-rw-r--r-- | src/rttt/thing.hpp | 1 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/rttt/rss.hpp b/src/rttt/rss.hpp index 8e2fb13..e171833 100644 --- a/src/rttt/rss.hpp +++ b/src/rttt/rss.hpp @@ -252,10 +252,9 @@ struct state { }; auto &get_items(const rss::state &state, const rttt::Path &path) { - // FIXME: use a view here or can we just return sets of stories directly? - if (path.mode == rttt::list_mode::feed && !empty(path.id)) { - logger::log_ifnot(state.items.contains(path.id)); - return state.items.at(path.id); + if (path.mode == rttt::list_mode::feed && path.parts.size() > 1) { + logger::log_ifnot(state.items.contains(path.parts[1])); + return state.items.at(path.parts[1]); } return state.item_cache; } @@ -366,6 +365,9 @@ bool is_valid_path(const rttt::Path &path) { Path parse_path(std::string_view name) { auto path = rttt::parse_path(name); path.type = SiteType::RSS; + path.basename = "/rss"; + if (path.parts.size() > 1) + path.mode = list_mode::feed; return path; } diff --git a/src/rttt/thing.hpp b/src/rttt/thing.hpp index a84d189..7fa90ae 100644 --- a/src/rttt/thing.hpp +++ b/src/rttt/thing.hpp @@ -34,6 +34,7 @@ std::optional<rttt::Path> parse_path(std::string_view name) { std::optional<rttt::Path> focus_path(rttt::Path &&path, const ItemVariant &focus_item) { + // TODO: Use try_with here auto maybe_id = try_id_string(focus_item); if (!maybe_id || path.mode == list_mode::feed || path.mode == list_mode::comment) |