diff options
| author | default <nobody@localhost> | 2025-01-10 08:00:18 +0100 |
|---|---|---|
| committer | default <nobody@localhost> | 2025-01-10 08:00:18 +0100 |
| commit | ed729878a6d411038b6dabfc81980c3a193efb97 (patch) | |
| tree | 69eba476563ac35722aa340d453f80df6e36ef77 | |
| parent | aab32743c150a62648cd620da05d4388747c6253 (diff) | |
New user settings latitude and longitude.
| -rw-r--r-- | data.c | 3 | ||||
| -rw-r--r-- | html.c | 19 |
2 files changed, 21 insertions, 1 deletions
@@ -319,7 +319,8 @@ int user_persist(snac *snac, int publish) if (old != NULL) { int nw = 0; - const char *fields[] = { "header", "avatar", "name", "bio", "metadata", NULL }; + const char *fields[] = { "header", "avatar", "name", "bio", + "metadata", "latitude", "longitude", NULL }; for (int n = 0; fields[n]; n++) { const char *of = xs_dict_get(old, fields[n]); @@ -1101,6 +1101,8 @@ xs_html *html_top_controls(snac *snac) const xs_val *coll_thrds = xs_dict_get(snac->config, "collapse_threads"); const xs_val *pending = xs_dict_get(snac->config, "approve_followers"); const xs_val *show_foll = xs_dict_get(snac->config, "show_contact_metrics"); + const char *latitude = xs_dict_get_def(snac->config, "latitude", ""); + const char *longitude = xs_dict_get_def(snac->config, "longitude", ""); xs *metadata = NULL; const xs_dict *md = xs_dict_get(snac->config, "metadata"); @@ -1291,6 +1293,20 @@ xs_html *html_top_controls(snac *snac) xs_html_attr("for", "show_contact_metrics"), xs_html_text(L("Publish follower and following metrics")))), xs_html_tag("p", + xs_html_text(L("Home location:")), + xs_html_sctag("br", NULL), + xs_html_sctag("input", + xs_html_attr("type", "text"), + xs_html_attr("name", "latitude"), + xs_html_attr("value", latitude), + xs_html_attr("placeholder", "latitude")), + xs_html_text(" "), + xs_html_sctag("input", + xs_html_attr("type", "text"), + xs_html_attr("name", "longitude"), + xs_html_attr("value", longitude), + xs_html_attr("placeholder", "longitude"))), + xs_html_tag("p", xs_html_text(L("Profile metadata (key=value pairs in each line):")), xs_html_sctag("br", NULL), xs_html_tag("textarea", @@ -4053,6 +4069,9 @@ int html_post_handler(const xs_dict *req, const char *q_path, else snac.config = xs_dict_set(snac.config, "show_contact_metrics", xs_stock(XSTYPE_FALSE)); + snac.config = xs_dict_set(snac.config, "latitude", xs_dict_get_def(p_vars, "latitude", "")); + snac.config = xs_dict_set(snac.config, "longitude", xs_dict_get_def(p_vars, "longitude", "")); + if ((v = xs_dict_get(p_vars, "metadata")) != NULL) snac.config = xs_dict_set(snac.config, "metadata", v); |