diff options
| -rw-r--r-- | data.c | 4 | ||||
| -rw-r--r-- | mastoapi.c | 13 |
2 files changed, 6 insertions, 11 deletions
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "xs_set.h" | 10 | #include "xs_set.h" |
| 11 | #include "xs_time.h" | 11 | #include "xs_time.h" |
| 12 | #include "xs_regex.h" | 12 | #include "xs_regex.h" |
| 13 | #include "xs_match.h" | ||
| 13 | 14 | ||
| 14 | #include "snac.h" | 15 | #include "snac.h" |
| 15 | 16 | ||
| @@ -2570,8 +2571,7 @@ xs_list *content_search(snac *user, const char *regex, int priv, int max_secs, i | |||
| 2570 | if (!valid_status(timeline_get_by_md5(user, md5, &post))) | 2571 | if (!valid_status(timeline_get_by_md5(user, md5, &post))) |
| 2571 | continue; | 2572 | continue; |
| 2572 | 2573 | ||
| 2573 | /* must be a Note */ | 2574 | if (!xs_match(xs_dict_get_def(post, "type", "-"), "Note|Question|Page|Article|Video")) |
| 2574 | if (strcmp(xs_dict_get_def(post, "type", ""), "Note")) | ||
| 2575 | continue; | 2575 | continue; |
| 2576 | 2576 | ||
| 2577 | char *content = xs_dict_get(post, "content"); | 2577 | char *content = xs_dict_get(post, "content"); |
| @@ -1467,9 +1467,6 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1467 | if (limit == 0) | 1467 | if (limit == 0) |
| 1468 | limit = 20; | 1468 | limit = 20; |
| 1469 | 1469 | ||
| 1470 | xs *ja = xs_json_dumps(args, 0); | ||
| 1471 | snac_debug(&snac1, 1, xs_fmt("/v1/timelines/home: args='%s'", ja)); | ||
| 1472 | |||
| 1473 | xs *timeline = timeline_simple_list(&snac1, "private", 0, 2048); | 1470 | xs *timeline = timeline_simple_list(&snac1, "private", 0, 2048); |
| 1474 | 1471 | ||
| 1475 | xs *out = xs_list_new(); | 1472 | xs *out = xs_list_new(); |
| @@ -2266,20 +2263,18 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 2266 | xs *tl = content_search(&snac1, q, 1, 0, &to); | 2263 | xs *tl = content_search(&snac1, q, 1, 0, &to); |
| 2267 | int c = 0; | 2264 | int c = 0; |
| 2268 | char *v; | 2265 | char *v; |
| 2266 | int cnt = 40; | ||
| 2269 | 2267 | ||
| 2270 | while (xs_list_next(tl, &v, &c)) { | 2268 | while (xs_list_next(tl, &v, &c) && --cnt) { |
| 2271 | xs *post = NULL; | 2269 | xs *post = NULL; |
| 2272 | 2270 | ||
| 2273 | if (!valid_status(timeline_get_by_md5(&snac1, v, &post))) | 2271 | if (!valid_status(timeline_get_by_md5(&snac1, v, &post))) |
| 2274 | continue; | 2272 | continue; |
| 2275 | 2273 | ||
| 2276 | char *type = xs_dict_get_def(post, "type", "-"); | ||
| 2277 | if (!xs_match(type, "Note|Article|Question|Page|Video")) | ||
| 2278 | continue; | ||
| 2279 | |||
| 2280 | xs *s = mastoapi_status(&snac1, post); | 2274 | xs *s = mastoapi_status(&snac1, post); |
| 2281 | 2275 | ||
| 2282 | stl = xs_list_append(stl, s); | 2276 | if (!xs_is_null(s)) |
| 2277 | stl = xs_list_append(stl, s); | ||
| 2283 | } | 2278 | } |
| 2284 | } | 2279 | } |
| 2285 | } | 2280 | } |