nixos/freshrss: fix loading extensions' static content

Before this change, the THIRDPARTY_EXTENSIONS_PATH would end up with a
double-slash in the path, which was breaking FreshRSS's is_valid_path
detection.

(cherry picked from commit 637fc36529)
This commit is contained in:
Matt Christ
2025-08-03 08:29:22 -05:00
committed by Michael Daniels
parent 1c6aede85d
commit 4714abbe16
2 changed files with 19 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ let
DATA_PATH = cfg.dataDir;
}
// lib.optionalAttrs (cfg.extensions != [ ]) {
THIRDPARTY_EXTENSIONS_PATH = "${extension-env}/share/freshrss/";
THIRDPARTY_EXTENSIONS_PATH = "${extension-env}/share/freshrss";
};
in
{

View File

@@ -8,14 +8,30 @@
enable = true;
baseUrl = "http://localhost";
authType = "none";
extensions = [ pkgs.freshrss-extensions.youtube ];
extensions = [
pkgs.freshrss-extensions.youtube
pkgs.freshrss-extensions.title-wrap
];
};
};
extraPythonPackages = p: [
p.lxml
p.lxml-stubs
];
skipTypeCheck = true;
testScript = ''
machine.wait_for_unit("multi-user.target")
machine.wait_for_open_port(80)
response = machine.succeed("curl -vvv -s http://localhost:80/i/?c=extension")
response = machine.succeed("curl -s http://localhost:80/i/?c=extension")
assert '<span class="ext_name disabled">YouTube Video Feed</span>' in response, "Extension not present in extensions page."
# enable Title-Wrap extension
from lxml import etree
tree = etree.HTML(response)
csrf = tree.xpath("/html/body/header/nav/form/input/@value")[0]
response = machine.succeed(f"curl --fail-with-body -s 'http://localhost:80/i/?c=extension&a=enable&e=Title-Wrap' -d '_csrf={csrf}'")
# verify that the Title-Wrap css is accessible.
machine.succeed("curl --fail-with-body -s 'http://localhost:80/ext.php?1=&f=xExtension-TitleWrap/static/title_wrap.css'")
'';
}