diff options
| author | 2024-12-05 09:13:14 +0100 | |
|---|---|---|
| committer | 2024-12-05 09:13:14 +0100 | |
| commit | b27031cc46b04224585c34eeb70eda396fbeaca2 (patch) | |
| tree | a215a9094a5540a9636d8303bf9bcde357d3e3fc | |
| parent | mastoapi: also fill metrics from credentials_get(). (diff) | |
| download | penes-snac2-b27031cc46b04224585c34eeb70eda396fbeaca2.tar.gz penes-snac2-b27031cc46b04224585c34eeb70eda396fbeaca2.tar.xz penes-snac2-b27031cc46b04224585c34eeb70eda396fbeaca2.zip | |
Added web UI for the 'show_contact_metrics' toggle.
| -rw-r--r-- | html.c | 14 |
1 files changed, 14 insertions, 0 deletions
| @@ -1062,6 +1062,7 @@ xs_html *html_top_controls(snac *snac) | |||
| 1062 | const xs_val *auto_boost = xs_dict_get(snac->config, "auto_boost"); | 1062 | const xs_val *auto_boost = xs_dict_get(snac->config, "auto_boost"); |
| 1063 | const xs_val *coll_thrds = xs_dict_get(snac->config, "collapse_threads"); | 1063 | const xs_val *coll_thrds = xs_dict_get(snac->config, "collapse_threads"); |
| 1064 | const xs_val *pending = xs_dict_get(snac->config, "approve_followers"); | 1064 | const xs_val *pending = xs_dict_get(snac->config, "approve_followers"); |
| 1065 | const xs_val *show_foll = xs_dict_get(snac->config, "show_contact_metrics"); | ||
| 1065 | 1066 | ||
| 1066 | xs *metadata = NULL; | 1067 | xs *metadata = NULL; |
| 1067 | const xs_dict *md = xs_dict_get(snac->config, "metadata"); | 1068 | const xs_dict *md = xs_dict_get(snac->config, "metadata"); |
| @@ -1243,6 +1244,15 @@ xs_html *html_top_controls(snac *snac) | |||
| 1243 | xs_html_attr("for", "approve_followers"), | 1244 | xs_html_attr("for", "approve_followers"), |
| 1244 | xs_html_text(L("Follow requests must be approved")))), | 1245 | xs_html_text(L("Follow requests must be approved")))), |
| 1245 | xs_html_tag("p", | 1246 | xs_html_tag("p", |
| 1247 | xs_html_sctag("input", | ||
| 1248 | xs_html_attr("type", "checkbox"), | ||
| 1249 | xs_html_attr("name", "show_contact_metrics"), | ||
| 1250 | xs_html_attr("id", "show_contact_metrics"), | ||
| 1251 | xs_html_attr(xs_is_true(show_foll) ? "checked" : "", NULL)), | ||
| 1252 | xs_html_tag("label", | ||
| 1253 | xs_html_attr("for", "show_contact_metrics"), | ||
| 1254 | xs_html_text(L("Publish follower and following metrics")))), | ||
| 1255 | xs_html_tag("p", | ||
| 1246 | xs_html_text(L("Profile metadata (key=value pairs in each line):")), | 1256 | xs_html_text(L("Profile metadata (key=value pairs in each line):")), |
| 1247 | xs_html_sctag("br", NULL), | 1257 | xs_html_sctag("br", NULL), |
| 1248 | xs_html_tag("textarea", | 1258 | xs_html_tag("textarea", |
| @@ -3858,6 +3868,10 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 3858 | snac.config = xs_dict_set(snac.config, "approve_followers", xs_stock(XSTYPE_TRUE)); | 3868 | snac.config = xs_dict_set(snac.config, "approve_followers", xs_stock(XSTYPE_TRUE)); |
| 3859 | else | 3869 | else |
| 3860 | snac.config = xs_dict_set(snac.config, "approve_followers", xs_stock(XSTYPE_FALSE)); | 3870 | snac.config = xs_dict_set(snac.config, "approve_followers", xs_stock(XSTYPE_FALSE)); |
| 3871 | if ((v = xs_dict_get(p_vars, "show_contact_metrics")) != NULL && strcmp(v, "on") == 0) | ||
| 3872 | snac.config = xs_dict_set(snac.config, "show_contact_metrics", xs_stock(XSTYPE_TRUE)); | ||
| 3873 | else | ||
| 3874 | snac.config = xs_dict_set(snac.config, "show_contact_metrics", xs_stock(XSTYPE_FALSE)); | ||
| 3861 | 3875 | ||
| 3862 | if ((v = xs_dict_get(p_vars, "metadata")) != NULL) | 3876 | if ((v = xs_dict_get(p_vars, "metadata")) != NULL) |
| 3863 | snac.config = xs_dict_set(snac.config, "metadata", v); | 3877 | snac.config = xs_dict_set(snac.config, "metadata", v); |