mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
html.c: Rollback to e9adaa1f7a, Put "User Settings..." outside of "Operations..."'s <details> element
Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
parent
68d03d6d51
commit
e776bf7e2c
1 changed files with 11 additions and 33 deletions
44
html.c
44
html.c
|
@ -1,4 +1,4 @@
|
||||||
/* snac - A simple, minimalistic ActivityPub instance */
|
/* snac - A simple, minimalistic ActivityPub instance */
|
||||||
/* copyright (c) 2022 - 2023 grunfink / MIT license */
|
/* copyright (c) 2022 - 2023 grunfink / MIT license */
|
||||||
|
|
||||||
#include "xs.h"
|
#include "xs.h"
|
||||||
|
@ -343,14 +343,11 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
|
||||||
"<a href=\"../%s\">%s</a> - "
|
"<a href=\"../%s\">%s</a> - "
|
||||||
"<a href=\"admin\">%s</a> - "
|
"<a href=\"admin\">%s</a> - "
|
||||||
"<a href=\"notifications\">%s</a>%s - "
|
"<a href=\"notifications\">%s</a>%s - "
|
||||||
"<a href=\"people\">%s</a></nav>\n"
|
"<a href=\"people\">%s</a></nav>\n",
|
||||||
"<a href=\"settings\">%s</a>"
|
|
||||||
"</nav>",
|
|
||||||
snac->uid, L("public"),
|
snac->uid, L("public"),
|
||||||
L("private"),
|
L("private"),
|
||||||
L("notifications"), n_str,
|
L("notifications"), n_str,
|
||||||
L("people"),
|
L("people"));
|
||||||
L("settings"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s = xs_str_cat(s, s1);
|
s = xs_str_cat(s, s1);
|
||||||
|
@ -388,13 +385,13 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
|
d_char *html_top_controls(snac *snac, d_char *s)
|
||||||
/* generates the top controls */
|
/* generates the top controls */
|
||||||
{
|
{
|
||||||
char *_tmpl =
|
char *_tmpl =
|
||||||
"<div class=\"snac-top-controls\">\n"
|
"<div class=\"snac-top-controls\">\n"
|
||||||
|
|
||||||
"<div class=\"snac-note\" %s>\n"
|
"<div class=\"snac-note\">\n"
|
||||||
"<details><summary>%s</summary>\n"
|
"<details><summary>%s</summary>\n"
|
||||||
"<form autocomplete=\"off\" method=\"post\" "
|
"<form autocomplete=\"off\" method=\"post\" "
|
||||||
"action=\"admin/note\" enctype=\"multipart/form-data\">\n"
|
"action=\"admin/note\" enctype=\"multipart/form-data\">\n"
|
||||||
|
@ -431,8 +428,8 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
|
||||||
"</div>\n"
|
"</div>\n"
|
||||||
"</details>\n"
|
"</details>\n"
|
||||||
|
|
||||||
"<div class=\"snac-top-controls-more\" %s>\n"
|
"<div class=\"snac-top-controls-more\">\n"
|
||||||
"<p><details><summary>%s</summary>\n"
|
"<details><summary>%s</summary>\n"
|
||||||
|
|
||||||
"<form autocomplete=\"off\" method=\"post\" action=\"admin/action\">\n" /** follow **/
|
"<form autocomplete=\"off\" method=\"post\" action=\"admin/action\">\n" /** follow **/
|
||||||
"<input type=\"text\" name=\"actor\" required=\"required\" placeholder=\"bob@example.com\">\n"
|
"<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)
|
||||||
"<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n"
|
"<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n"
|
||||||
"</form><p>\n"
|
"</form><p>\n"
|
||||||
"</details>\n"
|
"</details>\n"
|
||||||
"</div>\n"
|
|
||||||
|
|
||||||
"<div class=\"snac-user-settings\" %s>\n"
|
"<details><summary>%s</summary>\n"
|
||||||
|
|
||||||
"<h2 class=\"snac-header\">%s</h2>\n"
|
|
||||||
|
|
||||||
"<div class=\"snac-user-setup\">\n" /** user setup **/
|
"<div class=\"snac-user-setup\">\n" /** user setup **/
|
||||||
"<form autocomplete=\"off\" method=\"post\" "
|
"<form autocomplete=\"off\" method=\"post\" "
|
||||||
|
@ -490,6 +484,7 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
|
||||||
"</form>\n"
|
"</form>\n"
|
||||||
|
|
||||||
"</div>\n"
|
"</div>\n"
|
||||||
|
"</details>\n"
|
||||||
"</div>\n"
|
"</div>\n"
|
||||||
"</div>\n";
|
"</div>\n";
|
||||||
|
|
||||||
|
@ -535,7 +530,6 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
|
||||||
xs *es6 = encode_html(purge_days);
|
xs *es6 = encode_html(purge_days);
|
||||||
|
|
||||||
xs *s1 = xs_fmt(_tmpl,
|
xs *s1 = xs_fmt(_tmpl,
|
||||||
settings ? "style=\"display: none\"" : "",
|
|
||||||
L("New Post..."),
|
L("New Post..."),
|
||||||
L("Sensitive content"),
|
L("Sensitive content"),
|
||||||
L("Sensitive content description"),
|
L("Sensitive content description"),
|
||||||
|
@ -555,15 +549,11 @@ xs_str *html_top_controls(snac *snac, xs_str *s, int settings)
|
||||||
|
|
||||||
L("Post"),
|
L("Post"),
|
||||||
|
|
||||||
settings ? "style=\"display: none\"" : "",
|
|
||||||
L("Operations..."),
|
L("Operations..."),
|
||||||
|
|
||||||
L("Follow"), L("(by URL or user@host)"),
|
L("Follow"), L("(by URL or user@host)"),
|
||||||
L("Boost"), L("(by URL)"),
|
L("Boost"), L("(by URL)"),
|
||||||
|
|
||||||
!settings ? "style=\"display: none\"" : "",
|
L("User Settings..."),
|
||||||
|
|
||||||
L("User Settings"),
|
|
||||||
L("Display name"),
|
L("Display name"),
|
||||||
es1,
|
es1,
|
||||||
L("Avatar"),
|
L("Avatar"),
|
||||||
|
@ -1380,7 +1370,7 @@ xs_str *html_timeline(snac *snac, const xs_list *list, int local, int skip, int
|
||||||
s = html_user_header(snac, s, local);
|
s = html_user_header(snac, s, local);
|
||||||
|
|
||||||
if (!local)
|
if (!local)
|
||||||
s = html_top_controls(snac, s, list == NULL ? 1 : 0);
|
s = html_top_controls(snac, s);
|
||||||
|
|
||||||
s = xs_str_cat(s, "<a name=\"snac-posts\"></a>\n");
|
s = xs_str_cat(s, "<a name=\"snac-posts\"></a>\n");
|
||||||
s = xs_str_cat(s, "<div class=\"snac-posts\">\n");
|
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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(p_path, "settings") == 0) { /** user settings **/
|
|
||||||
if (!login(&snac, req)) {
|
|
||||||
*body = xs_dup(uid);
|
|
||||||
status = 401;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*body = html_timeline(&snac, NULL, 0, 0, 0, 0);
|
|
||||||
*b_size = strlen(*body);
|
|
||||||
status = 200;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (strcmp(p_path, "notifications") == 0) { /** the list of notifications **/
|
if (strcmp(p_path, "notifications") == 0) { /** the list of notifications **/
|
||||||
if (!login(&snac, req)) {
|
if (!login(&snac, req)) {
|
||||||
*body = xs_dup(uid);
|
*body = xs_dup(uid);
|
||||||
|
|
Loading…
Reference in a new issue