summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Yonle2023-07-24 20:36:35 +0700
committerGravatar Yonle2023-07-24 20:42:26 +0700
commite776bf7e2c81d2cd03efda14e06d375bf80f890b (patch)
tree087a7397bf5d34cda3e64259afcc4d380305c920
parenthtml.c: No need to redirect to #snac-posts again. (diff)
downloadsnac2-e776bf7e2c81d2cd03efda14e06d375bf80f890b.tar.gz
snac2-e776bf7e2c81d2cd03efda14e06d375bf80f890b.tar.xz
snac2-e776bf7e2c81d2cd03efda14e06d375bf80f890b.zip
html.c: Rollback to e9adaa1f7a, Put "User Settings..." outside of "Operations..."'s <details> element
Signed-off-by: Yonle <yonle@lecturify.net>
-rw-r--r--html.c44
1 files changed, 11 insertions, 33 deletions
diff --git a/html.c b/html.c
index 198269f..725c064 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1 /* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 - 2023 grunfink / MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
@@ -343,14 +343,11 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
343 "<a href=\"../%s\">%s</a> - " 343 "<a href=\"../%s\">%s</a> - "
344 "<a href=\"admin\">%s</a> - " 344 "<a href=\"admin\">%s</a> - "
345 "<a href=\"notifications\">%s</a>%s - " 345 "<a href=\"notifications\">%s</a>%s - "
346 "<a href=\"people\">%s</a></nav>\n" 346 "<a href=\"people\">%s</a></nav>\n",
347 "<a href=\"settings\">%s</a>"
348 "</nav>",
349 snac->uid, L("public"), 347 snac->uid, L("public"),
350 L("private"), 348 L("private"),
351 L("notifications"), n_str, 349 L("notifications"), n_str,
352 L("people"), 350 L("people"));
353 L("settings"));
354 } 351 }
355 352
356 s = xs_str_cat(s, s1); 353 s = xs_str_cat(s, s1);
@@ -388,13 +385,13 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
388} 385}
389 386
390 387
391xs_str *html_top_controls(snac *snac, xs_str *s, int settings) 388d_char *html_top_controls(snac *snac, d_char *s)
392/* generates the top controls */ 389/* generates the top controls */
393{ 390{
394 char *_tmpl = 391 char *_tmpl =
395 "<div class=\"snac-top-controls\">\n" 392 "<div class=\"snac-top-controls\">\n"
396 393
397 "<div class=\"snac-note\" %s>\n" 394 "<div class=\"snac-note\">\n"
398 "<details><summary>%s</summary>\n" 395 "<details><summary>%s</summary>\n"
399 "<form autocomplete=\"off\" method=\"post\" " 396 "<form autocomplete=\"off\" method=\"post\" "
400 "action=\"admin/note\" enctype=\"multipart/form-data\">\n" 397 "action=\"admin/note\" enctype=\"multipart/form-data\">\n"
@@ -431,8 +428,8 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
431 "</div>\n" 428 "</div>\n"
432 "</details>\n" 429 "</details>\n"
433 430
434 "<div class=\"snac-top-controls-more\" %s>\n" 431 "<div class=\"snac-top-controls-more\">\n"
435 "<p><details><summary>%s</summary>\n" 432 "<details><summary>%s</summary>\n"
436 433
437 "<form autocomplete=\"off\" method=\"post\" action=\"admin/action\">\n" /** follow **/ 434 "<form autocomplete=\"off\" method=\"post\" action=\"admin/action\">\n" /** follow **/
438 "<input type=\"text\" name=\"actor\" required=\"required\" placeholder=\"bob@example.com\">\n" 435 "<input type=\"text\" name=\"actor\" required=\"required\" placeholder=\"bob@example.com\">\n"
@@ -444,11 +441,8 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
444 "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n" 441 "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n"
445 "</form><p>\n" 442 "</form><p>\n"
446 "</details>\n" 443 "</details>\n"
447 "</div>\n"
448
449 "<div class=\"snac-user-settings\" %s>\n"
450 444
451 "<h2 class=\"snac-header\">%s</h2>\n" 445 "<details><summary>%s</summary>\n"
452 446
453 "<div class=\"snac-user-setup\">\n" /** user setup **/ 447 "<div class=\"snac-user-setup\">\n" /** user setup **/
454 "<form autocomplete=\"off\" method=\"post\" " 448 "<form autocomplete=\"off\" method=\"post\" "
@@ -490,6 +484,7 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
490 "</form>\n" 484 "</form>\n"
491 485
492 "</div>\n" 486 "</div>\n"
487 "</details>\n"
493 "</div>\n" 488 "</div>\n"
494 "</div>\n"; 489 "</div>\n";
495 490
@@ -535,7 +530,6 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
535 xs *es6 = encode_html(purge_days); 530 xs *es6 = encode_html(purge_days);
536 531
537 xs *s1 = xs_fmt(_tmpl, 532 xs *s1 = xs_fmt(_tmpl,
538 settings ? "style=\"display: none\"" : "",
539 L("New Post..."), 533 L("New Post..."),
540 L("Sensitive content"), 534 L("Sensitive content"),
541 L("Sensitive content description"), 535 L("Sensitive content description"),
@@ -555,15 +549,11 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
555 549
556 L("Post"), 550 L("Post"),
557 551
558 settings ? "style=\"display: none\"" : "",
559 L("Operations..."), 552 L("Operations..."),
560
561 L("Follow"), L("(by URL or user@host)"), 553 L("Follow"), L("(by URL or user@host)"),
562 L("Boost"), L("(by URL)"), 554 L("Boost"), L("(by URL)"),
563 555
564 !settings ? "style=\"display: none\"" : "", 556 L("User Settings..."),
565
566 L("User Settings"),
567 L("Display name"), 557 L("Display name"),
568 es1, 558 es1,
569 L("Avatar"), 559 L("Avatar"),
@@ -1380,7 +1370,7 @@ xs_str *html_timeline(snac *snac, const xs_list *list, int local, int skip, int
1380 s = html_user_header(snac, s, local); 1370 s = html_user_header(snac, s, local);
1381 1371
1382 if (!local) 1372 if (!local)
1383 s = html_top_controls(snac, s, list == NULL ? 1 : 0); 1373 s = html_top_controls(snac, s);
1384 1374
1385 s = xs_str_cat(s, "<a name=\"snac-posts\"></a>\n"); 1375 s = xs_str_cat(s, "<a name=\"snac-posts\"></a>\n");
1386 s = xs_str_cat(s, "<div class=\"snac-posts\">\n"); 1376 s = xs_str_cat(s, "<div class=\"snac-posts\">\n");
@@ -1817,18 +1807,6 @@ int html_get_handler(const xs_dict *req, const char *q_path,
1817 } 1807 }
1818 } 1808 }
1819 else 1809 else
1820 if (strcmp(p_path, "settings") == 0) { /** user settings **/
1821 if (!login(&snac, req)) {
1822 *body = xs_dup(uid);
1823 status = 401;
1824 }
1825 else {
1826 *body = html_timeline(&snac, NULL, 0, 0, 0, 0);
1827 *b_size = strlen(*body);
1828 status = 200;
1829 }
1830 }
1831 else
1832 if (strcmp(p_path, "notifications") == 0) { /** the list of notifications **/ 1810 if (strcmp(p_path, "notifications") == 0) { /** the list of notifications **/
1833 if (!login(&snac, req)) { 1811 if (!login(&snac, req)) {
1834 *body = xs_dup(uid); 1812 *body = xs_dup(uid);