diff options
| author | 2024-05-09 09:24:39 +0200 | |
|---|---|---|
| committer | 2024-05-09 09:24:39 +0200 | |
| commit | 8de93b9cd72ef0cde8b5bb620f376e9b926354dd (patch) | |
| tree | cba2cbb5058190a401ea47379f7b01c8de143de6 /mastoapi.c | |
| parent | mastoapi: Added content search. (diff) | |
| download | penes-snac2-8de93b9cd72ef0cde8b5bb620f376e9b926354dd.tar.gz penes-snac2-8de93b9cd72ef0cde8b5bb620f376e9b926354dd.tar.xz penes-snac2-8de93b9cd72ef0cde8b5bb620f376e9b926354dd.zip | |
mastoapi: some search by content tweaks.
Diffstat (limited to '')
| -rw-r--r-- | mastoapi.c | 13 |
1 files changed, 4 insertions, 9 deletions
| @@ -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 | } |