Skip to content

Commit

Permalink
services/lemmy: fix /feeds/* and /nodeinfo/* API endpoints
Browse files Browse the repository at this point in the history
Co-authored-by: Shahar Dawn Or <mightyiampresence@gmail.com>
Co-authored-by: Matthias Meschede <MMesch@users.noreply.github.com>
Co-authored-by: a-kenji <aks.kenji@protonmail.com>
Co-authored-by: Ctem <c@ctem.me>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
  • Loading branch information
6 people authored and Yt committed Sep 9, 2022
1 parent c5cb698 commit b7f1980
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nixos/modules/services/web-apps/lemmy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ in
file_server
}
@for_backend {
path /api/* /pictrs/* feeds/* nodeinfo/*
path /api/* /pictrs/* /feeds/* /nodeinfo/*
}
handle @for_backend {
reverse_proxy 127.0.0.1:${toString cfg.settings.port}
Expand Down
10 changes: 9 additions & 1 deletion nixos/tests/lemmy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ in
hostname = "http://${lemmyNodeName}";
port = backendPort;
database.createLocally = true;
# Without setup, the /feeds/* and /nodeinfo/* API endpoints won't return 200
setup = {
admin_username = "mightyiam";
admin_password = "ThisIsWhatIUseEverywhereTryIt";
site_name = "Lemmy FTW";
admin_email = "mightyiam@example.com";
};
};
caddy.enable = true;
};
Expand Down Expand Up @@ -76,7 +83,8 @@ in
# No path can return 200 until after we upload an image to pict-rs
assert_http_code("${lemmyNodeName}/pictrs/", 404)
# The paths `/feeds/*` and `/nodeinfo/*` are not tested because they seem to be misconfigured
assert_http_code("${lemmyNodeName}/feeds/all.xml", 200)
assert_http_code("${lemmyNodeName}/nodeinfo/2.0.json", 200)
assert_http_code("${lemmyNodeName}/some-other-made-up-path/", 404, "-X POST")
assert_http_code("${lemmyNodeName}/some-other-path", 404, "-H 'Accept: application/activity+json'")
Expand Down

0 comments on commit b7f1980

Please sign in to comment.