summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2022-10-24 20:06:02 +0200
committerGravatar default2022-10-24 20:06:02 +0200
commitd2095105de3fe8c3397df7d46a9d61011b74c09e (patch)
tree743600f6c31479d1012d6e77ef4de666e7de51ca
parentUpdated dependencies. (diff)
downloadsnac2-d2095105de3fe8c3397df7d46a9d61011b74c09e.tar.gz
snac2-d2095105de3fe8c3397df7d46a9d61011b74c09e.tar.xz
snac2-d2095105de3fe8c3397df7d46a9d61011b74c09e.zip
Don't load unneeded actor info in html_entry().
-rw-r--r--data.c13
-rw-r--r--html.c6
-rw-r--r--httpd.c16
3 files changed, 16 insertions, 19 deletions
diff --git a/data.c b/data.c
index 7b623af..4771190 100644
--- a/data.c
+++ b/data.c
@@ -796,16 +796,17 @@ int actor_get(snac *snac, char *actor, d_char **data)
796 status = 200; 796 status = 200;
797 } 797 }
798 798
799 if ((f = fopen(fn, "r")) != NULL) { 799 if (data) {
800 xs *j = xs_readall(f); 800 if ((f = fopen(fn, "r")) != NULL) {
801 xs *j = xs_readall(f);
801 802
802 fclose(f); 803 fclose(f);
803 804
804 if (data)
805 *data = xs_json_loads(j); 805 *data = xs_json_loads(j);
806 }
807 else
808 status = 500;
806 } 809 }
807 else
808 status = 500;
809 810
810 return status; 811 return status;
811} 812}
diff --git a/html.c b/html.c
index 9cf0815..bc84d07 100644
--- a/html.c
+++ b/html.c
@@ -443,7 +443,6 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i
443 char *id = xs_dict_get(msg, "id"); 443 char *id = xs_dict_get(msg, "id");
444 char *type = xs_dict_get(msg, "type"); 444 char *type = xs_dict_get(msg, "type");
445 char *meta = xs_dict_get(msg, "_snac"); 445 char *meta = xs_dict_get(msg, "_snac");
446 xs *actor_o = NULL;
447 char *actor; 446 char *actor;
448 447
449 /* do not show non-public messages in the public timeline */ 448 /* do not show non-public messages in the public timeline */
@@ -477,10 +476,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i
477 if (is_muted(snac, actor)) 476 if (is_muted(snac, actor))
478 return os; 477 return os;
479 478
480 if (strcmp(actor, snac->actor) == 0) 479 if (strcmp(actor, snac->actor) != 0 && !valid_status(actor_get(snac, actor, NULL)))
481 actor_o = msg_actor(snac);
482 else
483 if (!valid_status(actor_get(snac, actor, &actor_o)))
484 return os; 480 return os;
485 481
486 /* if this is our post, add the score */ 482 /* if this is our post, add the score */
diff --git a/httpd.c b/httpd.c
index a365b4d..d7fad93 100644
--- a/httpd.c
+++ b/httpd.c
@@ -98,14 +98,14 @@ void httpd_connection(FILE *f)
98{ 98{
99 xs *req; 99 xs *req;
100 char *method; 100 char *method;
101 int status = 0; 101 int status = 0;
102 char *body = NULL; 102 d_char *body = NULL;
103 int b_size = 0; 103 int b_size = 0;
104 char *ctype = NULL; 104 char *ctype = NULL;
105 xs *headers = NULL; 105 xs *headers = NULL;
106 xs *q_path = NULL; 106 xs *q_path = NULL;
107 xs *payload = NULL; 107 xs *payload = NULL;
108 int p_size = 0; 108 int p_size = 0;
109 char *p; 109 char *p;
110 110
111 req = xs_httpd_request(f, &payload, &p_size); 111 req = xs_httpd_request(f, &payload, &p_size);