commit 4ff0393
grunfink
·
2026-04-11 07:30:33 +0000 UTC
parent d8eaa95
Also show a location link from people entries, if they have one.
1 files changed,
+24,
-0
M
html.c
M
html.c
+24,
-0
1@@ -3823,6 +3823,30 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c
2 }
3 }
4
5+ /* does it have a location? */
6+ const xs_dict *location = xs_dict_get(actor, "location");
7+
8+ if (xs_is_dict(location)) {
9+ const xs_val *latitude = xs_dict_get_def(location, "latitude", xs_stock(0));
10+ const xs_val *longitude = xs_dict_get_def(location, "longitude", xs_stock(0));
11+ const char *name = xs_dict_get_def(location, "name", "Home");
12+
13+ if (*latitude && *longitude) {
14+ xs *label = xs_fmt("%s,%s", xs_number_str(latitude), xs_number_str(longitude));
15+ xs *url = xs_fmt("https://openstreetmap.org/search?query=%s,%s",
16+ latitude, longitude);
17+
18+ xs_html_add(snac_post,
19+ xs_html_tag("p",
20+ xs_html_text(name),
21+ xs_html_text(": "),
22+ xs_html_tag("a",
23+ xs_html_attr("href", url),
24+ xs_html_attr("target", "_blank"),
25+ xs_html_text(label))));
26+ }
27+ }
28+
29 /* add user metadata */
30 xs_html *snac_metadata = xs_html_tag("div",
31 xs_html_attr("class", "snac-metadata"));