diff options
| -rw-r--r-- | RELEASE_NOTES.md | 6 | ||||
| -rw-r--r-- | activitypub.c | 17 | ||||
| -rw-r--r-- | html.c | 27 | ||||
| -rw-r--r-- | po/de_DE.po | 10 | ||||
| -rw-r--r-- | snac.h | 2 | ||||
| -rw-r--r-- | webfinger.c | 4 |
6 files changed, 55 insertions, 11 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 7dfb332..3ff6fd9 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | # Release Notes | 1 | # Release Notes |
| 2 | 2 | ||
| 3 | ## UNRELEASED | ||
| 4 | |||
| 5 | Quoted posts are now shown. | ||
| 6 | |||
| 7 | Fixed memory leak (contributed by dandelions). | ||
| 8 | |||
| 3 | ## 2.84 | 9 | ## 2.84 |
| 4 | 10 | ||
| 5 | Implemented more scopes to match other ActivityPub implementations (public, unlisted, followers-only and direct message) (contributed by byte). | 11 | Implemented more scopes to match other ActivityPub implementations (public, unlisted, followers-only and direct message) (contributed by byte). |
diff --git a/activitypub.c b/activitypub.c index 0368ac8..2c0fa2e 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -2686,6 +2686,20 @@ int process_input_message(snac *snac, const xs_dict *msg, const xs_dict *req) | |||
| 2686 | 2686 | ||
| 2687 | timeline_request(snac, &in_reply_to, &wrk, 0); | 2687 | timeline_request(snac, &in_reply_to, &wrk, 0); |
| 2688 | 2688 | ||
| 2689 | const char *quoted_id = xs_or(xs_dict_get(object, "quoteUri"), xs_dict_get(object, "quoteUrl")); | ||
| 2690 | |||
| 2691 | if (xs_is_string(quoted_id) && xs_match(quoted_id, "https://*|http://*")) { /** **/ | ||
| 2692 | xs *quoted_post = NULL; | ||
| 2693 | int status; | ||
| 2694 | |||
| 2695 | if (valid_status(status = activitypub_request(snac, quoted_id, "ed_post))) { | ||
| 2696 | /* got quoted post */ | ||
| 2697 | object_add(quoted_id, quoted_post); | ||
| 2698 | } | ||
| 2699 | |||
| 2700 | snac_debug(snac, 1, xs_fmt("retrieving quoted post %s %d", quoted_id, status)); | ||
| 2701 | } | ||
| 2702 | |||
| 2689 | if (timeline_add(snac, id, object)) { | 2703 | if (timeline_add(snac, id, object)) { |
| 2690 | snac_log(snac, xs_fmt("new '%s' %s %s", utype, actor, id)); | 2704 | snac_log(snac, xs_fmt("new '%s' %s %s", utype, actor, id)); |
| 2691 | do_notify = 1; | 2705 | do_notify = 1; |
| @@ -2792,6 +2806,9 @@ int process_input_message(snac *snac, const xs_dict *msg, const xs_dict *req) | |||
| 2792 | if (valid_status(object_get(object, &a_msg))) { | 2806 | if (valid_status(object_get(object, &a_msg))) { |
| 2793 | const char *who = get_atto(a_msg); | 2807 | const char *who = get_atto(a_msg); |
| 2794 | 2808 | ||
| 2809 | /* got the admired object: instance is [back] online */ | ||
| 2810 | instance_failure(object, 2); | ||
| 2811 | |||
| 2795 | if (who && !is_muted(snac, who)) { | 2812 | if (who && !is_muted(snac, who)) { |
| 2796 | /* bring the actor */ | 2813 | /* bring the actor */ |
| 2797 | xs *who_o = NULL; | 2814 | xs *who_o = NULL; |
| @@ -1695,7 +1695,7 @@ xs_html *html_top_controls(snac *user) | |||
| 1695 | xs_html_text(L("Languages you usually post in:")), | 1695 | xs_html_text(L("Languages you usually post in:")), |
| 1696 | xs_html_sctag("br", NULL), | 1696 | xs_html_sctag("br", NULL), |
| 1697 | xs_html_sctag("input", | 1697 | xs_html_sctag("input", |
| 1698 | xs_html_attr("type", "next"), | 1698 | xs_html_attr("type", "text"), |
| 1699 | xs_html_attr("name", "post_langs"), | 1699 | xs_html_attr("name", "post_langs"), |
| 1700 | xs_html_attr("value", post_langs), | 1700 | xs_html_attr("value", post_langs), |
| 1701 | xs_html_attr("placeholder", L("en fr es de_AT")))), | 1701 | xs_html_attr("placeholder", L("en fr es de_AT")))), |
| @@ -2394,6 +2394,23 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2394 | /* c contains sanitized HTML */ | 2394 | /* c contains sanitized HTML */ |
| 2395 | xs_html_add(snac_content, | 2395 | xs_html_add(snac_content, |
| 2396 | xs_html_raw(c)); | 2396 | xs_html_raw(c)); |
| 2397 | |||
| 2398 | /* quoted post */ | ||
| 2399 | const char *quoted_id = xs_or(xs_dict_get(msg, "quoteUri"), xs_dict_get(msg, "quoteUrl")); | ||
| 2400 | |||
| 2401 | if (xs_is_string(quoted_id) && xs_match(quoted_id, "https://*|http://*")) { /** **/ | ||
| 2402 | xs *quoted_post = NULL; | ||
| 2403 | |||
| 2404 | if (valid_status(object_get(quoted_id, "ed_post))) { | ||
| 2405 | xs_html_add(snac_content, | ||
| 2406 | xs_html_tag("blockquote", | ||
| 2407 | xs_html_attr("class", "snac-quoted-post"), | ||
| 2408 | html_entry(user, quoted_post, 1, 1, NULL, 1))); | ||
| 2409 | } | ||
| 2410 | else | ||
| 2411 | if (user) | ||
| 2412 | enqueue_object_request(user, quoted_id, 0); | ||
| 2413 | } | ||
| 2397 | } | 2414 | } |
| 2398 | 2415 | ||
| 2399 | if (strcmp(type, "Question") == 0) { /** question content **/ | 2416 | if (strcmp(type, "Question") == 0) { /** question content **/ |
| @@ -3221,7 +3238,7 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only, | |||
| 3221 | continue; | 3238 | continue; |
| 3222 | } | 3239 | } |
| 3223 | /* hide non-public posts viewed from outside */ | 3240 | /* hide non-public posts viewed from outside */ |
| 3224 | if (read_only && scope != SCOPE_PUBLIC){ | 3241 | if (read_only && (scope != SCOPE_PUBLIC && scope != SCOPE_UNLISTED)) { |
| 3225 | continue; | 3242 | continue; |
| 3226 | } | 3243 | } |
| 3227 | 3244 | ||
| @@ -3650,9 +3667,13 @@ xs_str *html_notifications(snac *user, int skip, int show) | |||
| 3650 | 3667 | ||
| 3651 | if (valid_status(actor_get(actor_id, &actor))) | 3668 | if (valid_status(actor_get(actor_id, &actor))) |
| 3652 | a_name = actor_name(actor, proxy); | 3669 | a_name = actor_name(actor, proxy); |
| 3653 | else | 3670 | else { |
| 3654 | a_name = xs_dup(actor_id); | 3671 | a_name = xs_dup(actor_id); |
| 3655 | 3672 | ||
| 3673 | /* actor not here: request it */ | ||
| 3674 | enqueue_actor_refresh(user, actor_id, 0); | ||
| 3675 | } | ||
| 3676 | |||
| 3656 | xs *label_sanitized = sanitize(type); | 3677 | xs *label_sanitized = sanitize(type); |
| 3657 | const char *label = label_sanitized; | 3678 | const char *label = label_sanitized; |
| 3658 | 3679 | ||
diff --git a/po/de_DE.po b/po/de_DE.po index 147f7ac..bb6876c 100644 --- a/po/de_DE.po +++ b/po/de_DE.po | |||
| @@ -782,20 +782,20 @@ msgstr "en fr es de_DE" | |||
| 782 | 782 | ||
| 783 | #: html.c:460 | 783 | #: html.c:460 |
| 784 | msgid "Visibility: " | 784 | msgid "Visibility: " |
| 785 | msgstr "" | 785 | msgstr "Sichtbarkeit" |
| 786 | 786 | ||
| 787 | #: html.c:468 | 787 | #: html.c:468 |
| 788 | msgid "Public" | 788 | msgid "Public" |
| 789 | msgstr "" | 789 | msgstr "Öffentlich" |
| 790 | 790 | ||
| 791 | #: html.c:477 | 791 | #: html.c:477 |
| 792 | msgid "Unlisted" | 792 | msgid "Unlisted" |
| 793 | msgstr "" | 793 | msgstr "Ungelistete" |
| 794 | 794 | ||
| 795 | #: html.c:486 | 795 | #: html.c:486 |
| 796 | msgid "Followers-only" | 796 | msgid "Followers-only" |
| 797 | msgstr "" | 797 | msgstr "Nur Follower" |
| 798 | 798 | ||
| 799 | #: html.c:495 | 799 | #: html.c:495 |
| 800 | msgid "Direct Message" | 800 | msgid "Direct Message" |
| 801 | msgstr "" | 801 | msgstr "Direktnachricht" |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* snac - A simple, minimalistic ActivityPub instance */ | 1 | /* snac - A simple, minimalistic ActivityPub instance */ |
| 2 | /* copyright (c) 2022 - 2025 grunfink et al. / MIT license */ | 2 | /* copyright (c) 2022 - 2025 grunfink et al. / MIT license */ |
| 3 | 3 | ||
| 4 | #define VERSION "2.84" | 4 | #define VERSION "2.85-dev" |
| 5 | 5 | ||
| 6 | #define USER_AGENT "snac/" VERSION | 6 | #define USER_AGENT "snac/" VERSION |
| 7 | 7 | ||
diff --git a/webfinger.c b/webfinger.c index 12ec42c..1ce5e76 100644 --- a/webfinger.c +++ b/webfinger.c | |||
| @@ -76,9 +76,9 @@ int webfinger_request_signed(snac *snac, const char *qs, xs_str **actor, xs_str | |||
| 76 | xs *url = xs_fmt("%s:/" "/%s/.well-known/webfinger?resource=%s", proto, host, resource); | 76 | xs *url = xs_fmt("%s:/" "/%s/.well-known/webfinger?resource=%s", proto, host, resource); |
| 77 | 77 | ||
| 78 | if (snac == NULL) | 78 | if (snac == NULL) |
| 79 | xs_http_request("GET", url, headers, NULL, 0, &status, &payload, &p_size, 0); | 79 | xs_free(xs_http_request("GET", url, headers, NULL, 0, &status, &payload, &p_size, 0)); |
| 80 | else | 80 | else |
| 81 | http_signed_request(snac, "GET", url, headers, NULL, 0, &status, &payload, &p_size, 0); | 81 | xs_free(http_signed_request(snac, "GET", url, headers, NULL, 0, &status, &payload, &p_size, 0)); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | if (obj == NULL && valid_status(status) && payload) { | 84 | if (obj == NULL && valid_status(status) && payload) { |