From 25bb8f0dd2c934d98f7f7e78514939a0256fc764 Mon Sep 17 00:00:00 2001 From: Yonle Date: Mon, 24 Jul 2023 22:56:18 +0700 Subject: [PATCH 1/2] Rollback to 86f507410bc5a1e6ce8bcd34f94400a380143d64 for some reasons. Signed-off-by: Yonle --- RELEASE_NOTES.md | 4 --- html.c | 74 ++++++++++++++++++++++++++---------------------- httpd.c | 2 +- snac.h | 2 +- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 9d387f3..f7e281c 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,9 +1,5 @@ # Release Notes -## 2.39 - -User settings have been moved to their own page. - ## 2.38 More vulnerability fixes (contributed by yonle). diff --git a/html.c b/html.c index 725c064..ab23032 100644 --- a/html.c +++ b/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 */ #include "xs.h" @@ -325,8 +325,8 @@ d_char *html_user_header(snac *snac, d_char *s, int local) s1 = xs_fmt( "%s - " "%s\n", - snac->uid, L("RSS"), - snac->uid, L("private")); + snac->actor, L("RSS"), + snac->actor, L("private")); else { xs *n_list = notify_list(snac, 1); int n_len = xs_list_len(n_list); @@ -340,14 +340,14 @@ d_char *html_user_header(snac *snac, d_char *s, int local) n_str = xs_str_new(""); s1 = xs_fmt( - "%s - " - "%s - " - "%s%s - " - "%s\n", - snac->uid, L("public"), - L("private"), - L("notifications"), n_str, - L("people")); + "%s - " + "%s - " + "%s%s - " + "%s\n", + snac->actor, L("public"), + snac->actor, L("private"), + snac->actor, L("notifications"), n_str, + snac->actor, L("people")); } s = xs_str_cat(s, s1); @@ -394,7 +394,7 @@ d_char *html_top_controls(snac *snac, d_char *s) "
\n" "
%s\n" "
\n" + "action=\"%s/admin/note\" enctype=\"multipart/form-data\">\n" "\n" "\n" @@ -431,22 +431,21 @@ d_char *html_top_controls(snac *snac, d_char *s) "
\n" "
%s\n" - "\n" /** follow **/ + "\n" /** follow **/ "\n" " %s\n" "

\n" - "

\n" /** boost **/ + "\n" /** boost **/ "\n" " %s\n" "

\n" - "

\n" "
%s\n" "
\n" /** user setup **/ "
\n" + "action=\"%s/admin/user-setup\" enctype=\"multipart/form-data\">\n" "

%s:
\n" "

\n" @@ -485,6 +484,7 @@ d_char *html_top_controls(snac *snac, d_char *s) "
\n" "
\n" + "
\n" "
\n" "\n"; @@ -531,6 +531,7 @@ d_char *html_top_controls(snac *snac, d_char *s) xs *s1 = xs_fmt(_tmpl, L("New Post..."), + snac->actor, L("Sensitive content"), L("Sensitive content description"), L("Only for mentioned people"), @@ -549,11 +550,16 @@ d_char *html_top_controls(snac *snac, d_char *s) L("Post"), - L("Operations..."), + L("Preferences..."), + + snac->actor, L("Follow"), L("(by URL or user@host)"), + + snac->actor, L("Boost"), L("(by URL)"), - L("User Settings..."), + L("User Settings"), + snac->actor, L("Display name"), es1, L("Avatar"), @@ -657,13 +663,13 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch { xs *s1 = xs_fmt( - "\n" + "\n" "\n" "\n" "\n" "\n", - id, actor, md5 + snac->actor, id, actor, md5 ); s = xs_str_cat(s, s1); @@ -717,7 +723,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch xs *s1 = xs_fmt( "

%s\n" "

\n" - "\n" "\n" @@ -740,7 +746,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch L("Edit..."), md5, - md5, + snac->actor, md5, prev_src, id, L("Sensitive content"), @@ -768,7 +774,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch xs *s1 = xs_fmt( "

%s\n" "

\n" - "\n" "\n" @@ -791,7 +797,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch L("Reply..."), md5, - md5, + snac->actor, md5, ct, id, L("Sensitive content"), @@ -1086,10 +1092,10 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, /* poll still active */ xs *s1 = xs_fmt("
\n" "\n" + "method=\"post\" action=\"%s/admin/vote\">\n" "\n" "\n", - actor, id); + snac->actor, actor, id); while (xs_list_iter(&p, &v)) { const char *name = xs_dict_get(v, "name"); @@ -1479,11 +1485,11 @@ d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *heade s = xs_str_cat(s, "
\n"); xs *s1 = xs_fmt( - "

\n" + "

\n" "\n" "\n", - actor_id + snac->actor, actor_id ); s = xs_str_cat(s, s1); @@ -1507,7 +1513,7 @@ d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *heade xs *s2 = xs_fmt( "

%s\n" "

\n" - "\n" "\n" @@ -1519,7 +1525,7 @@ d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *heade L("Direct Message..."), md5, t, - md5, + snac->actor, md5, actor_id, L("Post") ); @@ -1570,9 +1576,9 @@ xs_str *html_notifications(snac *snac) xs *s1 = xs_fmt( "\n" + "method=\"post\" action=\"%s/admin/clear-notifications\" id=\"clear\">\n" "\n" - "

\n", L("Clear all")); + "

\n", snac->actor, L("Clear all")); s = xs_str_cat(s, s1); while (xs_list_iter(&p, &v)) { @@ -2372,9 +2378,9 @@ int html_post_handler(const xs_dict *req, const char *q_path, char *redir = xs_dict_get(p_vars, "redir"); if (xs_is_null(redir)) - redir = ""; + redir = "snac-posts"; - *body = xs_fmt("../admin#%s", redir); + *body = xs_fmt("%s/admin#%s", snac.actor, redir); *b_size = strlen(*body); } diff --git a/httpd.c b/httpd.c index 1d2200e..9aac3b5 100644 --- a/httpd.c +++ b/httpd.c @@ -91,7 +91,7 @@ int server_get_handler(xs_dict *req, char *q_path, if (user_open(&snac, uid)) { xs *u = xs_fmt( "

  • @%s@%s (%s)
  • \n", - uid, uid, host, + snac.actor, uid, host, xs_dict_get(snac.config, "name")); ul = xs_str_cat(ul, u); diff --git a/snac.h b/snac.h index 2fd0fce..df13ddd 100644 --- a/snac.h +++ b/snac.h @@ -1,7 +1,7 @@ /* snac - A simple, minimalistic ActivityPub instance */ /* copyright (c) 2022 - 2023 grunfink / MIT license */ -#define VERSION "2.39-dev" +#define VERSION "2.38" #define USER_AGENT "snac/" VERSION From 3c1dc419ea5b7ff2bb4ce55afbbcca9e7f16b985 Mon Sep 17 00:00:00 2001 From: Yonle Date: Mon, 24 Jul 2023 23:13:13 +0700 Subject: [PATCH 2/2] html.c: Put "User Settings" outside of "Operations". Signed-off-by: Yonle --- html.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/html.c b/html.c index ab23032..7ce94f2 100644 --- a/html.c +++ b/html.c @@ -440,6 +440,7 @@ d_char *html_top_controls(snac *snac, d_char *s) "\n" " %s\n" "

    \n" + "

    \n" "
    %s\n" @@ -484,7 +485,6 @@ d_char *html_top_controls(snac *snac, d_char *s) "
    \n" "
    \n" - "
    \n" "\n" "\n"; @@ -550,7 +550,7 @@ d_char *html_top_controls(snac *snac, d_char *s) L("Post"), - L("Preferences..."), + L("Operations..."), snac->actor, L("Follow"), L("(by URL or user@host)"), @@ -558,7 +558,7 @@ d_char *html_top_controls(snac *snac, d_char *s) snac->actor, L("Boost"), L("(by URL)"), - L("User Settings"), + L("User Settings..."), snac->actor, L("Display name"), es1,