summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2025-01-10 08:00:18 +0100
committerGravatar default2025-01-10 08:00:18 +0100
commited729878a6d411038b6dabfc81980c3a193efb97 (patch)
tree69eba476563ac35722aa340d453f80df6e36ef77
parentActor caching lowered to 3 hours. (diff)
downloadpenes-snac2-ed729878a6d411038b6dabfc81980c3a193efb97.tar.gz
penes-snac2-ed729878a6d411038b6dabfc81980c3a193efb97.tar.xz
penes-snac2-ed729878a6d411038b6dabfc81980c3a193efb97.zip
New user settings latitude and longitude.
-rw-r--r--data.c3
-rw-r--r--html.c19
2 files changed, 21 insertions, 1 deletions
diff --git a/data.c b/data.c
index 3463727..ca63084 100644
--- a/data.c
+++ b/data.c
@@ -319,7 +319,8 @@ int user_persist(snac *snac, int publish)
319 319
320 if (old != NULL) { 320 if (old != NULL) {
321 int nw = 0; 321 int nw = 0;
322 const char *fields[] = { "header", "avatar", "name", "bio", "metadata", NULL }; 322 const char *fields[] = { "header", "avatar", "name", "bio",
323 "metadata", "latitude", "longitude", NULL };
323 324
324 for (int n = 0; fields[n]; n++) { 325 for (int n = 0; fields[n]; n++) {
325 const char *of = xs_dict_get(old, fields[n]); 326 const char *of = xs_dict_get(old, fields[n]);
diff --git a/html.c b/html.c
index 7e3d281..559d139 100644
--- a/html.c
+++ b/html.c
@@ -1101,6 +1101,8 @@ xs_html *html_top_controls(snac *snac)
1101 const xs_val *coll_thrds = xs_dict_get(snac->config, "collapse_threads"); 1101 const xs_val *coll_thrds = xs_dict_get(snac->config, "collapse_threads");
1102 const xs_val *pending = xs_dict_get(snac->config, "approve_followers"); 1102 const xs_val *pending = xs_dict_get(snac->config, "approve_followers");
1103 const xs_val *show_foll = xs_dict_get(snac->config, "show_contact_metrics"); 1103 const xs_val *show_foll = xs_dict_get(snac->config, "show_contact_metrics");
1104 const char *latitude = xs_dict_get_def(snac->config, "latitude", "");
1105 const char *longitude = xs_dict_get_def(snac->config, "longitude", "");
1104 1106
1105 xs *metadata = NULL; 1107 xs *metadata = NULL;
1106 const xs_dict *md = xs_dict_get(snac->config, "metadata"); 1108 const xs_dict *md = xs_dict_get(snac->config, "metadata");
@@ -1291,6 +1293,20 @@ xs_html *html_top_controls(snac *snac)
1291 xs_html_attr("for", "show_contact_metrics"), 1293 xs_html_attr("for", "show_contact_metrics"),
1292 xs_html_text(L("Publish follower and following metrics")))), 1294 xs_html_text(L("Publish follower and following metrics")))),
1293 xs_html_tag("p", 1295 xs_html_tag("p",
1296 xs_html_text(L("Home location:")),
1297 xs_html_sctag("br", NULL),
1298 xs_html_sctag("input",
1299 xs_html_attr("type", "text"),
1300 xs_html_attr("name", "latitude"),
1301 xs_html_attr("value", latitude),
1302 xs_html_attr("placeholder", "latitude")),
1303 xs_html_text(" "),
1304 xs_html_sctag("input",
1305 xs_html_attr("type", "text"),
1306 xs_html_attr("name", "longitude"),
1307 xs_html_attr("value", longitude),
1308 xs_html_attr("placeholder", "longitude"))),
1309 xs_html_tag("p",
1294 xs_html_text(L("Profile metadata (key=value pairs in each line):")), 1310 xs_html_text(L("Profile metadata (key=value pairs in each line):")),
1295 xs_html_sctag("br", NULL), 1311 xs_html_sctag("br", NULL),
1296 xs_html_tag("textarea", 1312 xs_html_tag("textarea",
@@ -4053,6 +4069,9 @@ int html_post_handler(const xs_dict *req, const char *q_path,
4053 else 4069 else
4054 snac.config = xs_dict_set(snac.config, "show_contact_metrics", xs_stock(XSTYPE_FALSE)); 4070 snac.config = xs_dict_set(snac.config, "show_contact_metrics", xs_stock(XSTYPE_FALSE));
4055 4071
4072 snac.config = xs_dict_set(snac.config, "latitude", xs_dict_get_def(p_vars, "latitude", ""));
4073 snac.config = xs_dict_set(snac.config, "longitude", xs_dict_get_def(p_vars, "longitude", ""));
4074
4056 if ((v = xs_dict_get(p_vars, "metadata")) != NULL) 4075 if ((v = xs_dict_get(p_vars, "metadata")) != NULL)
4057 snac.config = xs_dict_set(snac.config, "metadata", v); 4076 snac.config = xs_dict_set(snac.config, "metadata", v);
4058 4077