From 442b46abc0afeedfeffba7f5317fa5b350ef9c56 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 17 Nov 2024 10:53:47 +0100 Subject: mastoapi: added more checks in the notifications code. --- mastoapi.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c index c9d71b9..f80c730 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -1784,6 +1784,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, mn = xs_dict_append(mn, "created_at", xs_dict_get(noti, "date")); xs *acct = mastoapi_account(&snac1, actor); + + if (acct == NULL) + continue; + mn = xs_dict_append(mn, "account", acct); if (strcmp(type, "follow") != 0 && !xs_is_null(objid)) { -- cgit v1.2.3 From 437829a83376b9094689469d7d4c30eab48f556e Mon Sep 17 00:00:00 2001 From: default Date: Sun, 17 Nov 2024 11:08:25 +0100 Subject: mastoapi: more tweaks to notifications code. --- mastoapi.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c index f80c730..73b9a8b 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -1727,11 +1727,11 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, if (logged_in) { xs *l = notify_list(&snac1, 0, 64); xs *out = xs_list_new(); - xs_list *p = l; const xs_dict *v; const xs_list *excl = xs_dict_get(args, "exclude_types[]"); + const char *max_id = xs_dict_get(args, "max_id"); - while (xs_list_iter(&p, &v)) { + xs_list_foreach(l, v) { xs *noti = notify_get(&snac1, v); if (noti == NULL) @@ -1740,6 +1740,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, const char *type = xs_dict_get(noti, "type"); const char *utype = xs_dict_get(noti, "utype"); const char *objid = xs_dict_get(noti, "objid"); + const char *id = xs_dict_get(noti, "id"); + xs *fid = xs_replace(id, ".", ""); xs *actor = NULL; xs *entry = NULL; @@ -1752,6 +1754,13 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, if (is_hidden(&snac1, objid)) continue; + if (max_id) { + if (strcmp(fid, max_id) == 0) + max_id = NULL; + + continue; + } + /* convert the type */ if (strcmp(type, "Like") == 0 || strcmp(type, "EmojiReact") == 0) type = "favourite"; @@ -1778,8 +1787,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, mn = xs_dict_append(mn, "type", type); - xs *id = xs_replace(xs_dict_get(noti, "id"), ".", ""); - mn = xs_dict_append(mn, "id", id); + mn = xs_dict_append(mn, "id", fid); mn = xs_dict_append(mn, "created_at", xs_dict_get(noti, "date")); -- cgit v1.2.3 From a7974cbaa7037292c8883271fc2d0983698882a6 Mon Sep 17 00:00:00 2001 From: François Kooman Date: Mon, 18 Nov 2024 11:46:14 +0100 Subject: do not autocapitalize "Login: " masto api field on Chrome/Safari the Mastodon API OAuth login page auto capitalizes the first char of the "Login: " field. This disabled that. --- mastoapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c index c9d71b9..076f8aa 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -171,7 +171,7 @@ const char *login_page = "" "