commit c409d2e
Merge pull request '[Really optional] Whenever to have Placeholder on some inputs? & other stuff' (#69) from yonle/snac2:master into master Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/69
M
format.c
+4,
-0
1@@ -226,6 +226,10 @@ xs_str *sanitize(const char *content)
2 v[1] == '/' ? "/" : "", tag, xs_list_len(el) ? " " : "", s3);
3
4 s = xs_str_cat(s, s2);
5+ } else {
6+ /* else? just show it with encoded code.. that's it. */
7+ xs *el = encode_html(v);
8+ s = xs_str_cat(s, el);
9 }
10 }
11 else {
M
html.c
+13,
-13
1@@ -395,7 +395,7 @@ d_char *html_top_controls(snac *snac, d_char *s)
2 "<form autocomplete=\"off\" method=\"post\" "
3 "action=\"%s/admin/note\" enctype=\"multipart/form-data\">\n"
4 "<textarea class=\"snac-textarea\" name=\"content\" "
5- "rows=\"8\" wrap=\"virtual\" required=\"required\"></textarea>\n"
6+ "rows=\"8\" wrap=\"virtual\" required=\"required\" placeholder=\"What's on your mind?\"></textarea>\n"
7 "<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n"
8 "<p>%s: <input type=\"checkbox\" name=\"sensitive\"> "
9 "<input type=\"text\" name=\"summary\" placeholder=\"%s\">\n"
10@@ -403,14 +403,14 @@ d_char *html_top_controls(snac *snac, d_char *s)
11
12 "<details><summary>%s</summary>\n" /** attach **/
13 "<p>%s: <input type=\"file\" name=\"attach\">\n"
14- "<p>%s: <input type=\"text\" name=\"alt_text\">\n"
15+ "<p>%s: <input type=\"text\" name=\"alt_text\" placeholder=\"[Optional]\">\n"
16 "</details>\n"
17
18 "<p>"
19 "<details><summary>%s</summary>\n" /** poll **/
20 "<p>%s:<br>\n"
21 "<textarea class=\"snac-textarea\" name=\"poll_options\" "
22- "rows=\"6\" wrap=\"virtual\"></textarea>\n"
23+ "rows=\"6\" wrap=\"virtual\" placeholder=\"Option 1...\nOption 2...\nOption 3...\n....\"></textarea>\n"
24 "<p><select name=\"poll_multiple\">\n"
25 "<option value=\"off\">%s</option>\n"
26 "<option value=\"on\">%s</option>\n"
27@@ -430,12 +430,12 @@ d_char *html_top_controls(snac *snac, d_char *s)
28 "<details><summary>%s</summary>\n"
29
30 "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/action\">\n" /** follow **/
31- "<input type=\"text\" name=\"actor\" required=\"required\">\n"
32+ "<input type=\"text\" name=\"actor\" required=\"required\" placeholder=\"bob@example.com\">\n"
33 "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n"
34 "</form><p>\n"
35
36 "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/action\">\n" /** boost **/
37- "<input type=\"text\" name=\"id\" required=\"required\">\n"
38+ "<input type=\"text\" name=\"id\" required=\"required\" placeholder=\"https://fedi.example.com/bob/....\">\n"
39 "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n"
40 "</form><p>\n"
41
42@@ -445,18 +445,18 @@ d_char *html_top_controls(snac *snac, d_char *s)
43 "<form autocomplete=\"off\" method=\"post\" "
44 "action=\"%s/admin/user-setup\" enctype=\"multipart/form-data\">\n"
45 "<p>%s:<br>\n"
46- "<input type=\"text\" name=\"name\" value=\"%s\"></p>\n"
47+ "<input type=\"text\" name=\"name\" value=\"%s\" placeholder=\"Your name.\"></p>\n"
48
49 "<p>%s: <input type=\"file\" name=\"avatar_file\"></p>\n"
50
51 "<p>%s:<br>\n"
52- "<textarea name=\"bio\" cols=\"40\" rows=\"4\">%s</textarea></p>\n"
53+ "<textarea name=\"bio\" cols=\"40\" rows=\"4\" placeholder=\"Write about yourself here....\">%s</textarea></p>\n"
54
55 "<p><input type=\"checkbox\" name=\"cw\" id=\"cw\" %s>\n"
56 "<label for=\"cw\">%s</label></p>\n"
57
58 "<p>%s:<br>\n"
59- "<input type=\"text\" name=\"email\" value=\"%s\"></p>\n"
60+ "<input type=\"text\" name=\"email\" value=\"%s\" placeholder=\"bob@example.com\"></p>\n"
61
62 "<p>%s:<br>\n"
63 "<input type=\"text\" name=\"telegram_bot\" placeholder=\"Bot API key\" value=\"%s\"> "
64@@ -533,7 +533,7 @@ d_char *html_top_controls(snac *snac, d_char *s)
65 L("Sensitive content description"),
66 L("Only for mentioned people"),
67
68- L("Attach..."),
69+ L("Attachment..."),
70 L("File"),
71 L("File description"),
72
73@@ -555,7 +555,7 @@ d_char *html_top_controls(snac *snac, d_char *s)
74 snac->actor,
75 L("Boost"), L("(by URL)"),
76
77- L("User setup..."),
78+ L("User settings...."),
79 snac->actor,
80 L("Display name"),
81 es1,
82@@ -575,8 +575,8 @@ d_char *html_top_controls(snac *snac, d_char *s)
83 L("Drop direct messages from people you don't follow"),
84 xs_type(bot) == XSTYPE_TRUE ? "checked" : "",
85 L("This account is a bot"),
86- L("New Password"),
87- L("Repeat New Password"),
88+ L("New password"),
89+ L("Repeat new password"),
90 L("Update user info")
91 );
92
93@@ -712,7 +712,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
94 const char *prev_src1 = xs_dict_get(msg, "sourceContent");
95
96 if (!xs_is_null(prev_src1) && strcmp(actor, snac->actor) == 0) { /** edit **/
97- xs *prev_src = xs_replace(prev_src1, "<", "<");
98+ xs *prev_src = encode_html(prev_src1);
99 const xs_val *sensitive = xs_dict_get(msg, "sensitive");
100 const char *summary = xs_dict_get(msg, "summary");
101
M
utils.c
+1,
-1
1@@ -225,7 +225,7 @@ int adduser(const char *uid)
2 FILE *f;
3
4 if (uid == NULL) {
5- printf("User id:\n");
6+ printf("Username: ");
7 uid = xs_strip_i(xs_readline(stdin));
8 }
9