Fix author links

pull/1/head
Starbeamrainbowlabs 2021-10-29 02:01:44 +01:00
parent 5a549e67a9
commit 412d011c98
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2
1 changed files with 16 additions and 2 deletions

View File

@ -12,6 +12,19 @@ const DESCRIPTION_LENGTH = 200;
global.feed_items = null;
global.feed_authors_error = null;
function normalise_link_list(links) {
if(links instanceof Array) {
let links_temp = links.filter(link => link.rel != "self");
if(links.length == 0) links = links[0];
else links = links_temp[0];
}
if(typeof(links) == "object") {
if(typeof(links.href) == "string")
links = links.href;
}
return links;
}
async function do_feeds() {
const pReflect = (await import("p-reflect")).default;
const dateformat = (await import("dateformat")).default;
@ -38,8 +51,9 @@ async function do_feeds() {
item.author_name = feed.author_name;
item.author_image = feed.author_image;
item.parent = feed.data;
if(typeof(item.link) == "object" && typeof(item.link.href) == "string")
item.link = item.link.href;
item.link = normalise_link_list(item.link);
item.parent.link = normalise_link_list(item.parent.link);
if(!item.content) item.content = item["content:encoded"] || "";