Przeglądaj źródła

More webmention hook tweaks.

grunfink 1 rok temu
rodzic
commit
9403fb41ef
2 zmienionych plików z 13 dodań i 7 usunięć
  1. 7 0
      html.c
  2. 6 7
      httpd.c

+ 7 - 0
html.c

@@ -3531,6 +3531,13 @@ xs_str *html_notifications(snac *user, int skip, int show)
                             xs_html_text(L("Context")))),
                             xs_html_text(L("Context")))),
                     h);
                     h);
             }
             }
+            else
+                xs_html_add(entry,
+                    xs_html_tag("p",
+                        xs_html_text(L("Location: ")),
+                        xs_html_tag("a",
+                            xs_html_attr("href", id),
+                            xs_html_text(id))));
         }
         }
 
 
         if (strcmp(v, n_time) > 0) {
         if (strcmp(v, n_time) > 0) {

+ 6 - 7
httpd.c

@@ -407,11 +407,6 @@ int server_post_handler(const xs_dict *req, const char *q_path,
             return status;
             return status;
         }
         }
 
 
-        if (!object_here(target)) {
-            srv_debug(0, xs_fmt("webmention-hook target %s not / no longer here", target));
-            return status;
-        }
-
         /* get the user */
         /* get the user */
         xs *s1 = xs_replace(target, srv_baseurl, "");
         xs *s1 = xs_replace(target, srv_baseurl, "");
 
 
@@ -419,13 +414,17 @@ int server_post_handler(const xs_dict *req, const char *q_path,
         const char *uid = xs_list_get(l1, 1);
         const char *uid = xs_list_get(l1, 1);
         snac user;
         snac user;
 
 
-        if (!xs_is_string(uid) || !user_open(&user, uid))
+        if (!xs_is_string(uid) || !user_open(&user, uid)) {
+            srv_debug(1, xs_fmt("webmention-hook cannot find user for %s", target));
             return status;
             return status;
+        }
 
 
         int r = xs_webmention_hook(source, target, USER_AGENT);
         int r = xs_webmention_hook(source, target, USER_AGENT);
 
 
-        if (r > 0)
+        if (r > 0) {
             notify_add(&user, "Webmention", NULL, source, target, xs_stock(XSTYPE_DICT));
             notify_add(&user, "Webmention", NULL, source, target, xs_stock(XSTYPE_DICT));
+            timeline_touch(&user);
+        }
 
 
         srv_log(xs_fmt("webmention-hook source=%s target=%s %d", source, target, r));
         srv_log(xs_fmt("webmention-hook source=%s target=%s %d", source, target, r));