diff options
| author | 2025-06-08 03:20:18 +0000 | |
|---|---|---|
| committer | 2025-11-02 06:40:38 +0000 | |
| commit | 062dde3a1ce0eb1619a2296e0e85aadccaa14c79 (patch) | |
| tree | 3bd2c616300e66c63dfeefefa8b85599c00576a4 | |
| parent | Differentiate the version from upstream (diff) | |
| download | penes-snac2-062dde3a1ce0eb1619a2296e0e85aadccaa14c79.tar.gz penes-snac2-062dde3a1ce0eb1619a2296e0e85aadccaa14c79.tar.xz penes-snac2-062dde3a1ce0eb1619a2296e0e85aadccaa14c79.zip | |
Add missing quoteUrl to the body of the message.ukko-2.84
| -rw-r--r-- | html.c | 32 |
1 files changed, 30 insertions, 2 deletions
| @@ -2048,6 +2048,31 @@ xs_html *html_entry_controls(snac *user, const char *actor, | |||
| 2048 | } | 2048 | } |
| 2049 | 2049 | ||
| 2050 | 2050 | ||
| 2051 | static void | ||
| 2052 | addQuoteUrl(xs_html* snac_content, xs_dict* msg, const char* content) | ||
| 2053 | { | ||
| 2054 | /* https://www.w3.org/ns/activitystreams#quoteUrl */ | ||
| 2055 | const char* quoteUri = xs_dict_get(msg, "quoteUrl"); | ||
| 2056 | if (!xs_is_string(quoteUri)) { | ||
| 2057 | /* http://fedibird.com/ns#quoteUri */ | ||
| 2058 | quoteUri = xs_dict_get(msg, "quoteUri"); | ||
| 2059 | } | ||
| 2060 | |||
| 2061 | // TODO: This should probably be a better check | ||
| 2062 | if (!xs_is_string(quoteUri) || xs_str_in(content, quoteUri) != -1) { | ||
| 2063 | return; | ||
| 2064 | } | ||
| 2065 | |||
| 2066 | xs_html_add(snac_content, | ||
| 2067 | xs_html_sctag("hr", NULL), | ||
| 2068 | xs_html_tag("p", | ||
| 2069 | xs_html_tag("a", | ||
| 2070 | xs_html_attr("href", quoteUri), | ||
| 2071 | xs_html_attr("target", "_blank"), | ||
| 2072 | xs_html_text("THIS FUCKER'S INSTANCE CAN'T DO “RE: URL”!")))); | ||
| 2073 | } | ||
| 2074 | |||
| 2075 | |||
| 2051 | xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | 2076 | xs_html *html_entry(snac *user, xs_dict *msg, int read_only, |
| 2052 | int level, const char *md5, int hide_children) | 2077 | int level, const char *md5, int hide_children) |
| 2053 | { | 2078 | { |
| @@ -2553,6 +2578,11 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2553 | poll); | 2578 | poll); |
| 2554 | } | 2579 | } |
| 2555 | 2580 | ||
| 2581 | const char *content = xs_dict_get(msg, "content"); | ||
| 2582 | |||
| 2583 | /* Add a RE: <quoted post URL> if it doesn't exist already */ | ||
| 2584 | addQuoteUrl(snac_content, msg, content); | ||
| 2585 | |||
| 2556 | /** attachments **/ | 2586 | /** attachments **/ |
| 2557 | xs *attach = get_attachments(msg); | 2587 | xs *attach = get_attachments(msg); |
| 2558 | 2588 | ||
| @@ -2564,8 +2594,6 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2564 | xs_html_add(snac_content, | 2594 | xs_html_add(snac_content, |
| 2565 | content_attachments); | 2595 | content_attachments); |
| 2566 | 2596 | ||
| 2567 | const char *content = xs_dict_get(msg, "content"); | ||
| 2568 | |||
| 2569 | int c = 0; | 2597 | int c = 0; |
| 2570 | const xs_dict *a; | 2598 | const xs_dict *a; |
| 2571 | while (xs_list_next(attach, &a, &c)) { | 2599 | while (xs_list_next(attach, &a, &c)) { |