diff options
| author | 2025-06-08 03:20:18 +0000 | |
|---|---|---|
| committer | 2025-07-05 21:19:50 +0000 | |
| commit | 881e4b4dd05670c193ae9389253355bc1d7f6859 (patch) | |
| tree | e870c3fe6397f266522b7313dc32463357ea932e /html.c | |
| parent | Differentiate the version from upstream (diff) | |
| download | penes-snac2-881e4b4dd05670c193ae9389253355bc1d7f6859.tar.gz penes-snac2-881e4b4dd05670c193ae9389253355bc1d7f6859.tar.xz penes-snac2-881e4b4dd05670c193ae9389253355bc1d7f6859.zip | |
Add missing quoteUrl to the body of the message.ukko-2.79
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 32 |
1 files changed, 30 insertions, 2 deletions
| @@ -1921,6 +1921,31 @@ xs_html *html_entry_controls(snac *user, const char *actor, | |||
| 1921 | } | 1921 | } |
| 1922 | 1922 | ||
| 1923 | 1923 | ||
| 1924 | static void | ||
| 1925 | addQuoteUrl(xs_html* snac_content, xs_dict* msg, const char* content) | ||
| 1926 | { | ||
| 1927 | /* https://www.w3.org/ns/activitystreams#quoteUrl */ | ||
| 1928 | const char* quoteUri = xs_dict_get(msg, "quoteUrl"); | ||
| 1929 | if (!xs_is_string(quoteUri)) { | ||
| 1930 | /* http://fedibird.com/ns#quoteUri */ | ||
| 1931 | quoteUri = xs_dict_get(msg, "quoteUri"); | ||
| 1932 | } | ||
| 1933 | |||
| 1934 | // TODO: This should probably be a better check | ||
| 1935 | if (!xs_is_string(quoteUri) || xs_str_in(content, quoteUri) != -1) { | ||
| 1936 | return; | ||
| 1937 | } | ||
| 1938 | |||
| 1939 | xs_html_add(snac_content, | ||
| 1940 | xs_html_sctag("hr", NULL), | ||
| 1941 | xs_html_tag("p", | ||
| 1942 | xs_html_tag("a", | ||
| 1943 | xs_html_attr("href", quoteUri), | ||
| 1944 | xs_html_attr("target", "_blank"), | ||
| 1945 | xs_html_text("THIS FUCKER'S INSTANCE CAN'T DO “RE: URL”!")))); | ||
| 1946 | } | ||
| 1947 | |||
| 1948 | |||
| 1924 | xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | 1949 | xs_html *html_entry(snac *user, xs_dict *msg, int read_only, |
| 1925 | int level, const char *md5, int hide_children) | 1950 | int level, const char *md5, int hide_children) |
| 1926 | { | 1951 | { |
| @@ -2418,6 +2443,11 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2418 | poll); | 2443 | poll); |
| 2419 | } | 2444 | } |
| 2420 | 2445 | ||
| 2446 | const char *content = xs_dict_get(msg, "content"); | ||
| 2447 | |||
| 2448 | /* Add a RE: <quoted post URL> if it doesn't exist already */ | ||
| 2449 | addQuoteUrl(snac_content, msg, content); | ||
| 2450 | |||
| 2421 | /** attachments **/ | 2451 | /** attachments **/ |
| 2422 | xs *attach = get_attachments(msg); | 2452 | xs *attach = get_attachments(msg); |
| 2423 | 2453 | ||
| @@ -2429,8 +2459,6 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2429 | xs_html_add(snac_content, | 2459 | xs_html_add(snac_content, |
| 2430 | content_attachments); | 2460 | content_attachments); |
| 2431 | 2461 | ||
| 2432 | const char *content = xs_dict_get(msg, "content"); | ||
| 2433 | |||
| 2434 | int c = 0; | 2462 | int c = 0; |
| 2435 | const xs_dict *a; | 2463 | const xs_dict *a; |
| 2436 | while (xs_list_next(attach, &a, &c)) { | 2464 | while (xs_list_next(attach, &a, &c)) { |