summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activitypub.c22
-rw-r--r--data.c4
2 files changed, 16 insertions, 10 deletions
diff --git a/activitypub.c b/activitypub.c
index e2a40c8..b6a07c9 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -354,18 +354,22 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level)
354 if (xs_match(type, "Note|Page|Article|Video")) { 354 if (xs_match(type, "Note|Page|Article|Video")) {
355 const char *actor = get_atto(object); 355 const char *actor = get_atto(object);
356 356
357 /* request (and drop) the actor for this entry */ 357 if (content_check("filter_reject.txt", object))
358 if (!xs_is_null(actor)) 358 snac_log(snac, xs_fmt("timeline_request rejected by content %s", nid));
359 actor_request(snac, actor, NULL); 359 else {
360 /* request (and drop) the actor for this entry */
361 if (!xs_is_null(actor))
362 actor_request(snac, actor, NULL);
360 363
361 /* does it have an ancestor? */ 364 /* does it have an ancestor? */
362 char *in_reply_to = xs_dict_get(object, "inReplyTo"); 365 char *in_reply_to = xs_dict_get(object, "inReplyTo");
363 366
364 /* store */ 367 /* store */
365 timeline_add(snac, nid, object); 368 timeline_add(snac, nid, object);
366 369
367 /* recurse! */ 370 /* recurse! */
368 timeline_request(snac, &in_reply_to, NULL, level + 1); 371 timeline_request(snac, &in_reply_to, NULL, level + 1);
372 }
369 } 373 }
370 } 374 }
371 } 375 }
diff --git a/data.c b/data.c
index 67536fd..44ce628 100644
--- a/data.c
+++ b/data.c
@@ -2010,7 +2010,8 @@ int instance_unblock(const char *instance)
2010/** content filtering **/ 2010/** content filtering **/
2011 2011
2012int content_check(const char *file, const xs_dict *msg) 2012int content_check(const char *file, const xs_dict *msg)
2013/* checks if message content matches any of the regexes in file */ 2013/* checks if a message's content matches any of the regexes in file */
2014/* file format: one regex per line */
2014{ 2015{
2015 xs *fn = xs_fmt("%s/%s", srv_basedir, file); 2016 xs *fn = xs_fmt("%s/%s", srv_basedir, file);
2016 FILE *f; 2017 FILE *f;
@@ -2021,6 +2022,7 @@ int content_check(const char *file, const xs_dict *msg)
2021 if ((f = fopen(fn, "r")) != NULL) { 2022 if ((f = fopen(fn, "r")) != NULL) {
2022 srv_debug(1, xs_fmt("content_check: loading regexes from %s", fn)); 2023 srv_debug(1, xs_fmt("content_check: loading regexes from %s", fn));
2023 2024
2025 /* massage content (strip HTML tags, etc.) */
2024 xs *c = xs_regex_replace(v, "<[^>]+>", " "); 2026 xs *c = xs_regex_replace(v, "<[^>]+>", " ");
2025 c = xs_regex_replace_i(c, " {2,}", " "); 2027 c = xs_regex_replace_i(c, " {2,}", " ");
2026 c = xs_tolower_i(c); 2028 c = xs_tolower_i(c);