From 93b8c79bd61d4a51a71b1d66e0ad0e4e38e2eb0b Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Thu, 29 Jun 2023 10:21:07 +0200 Subject: [PATCH] Add matrix-hookshot 4.4.0 patch --- modules/services/matrix/default.nix | 8 -- .../services/matrix/hookshot-atom-links.patch | 25 ------ patches/240487.patch | 80 +++++++++++++++++++ 3 files changed, 80 insertions(+), 33 deletions(-) delete mode 100644 modules/services/matrix/hookshot-atom-links.patch create mode 100644 patches/240487.patch diff --git a/modules/services/matrix/default.nix b/modules/services/matrix/default.nix index add45cd5..7731081a 100644 --- a/modules/services/matrix/default.nix +++ b/modules/services/matrix/default.nix @@ -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"; diff --git a/modules/services/matrix/hookshot-atom-links.patch b/modules/services/matrix/hookshot-atom-links.patch deleted file mode 100644 index 61e834ae..00000000 --- a/modules/services/matrix/hookshot-atom-links.patch +++ /dev/null @@ -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, diff --git a/patches/240487.patch b/patches/240487.patch new file mode 100644 index 00000000..b8cc983e --- /dev/null +++ b/patches/240487.patch @@ -0,0 +1,80 @@ +diff --git a/pkgs/servers/matrix-synapse/matrix-hookshot/default.nix b/pkgs/servers/matrix-synapse/matrix-hookshot/default.nix +index 1a7e233c6e89d..d6d42472ba6ba 100644 +--- a/pkgs/servers/matrix-synapse/matrix-hookshot/default.nix ++++ b/pkgs/servers/matrix-synapse/matrix-hookshot/default.nix +@@ -10,7 +10,9 @@ + , rustPlatform + , rustc + , napi-rs-cli ++, pkg-config + , nodejs ++, openssl + }: + + let +@@ -44,8 +46,11 @@ mkYarnPackage rec { + "@matrix-org/matrix-sdk-crypto-nodejs" = "${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/matrix-sdk-crypto-nodejs"; + }; + ++ extraBuildInputs = [ openssl ]; ++ + nativeBuildInputs = [ + rustPlatform.cargoSetupHook ++ pkg-config + cargo + rustc + napi-rs-cli +diff --git a/pkgs/servers/matrix-synapse/matrix-hookshot/package.json b/pkgs/servers/matrix-synapse/matrix-hookshot/package.json +index 4d1acc779dff1..2ae23cb09a3ac 100644 +--- a/pkgs/servers/matrix-synapse/matrix-hookshot/package.json ++++ b/pkgs/servers/matrix-synapse/matrix-hookshot/package.json +@@ -1,6 +1,6 @@ + { + "name": "matrix-hookshot", +- "version": "4.3.0", ++ "version": "4.4.0", + "description": "A bridge between Matrix and multiple project management services, such as GitHub, GitLab and JIRA.", + "main": "lib/app.js", + "repository": "https://github.com/matrix-org/matrix-hookshot", +@@ -64,7 +64,7 @@ + "node-emoji": "^1.11.0", + "nyc": "^15.1.0", + "p-queue": "^6.6.2", +- "prom-client": "^14.0.1", ++ "prom-client": "^14.2.0", + "reflect-metadata": "^0.1.13", + "source-map-support": "^0.5.21", + "string-argv": "^0.3.1", +@@ -76,7 +76,7 @@ + }, + "devDependencies": { + "@codemirror/lang-javascript": "^6.0.2", +- "@napi-rs/cli": "^2.2.0", ++ "@napi-rs/cli": "^2.13.2", + "@preact/preset-vite": "^2.2.0", + "@tsconfig/node18": "^2.0.0", + "@types/ajv": "^1.0.0", +@@ -105,7 +105,7 @@ + "rimraf": "^3.0.2", + "sass": "^1.51.0", + "ts-node": "^10.9.1", +- "typescript": "^5.0.4", ++ "typescript": "^5.1.3", + "vite": "^4.1.5", + "vite-svg-loader": "^4.0.0" + } +diff --git a/pkgs/servers/matrix-synapse/matrix-hookshot/pin.json b/pkgs/servers/matrix-synapse/matrix-hookshot/pin.json +index 159c666459231..008bbe5ab50e1 100644 +--- a/pkgs/servers/matrix-synapse/matrix-hookshot/pin.json ++++ b/pkgs/servers/matrix-synapse/matrix-hookshot/pin.json +@@ -1,6 +1,6 @@ + { +- "version": "4.3.0", +- "srcHash": "7iBQkTY1K05M3EiEP+IXziztyL0+Wrlz/ezlWwWE1iw=", +- "yarnHash": "0p543f11wi6m0h29jmd8w3idqp9qacmxksj1njll7z51gjh52qjl", +- "cargoHash": "eDWZSbTS9V5MzLkbnhhPEObP1QFeTZLWCymapaDc1Lo=" ++ "version": "4.4.0", ++ "srcHash": "mPLDdAVIMb5d2LPGtIfm/ofRs42081S3+QTsvqkfp3s=", ++ "yarnHash": "0qd3h870mk3a2lzm0r7kyh07ykw86h9xwai9h205gnv1w0d59z6i", ++ "cargoHash": "NGcnRKasYE4dleQLq+E4cM6C04Rfu4AsenDznGyC2Nk=" + }