services/lemmy: fix /feeds/* and /nodeinfo/* API endpoints

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>
This commit is contained in:
Brian Leung 2022-09-09 01:18:41 -07:00 committed by Yt
parent c5cb6985cc
commit b7f19802af
2 changed files with 10 additions and 2 deletions

View file

@ -117,7 +117,7 @@ in
file_server file_server
} }
@for_backend { @for_backend {
path /api/* /pictrs/* feeds/* nodeinfo/* path /api/* /pictrs/* /feeds/* /nodeinfo/*
} }
handle @for_backend { handle @for_backend {
reverse_proxy 127.0.0.1:${toString cfg.settings.port} reverse_proxy 127.0.0.1:${toString cfg.settings.port}

View file

@ -23,6 +23,13 @@ in
hostname = "http://${lemmyNodeName}"; hostname = "http://${lemmyNodeName}";
port = backendPort; port = backendPort;
database.createLocally = true; 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; caddy.enable = true;
}; };
@ -76,7 +83,8 @@ in
# No path can return 200 until after we upload an image to pict-rs # No path can return 200 until after we upload an image to pict-rs
assert_http_code("${lemmyNodeName}/pictrs/", 404) 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-made-up-path/", 404, "-X POST")
assert_http_code("${lemmyNodeName}/some-other-path", 404, "-H 'Accept: application/activity+json'") assert_http_code("${lemmyNodeName}/some-other-path", 404, "-H 'Accept: application/activity+json'")