Don't parse more items than Config::max_guids.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
38f795df26
commit
cf78a2e43e
|
@ -72,6 +72,7 @@ public:
|
|||
|
||||
const string profile;
|
||||
ProfileData profiledata;
|
||||
constexpr static size_t max_guids{100};
|
||||
|
||||
void write();
|
||||
[[nodiscard]] fs::path get_config_dir() const;
|
||||
|
|
|
@ -165,8 +165,16 @@ void Document::parse()
|
|||
|
||||
void Document::parse_rss(const pt::ptree &tree)
|
||||
{
|
||||
size_t counter{0};
|
||||
for (const auto &child : tree.get_child("rss.channel"))
|
||||
{
|
||||
if (counter == Config::max_guids)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug)
|
||||
<< "Maximum number of items reached. Stopped parsing.";
|
||||
break;
|
||||
}
|
||||
++counter;
|
||||
if (child.first == "item")
|
||||
{
|
||||
const auto &rssitem = child.second;
|
||||
|
|
|
@ -128,7 +128,7 @@ void MastoAPI::post_item(const Item &item)
|
|||
BOOST_LOG_TRIVIAL(debug) << "Posted status with GUID: " << item.guid;
|
||||
|
||||
_profile.guids.push_back(item.guid);
|
||||
if (_profile.guids.size() > _max_guids)
|
||||
if (_profile.guids.size() > Config::max_guids)
|
||||
{
|
||||
_profile.guids.pop_front();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ public:
|
|||
private:
|
||||
ProfileData &_profile;
|
||||
mastodonpp::Instance _instance;
|
||||
constexpr static size_t _max_guids{100};
|
||||
|
||||
string replacements_apply(const string &text);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user