nixpkgs/nixos/tests/freshrss/extensions.nix
Matt Christ 637fc36529 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.
2025-08-03 09:22:46 -05:00

38 lines
1.2 KiB
Nix

{
name = "freshrss-extensions";
nodes.machine =
{ pkgs, ... }:
{
services.freshrss = {
enable = true;
baseUrl = "http://localhost";
authType = "none";
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 -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'")
'';
}