diff options
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c index 59a69ec..773df78 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -2836,6 +2836,8 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path, | |||
| 2836 | 2836 | ||
| 2837 | *ctype = "application/activity+json"; | 2837 | *ctype = "application/activity+json"; |
| 2838 | 2838 | ||
| 2839 | int show_contact_metrics = xs_is_true(xs_dict_get(snac.config, "show_contact_metrics")); | ||
| 2840 | |||
| 2839 | if (p_path == NULL) { | 2841 | if (p_path == NULL) { |
| 2840 | /* if there was no component after the user, it's an actor request */ | 2842 | /* if there was no component after the user, it's an actor request */ |
| 2841 | msg = msg_actor(&snac); | 2843 | msg = msg_actor(&snac); |
| @@ -2875,13 +2877,27 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path, | |||
| 2875 | } | 2877 | } |
| 2876 | else | 2878 | else |
| 2877 | if (strcmp(p_path, "followers") == 0) { | 2879 | if (strcmp(p_path, "followers") == 0) { |
| 2880 | int total = 0; | ||
| 2881 | |||
| 2882 | if (show_contact_metrics) { | ||
| 2883 | xs *l = follower_list(&snac); | ||
| 2884 | total = xs_list_len(l); | ||
| 2885 | } | ||
| 2886 | |||
| 2878 | xs *id = xs_fmt("%s/%s", snac.actor, p_path); | 2887 | xs *id = xs_fmt("%s/%s", snac.actor, p_path); |
| 2879 | msg = msg_collection(&snac, id, 0); | 2888 | msg = msg_collection(&snac, id, total); |
| 2880 | } | 2889 | } |
| 2881 | else | 2890 | else |
| 2882 | if (strcmp(p_path, "following") == 0) { | 2891 | if (strcmp(p_path, "following") == 0) { |
| 2892 | int total = 0; | ||
| 2893 | |||
| 2894 | if (show_contact_metrics) { | ||
| 2895 | xs *l = following_list(&snac); | ||
| 2896 | total = xs_list_len(l); | ||
| 2897 | } | ||
| 2898 | |||
| 2883 | xs *id = xs_fmt("%s/%s", snac.actor, p_path); | 2899 | xs *id = xs_fmt("%s/%s", snac.actor, p_path); |
| 2884 | msg = msg_collection(&snac, id, 0); | 2900 | msg = msg_collection(&snac, id, total); |
| 2885 | } | 2901 | } |
| 2886 | else | 2902 | else |
| 2887 | if (xs_startswith(p_path, "p/")) { | 2903 | if (xs_startswith(p_path, "p/")) { |