From 29caa37fd768df07de98c292c6db3196906cbf98 Mon Sep 17 00:00:00 2001 From: default Date: Sat, 16 Nov 2024 07:25:25 +0100 Subject: Allow underscores in hashtags. --- activitypub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activitypub.c b/activitypub.c index 0b2fc6a..031b9ac 100644 --- a/activitypub.c +++ b/activitypub.c @@ -724,7 +724,7 @@ xs_str *process_tags(snac *snac, const char *content, xs_list **tag) /* use this same server */ def_srv = xs_dup(xs_dict_get(srv_config, "host")); - split = xs_regex_split(content, "(@[A-Za-z0-9_]+(@[A-Za-z0-9\\.-]+)?|[0-9]+;|#[^[:punct:][:space:]]+)"); + split = xs_regex_split(content, "(@[A-Za-z0-9_]+(@[A-Za-z0-9\\.-]+)?|[0-9]+;|#(_|[^[:punct:][:space:]])+)"); p = split; while (xs_list_iter(&p, &v)) { -- cgit v1.2.3 From 90a959cb858711ea1dd9a802a4f86991abc1c904 Mon Sep 17 00:00:00 2001 From: default Date: Sat, 16 Nov 2024 07:26:44 +0100 Subject: Updated TODO. --- TODO.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TODO.md b/TODO.md index 619364c..5054b1f 100644 --- a/TODO.md +++ b/TODO.md @@ -357,3 +357,7 @@ Fix a crash when posting from the links browser (2.63, 2024-11-08T15:57:25+0100) Fix some repeated images in Lemmy posts (2.63, 2024-11-08T15:57:25+0100). Fix a crash when posting an image from the tooot mobile app (2.63, 2024-11-11T19:42:11+0100). + +Fix some URL proxying (2.64, 2024-11-16T07:26:23+0100). + +Allow underscores in hashtags (2.64, 2024-11-16T07:26:23+0100). -- cgit v1.2.3 From 0858f57d8a17aac6c2ca7fc2fc6b7008486293fe Mon Sep 17 00:00:00 2001 From: default Date: Sun, 17 Nov 2024 10:09:41 +0100 Subject: Updated TODO. --- TODO.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TODO.md b/TODO.md index 5054b1f..5e0a302 100644 --- a/TODO.md +++ b/TODO.md @@ -16,6 +16,8 @@ Important: deleting a follower should do more that just delete the object, see h ## Wishlist +Add a pidfile. + Implement Proxying for Media Links to Enhance User Privacy (see https://codeberg.org/grunfink/snac2/issues/219 for more information). Consider showing only posts by the account owner (not full trees) (see https://codeberg.org/grunfink/snac2/issues/217 for more information). -- cgit v1.2.3 From 876c892960c7e45daf62369ea58f47ad42bfb98e Mon Sep 17 00:00:00 2001 From: default Date: Sun, 17 Nov 2024 10:21:15 +0100 Subject: The server creates a pidfile inside the base directory. --- httpd.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/httpd.c b/httpd.c index 1613e1f..81d2f9e 100644 --- a/httpd.c +++ b/httpd.c @@ -774,6 +774,7 @@ void httpd(void) xs *sem_name = NULL; xs *shm_name = NULL; sem_t anon_job_sem; + xs *pidfile = xs_fmt("%s/server.pid", srv_basedir); address = xs_dict_get(srv_config, "address"); @@ -809,6 +810,17 @@ void httpd(void) srv_log(xs_fmt("httpd%s start %s %s", p_state->use_fcgi ? " (FastCGI)" : "", full_address, USER_AGENT)); + { + FILE *f; + + if ((f = fopen(pidfile, "w")) != NULL) { + fprintf(f, "%d\n", getpid()); + fclose(f); + } + else + srv_log(xs_fmt("Cannot create %s: %s", pidfile, strerror(errno))); + } + /* show the number of usable file descriptors */ struct rlimit r; getrlimit(RLIMIT_NOFILE, &r); @@ -894,4 +906,6 @@ void httpd(void) srv_log(xs_fmt("httpd%s stop %s (run time: %s)", p_state->use_fcgi ? " (FastCGI)" : "", full_address, uptime)); + + unlink(pidfile); } -- cgit v1.2.3 From ec5ba68d00a5db05f61f539a6cde9d9906388e83 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 17 Nov 2024 10:21:51 +0100 Subject: Updated TODO. --- TODO.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index 5e0a302..0d8c64d 100644 --- a/TODO.md +++ b/TODO.md @@ -16,8 +16,6 @@ Important: deleting a follower should do more that just delete the object, see h ## Wishlist -Add a pidfile. - Implement Proxying for Media Links to Enhance User Privacy (see https://codeberg.org/grunfink/snac2/issues/219 for more information). Consider showing only posts by the account owner (not full trees) (see https://codeberg.org/grunfink/snac2/issues/217 for more information). @@ -363,3 +361,5 @@ Fix a crash when posting an image from the tooot mobile app (2.63, 2024-11-11T19 Fix some URL proxying (2.64, 2024-11-16T07:26:23+0100). Allow underscores in hashtags (2.64, 2024-11-16T07:26:23+0100). + +Add a pidfile (2.64, 2024-11-17T10:21:29+0100). -- cgit v1.2.3 From 2416945748994def6a96163a939348a22ad541a3 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 17 Nov 2024 10:23:43 +0100 Subject: In the insert cmdline op, don't re-add if it's already in the timeline. --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index c6fff5f..c285fac 100644 --- a/main.c +++ b/main.c @@ -558,7 +558,11 @@ int main(int argc, char *argv[]) if (data != NULL) { xs_json_dump(data, 4, stdout); enqueue_actor_refresh(&snac, xs_dict_get(data, "attributedTo"), 0); - timeline_add(&snac, url, data); + + if (!timeline_here(&snac, url)) + timeline_add(&snac, url, data); + else + printf("Post %s already here\n", url); } return 0; -- cgit v1.2.3 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(+) 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(-) 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(-) 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 = "" "