commit 9403fb4

grunfink  ·  2025-06-24 12:34:55 +0000 UTC
parent 1aa8fe8
More webmention hook tweaks.
2 files changed,  +13, -7
M html.c
M html.c
+7, -0
 1@@ -3531,6 +3531,13 @@ xs_str *html_notifications(snac *user, int skip, int show)
 2                             xs_html_text(L("Context")))),
 3                     h);
 4             }
 5+            else
 6+                xs_html_add(entry,
 7+                    xs_html_tag("p",
 8+                        xs_html_text(L("Location: ")),
 9+                        xs_html_tag("a",
10+                            xs_html_attr("href", id),
11+                            xs_html_text(id))));
12         }
13 
14         if (strcmp(v, n_time) > 0) {
+6, -7
 1@@ -407,11 +407,6 @@ int server_post_handler(const xs_dict *req, const char *q_path,
 2             return status;
 3         }
 4 
 5-        if (!object_here(target)) {
 6-            srv_debug(0, xs_fmt("webmention-hook target %s not / no longer here", target));
 7-            return status;
 8-        }
 9-
10         /* get the user */
11         xs *s1 = xs_replace(target, srv_baseurl, "");
12 
13@@ -419,13 +414,17 @@ int server_post_handler(const xs_dict *req, const char *q_path,
14         const char *uid = xs_list_get(l1, 1);
15         snac user;
16 
17-        if (!xs_is_string(uid) || !user_open(&user, uid))
18+        if (!xs_is_string(uid) || !user_open(&user, uid)) {
19+            srv_debug(1, xs_fmt("webmention-hook cannot find user for %s", target));
20             return status;
21+        }
22 
23         int r = xs_webmention_hook(source, target, USER_AGENT);
24 
25-        if (r > 0)
26+        if (r > 0) {
27             notify_add(&user, "Webmention", NULL, source, target, xs_stock(XSTYPE_DICT));
28+            timeline_touch(&user);
29+        }
30 
31         srv_log(xs_fmt("webmention-hook source=%s target=%s %d", source, target, r));
32