snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 072ae21013dc924c6bb3378a2480b571a66aba98
parent 8f048b06cb792cbf081a31b405100042d8808534
Author: grunfink <grunfink@comam.es>
Date:   Sun, 18 May 2025 09:38:38 +0200

Operations on the 'people' page redirects back to it instead of 'admin'.

Diffstat:
Mhtml.c | 21+++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/html.c b/html.c @@ -3149,6 +3149,8 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c xs_html_tag("summary", xs_html_text("...")))); + xs *redir = xs_fmt("%s/people", user->actor); + const char *actor_id; xs_list_foreach(list, actor_id) { @@ -3202,6 +3204,10 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c xs_html_attr("value", actor_id)), xs_html_sctag("input", xs_html_attr("type", "hidden"), + xs_html_attr("name", "hard-redir"), + xs_html_attr("value", redir)), + xs_html_sctag("input", + xs_html_attr("type", "hidden"), xs_html_attr("name", "actor-form"), xs_html_attr("value", "yes"))); @@ -5003,12 +5009,19 @@ int html_post_handler(const xs_dict *req, const char *q_path, } if (status == HTTP_STATUS_SEE_OTHER) { - const char *redir = xs_dict_get(p_vars, "redir"); + const char *hard_redir = xs_dict_get(p_vars, "hard-redir"); - if (xs_is_null(redir)) - redir = "top"; + if (xs_is_string(hard_redir)) + *body = xs_dup(hard_redir); + else { + const char *redir = xs_dict_get(p_vars, "redir"); + + if (xs_is_null(redir)) + redir = "top"; + + *body = xs_fmt("%s/admin#%s", snac.actor, redir); + } - *body = xs_fmt("%s/admin#%s", snac.actor, redir); *b_size = strlen(*body); }