Add matrix-hookshot 4.4.0 patch

This commit is contained in:
Charlotte Van Petegem 2023-06-29 10:21:07 +02:00
parent 4e75d3c45b
commit 93b8c79bd6
No known key found for this signature in database
GPG key ID: 019E764B7184435A
3 changed files with 80 additions and 33 deletions

View file

@ -7,14 +7,6 @@
};
config = lib.mkIf config.chvp.services.matrix.enable {
nixpkgs.overlays = [
(self: super: {
matrix-hookshot = super.matrix-hookshot.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [ ./hookshot-atom-links.patch ];
});
})
];
chvp.base.zfs.systemLinks = [{ path = "/var/lib/matrix-hookshot"; type = "data"; }];
chvp.services.nginx.hosts = [{
fqdn = "matrix.vanpetegem.me";

View file

@ -1,25 +0,0 @@
diff --git a/changelog.d/784.bugfix b/changelog.d/784.bugfix
new file mode 100644
index 0000000..63f29a9
--- /dev/null
+++ b/changelog.d/784.bugfix
@@ -0,0 +1 @@
+Feeds now tries to find an HTML-type link before falling back to the first link when parsing atom feeds
diff --git a/src/feeds/parser.rs b/src/feeds/parser.rs
index c7f59ec..473ef88 100644
--- a/src/feeds/parser.rs
+++ b/src/feeds/parser.rs
@@ -81,7 +81,12 @@ fn parse_feed_to_js_result(feed: &Feed) -> JsRssChannel {
.iter()
.map(|item| FeedItem {
title: Some(item.title().value.clone()),
- link: item.links().first().map(|f| f.href.clone()),
+ link: item
+ .links()
+ .iter()
+ .find(|l| l.mime_type.as_ref().map_or(false, |t| t == "text/html"))
+ .or_else(|| item.links().first())
+ .map(|f| f.href.clone()),
id: Some(item.id.clone()),
// No equivalent
id_is_permalink: false,