diff options
| author | 2023-07-15 14:11:48 +0000 | |
|---|---|---|
| committer | 2023-07-15 14:11:48 +0000 | |
| commit | c409d2e260ceb8b1dd21f62459b510d16b30815b (patch) | |
| tree | 66d3fd8c8763a4b119ca21c7b9d2797c143e001e | |
| parent | Updated RELEASE_NOTES. (diff) | |
| parent | html.c: invalid html tag: else? just show it as encoded text. (diff) | |
| download | penes-snac2-c409d2e260ceb8b1dd21f62459b510d16b30815b.tar.gz penes-snac2-c409d2e260ceb8b1dd21f62459b510d16b30815b.tar.xz penes-snac2-c409d2e260ceb8b1dd21f62459b510d16b30815b.zip | |
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
| -rw-r--r-- | format.c | 4 | ||||
| -rw-r--r-- | html.c | 26 | ||||
| -rw-r--r-- | utils.c | 2 |
3 files changed, 18 insertions, 14 deletions
| @@ -226,6 +226,10 @@ xs_str *sanitize(const char *content) | |||
| 226 | v[1] == '/' ? "/" : "", tag, xs_list_len(el) ? " " : "", s3); | 226 | v[1] == '/' ? "/" : "", tag, xs_list_len(el) ? " " : "", s3); |
| 227 | 227 | ||
| 228 | s = xs_str_cat(s, s2); | 228 | s = xs_str_cat(s, s2); |
| 229 | } else { | ||
| 230 | /* else? just show it with encoded code.. that's it. */ | ||
| 231 | xs *el = encode_html(v); | ||
| 232 | s = xs_str_cat(s, el); | ||
| 229 | } | 233 | } |
| 230 | } | 234 | } |
| 231 | else { | 235 | else { |
| @@ -395,7 +395,7 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 395 | "<form autocomplete=\"off\" method=\"post\" " | 395 | "<form autocomplete=\"off\" method=\"post\" " |
| 396 | "action=\"%s/admin/note\" enctype=\"multipart/form-data\">\n" | 396 | "action=\"%s/admin/note\" enctype=\"multipart/form-data\">\n" |
| 397 | "<textarea class=\"snac-textarea\" name=\"content\" " | 397 | "<textarea class=\"snac-textarea\" name=\"content\" " |
| 398 | "rows=\"8\" wrap=\"virtual\" required=\"required\"></textarea>\n" | 398 | "rows=\"8\" wrap=\"virtual\" required=\"required\" placeholder=\"What's on your mind?\"></textarea>\n" |
| 399 | "<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n" | 399 | "<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n" |
| 400 | "<p>%s: <input type=\"checkbox\" name=\"sensitive\"> " | 400 | "<p>%s: <input type=\"checkbox\" name=\"sensitive\"> " |
| 401 | "<input type=\"text\" name=\"summary\" placeholder=\"%s\">\n" | 401 | "<input type=\"text\" name=\"summary\" placeholder=\"%s\">\n" |
| @@ -403,14 +403,14 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 403 | 403 | ||
| 404 | "<details><summary>%s</summary>\n" /** attach **/ | 404 | "<details><summary>%s</summary>\n" /** attach **/ |
| 405 | "<p>%s: <input type=\"file\" name=\"attach\">\n" | 405 | "<p>%s: <input type=\"file\" name=\"attach\">\n" |
| 406 | "<p>%s: <input type=\"text\" name=\"alt_text\">\n" | 406 | "<p>%s: <input type=\"text\" name=\"alt_text\" placeholder=\"[Optional]\">\n" |
| 407 | "</details>\n" | 407 | "</details>\n" |
| 408 | 408 | ||
| 409 | "<p>" | 409 | "<p>" |
| 410 | "<details><summary>%s</summary>\n" /** poll **/ | 410 | "<details><summary>%s</summary>\n" /** poll **/ |
| 411 | "<p>%s:<br>\n" | 411 | "<p>%s:<br>\n" |
| 412 | "<textarea class=\"snac-textarea\" name=\"poll_options\" " | 412 | "<textarea class=\"snac-textarea\" name=\"poll_options\" " |
| 413 | "rows=\"6\" wrap=\"virtual\"></textarea>\n" | 413 | "rows=\"6\" wrap=\"virtual\" placeholder=\"Option 1...\nOption 2...\nOption 3...\n....\"></textarea>\n" |
| 414 | "<p><select name=\"poll_multiple\">\n" | 414 | "<p><select name=\"poll_multiple\">\n" |
| 415 | "<option value=\"off\">%s</option>\n" | 415 | "<option value=\"off\">%s</option>\n" |
| 416 | "<option value=\"on\">%s</option>\n" | 416 | "<option value=\"on\">%s</option>\n" |
| @@ -430,12 +430,12 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 430 | "<details><summary>%s</summary>\n" | 430 | "<details><summary>%s</summary>\n" |
| 431 | 431 | ||
| 432 | "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/action\">\n" /** follow **/ | 432 | "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/action\">\n" /** follow **/ |
| 433 | "<input type=\"text\" name=\"actor\" required=\"required\">\n" | 433 | "<input type=\"text\" name=\"actor\" required=\"required\" placeholder=\"bob@example.com\">\n" |
| 434 | "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n" | 434 | "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n" |
| 435 | "</form><p>\n" | 435 | "</form><p>\n" |
| 436 | 436 | ||
| 437 | "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/action\">\n" /** boost **/ | 437 | "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/action\">\n" /** boost **/ |
| 438 | "<input type=\"text\" name=\"id\" required=\"required\">\n" | 438 | "<input type=\"text\" name=\"id\" required=\"required\" placeholder=\"https://fedi.example.com/bob/....\">\n" |
| 439 | "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n" | 439 | "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n" |
| 440 | "</form><p>\n" | 440 | "</form><p>\n" |
| 441 | 441 | ||
| @@ -445,18 +445,18 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 445 | "<form autocomplete=\"off\" method=\"post\" " | 445 | "<form autocomplete=\"off\" method=\"post\" " |
| 446 | "action=\"%s/admin/user-setup\" enctype=\"multipart/form-data\">\n" | 446 | "action=\"%s/admin/user-setup\" enctype=\"multipart/form-data\">\n" |
| 447 | "<p>%s:<br>\n" | 447 | "<p>%s:<br>\n" |
| 448 | "<input type=\"text\" name=\"name\" value=\"%s\"></p>\n" | 448 | "<input type=\"text\" name=\"name\" value=\"%s\" placeholder=\"Your name.\"></p>\n" |
| 449 | 449 | ||
| 450 | "<p>%s: <input type=\"file\" name=\"avatar_file\"></p>\n" | 450 | "<p>%s: <input type=\"file\" name=\"avatar_file\"></p>\n" |
| 451 | 451 | ||
| 452 | "<p>%s:<br>\n" | 452 | "<p>%s:<br>\n" |
| 453 | "<textarea name=\"bio\" cols=\"40\" rows=\"4\">%s</textarea></p>\n" | 453 | "<textarea name=\"bio\" cols=\"40\" rows=\"4\" placeholder=\"Write about yourself here....\">%s</textarea></p>\n" |
| 454 | 454 | ||
| 455 | "<p><input type=\"checkbox\" name=\"cw\" id=\"cw\" %s>\n" | 455 | "<p><input type=\"checkbox\" name=\"cw\" id=\"cw\" %s>\n" |
| 456 | "<label for=\"cw\">%s</label></p>\n" | 456 | "<label for=\"cw\">%s</label></p>\n" |
| 457 | 457 | ||
| 458 | "<p>%s:<br>\n" | 458 | "<p>%s:<br>\n" |
| 459 | "<input type=\"text\" name=\"email\" value=\"%s\"></p>\n" | 459 | "<input type=\"text\" name=\"email\" value=\"%s\" placeholder=\"bob@example.com\"></p>\n" |
| 460 | 460 | ||
| 461 | "<p>%s:<br>\n" | 461 | "<p>%s:<br>\n" |
| 462 | "<input type=\"text\" name=\"telegram_bot\" placeholder=\"Bot API key\" value=\"%s\"> " | 462 | "<input type=\"text\" name=\"telegram_bot\" placeholder=\"Bot API key\" value=\"%s\"> " |
| @@ -533,7 +533,7 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 533 | L("Sensitive content description"), | 533 | L("Sensitive content description"), |
| 534 | L("Only for mentioned people"), | 534 | L("Only for mentioned people"), |
| 535 | 535 | ||
| 536 | L("Attach..."), | 536 | L("Attachment..."), |
| 537 | L("File"), | 537 | L("File"), |
| 538 | L("File description"), | 538 | L("File description"), |
| 539 | 539 | ||
| @@ -555,7 +555,7 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 555 | snac->actor, | 555 | snac->actor, |
| 556 | L("Boost"), L("(by URL)"), | 556 | L("Boost"), L("(by URL)"), |
| 557 | 557 | ||
| 558 | L("User setup..."), | 558 | L("User settings...."), |
| 559 | snac->actor, | 559 | snac->actor, |
| 560 | L("Display name"), | 560 | L("Display name"), |
| 561 | es1, | 561 | es1, |
| @@ -575,8 +575,8 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 575 | L("Drop direct messages from people you don't follow"), | 575 | L("Drop direct messages from people you don't follow"), |
| 576 | xs_type(bot) == XSTYPE_TRUE ? "checked" : "", | 576 | xs_type(bot) == XSTYPE_TRUE ? "checked" : "", |
| 577 | L("This account is a bot"), | 577 | L("This account is a bot"), |
| 578 | L("New Password"), | 578 | L("New password"), |
| 579 | L("Repeat New Password"), | 579 | L("Repeat new password"), |
| 580 | L("Update user info") | 580 | L("Update user info") |
| 581 | ); | 581 | ); |
| 582 | 582 | ||
| @@ -712,7 +712,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch | |||
| 712 | const char *prev_src1 = xs_dict_get(msg, "sourceContent"); | 712 | const char *prev_src1 = xs_dict_get(msg, "sourceContent"); |
| 713 | 713 | ||
| 714 | if (!xs_is_null(prev_src1) && strcmp(actor, snac->actor) == 0) { /** edit **/ | 714 | if (!xs_is_null(prev_src1) && strcmp(actor, snac->actor) == 0) { /** edit **/ |
| 715 | xs *prev_src = xs_replace(prev_src1, "<", "<"); | 715 | xs *prev_src = encode_html(prev_src1); |
| 716 | const xs_val *sensitive = xs_dict_get(msg, "sensitive"); | 716 | const xs_val *sensitive = xs_dict_get(msg, "sensitive"); |
| 717 | const char *summary = xs_dict_get(msg, "summary"); | 717 | const char *summary = xs_dict_get(msg, "summary"); |
| 718 | 718 | ||
| @@ -225,7 +225,7 @@ int adduser(const char *uid) | |||
| 225 | FILE *f; | 225 | FILE *f; |
| 226 | 226 | ||
| 227 | if (uid == NULL) { | 227 | if (uid == NULL) { |
| 228 | printf("User id:\n"); | 228 | printf("Username: "); |
| 229 | uid = xs_strip_i(xs_readline(stdin)); | 229 | uid = xs_strip_i(xs_readline(stdin)); |
| 230 | } | 230 | } |
| 231 | 231 | ||