comparison mod_pubsub_feeds/mod_pubsub_feeds.lua @ 5573:ed177fa5b54c

mod_pubsub_feeds: Fix mixup between feed object and parsed feed Did the HMAC thing ever work?
author Kim Alvefur <zash@zash.se>
date Sun, 25 Jun 2023 16:42:57 +0200
parents fd1c535dcb92
children 10b7118bbd8f
comparison
equal deleted inserted replaced
5572:fd1c535dcb92 5573:ed177fa5b54c
104 for i, entry in ipairs(entries) do 104 for i, entry in ipairs(entries) do
105 local id = entry:get_child_text("id"); 105 local id = entry:get_child_text("id");
106 if not id then 106 if not id then
107 local link = entry:get_child("link"); 107 local link = entry:get_child("link");
108 if link then 108 if link then
109 module:log("debug", "Feed %q item %s is missing an id, using <link> instead", feed.url, entry:top_tag()); 109 module:log("debug", "Feed %q item %s is missing an id, using <link> instead", item.url, entry:top_tag());
110 id = link and link.attr.href; 110 id = link and link.attr.href;
111 else 111 else
112 module:log("debug", "Feed %q item %s is missing an id, using a HMAC of the item instead", feed.url, entry:top_tag()); 112 module:log("debug", "Feed %q item %s is missing an id, using a HMAC of the item instead", item.url, entry:top_tag());
113 id = feed.url .. "#" .. hmac_sha1(feed.url, tostring(entry), true) .. "@" .. dt_datetime(timestamp); 113 id = item.url .. "#" .. hmac_sha1(item.url, tostring(entry), true) .. "@" .. dt_datetime(timestamp);
114 end 114 end
115 entry:text_tag("id", id); 115 entry:text_tag("id", id);
116 end 116 end
117 117
118 if items[id] then 118 if items[id] then