From a3ed2408fcaca25ad4966741e173677aab0a8848 Mon Sep 17 00:00:00 2001 From: default Date: Fri, 27 Jan 2023 18:17:11 +0100 Subject: [PATCH] New function default_avatar_base64(). --- activitypub.c | 16 ++++++++++++++++ html.c | 3 +-- httpd.c | 10 +--------- snac.h | 4 ++-- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/activitypub.c b/activitypub.c index 1394235..949de47 100644 --- a/activitypub.c +++ b/activitypub.c @@ -17,6 +17,22 @@ const char *public_address = "https:/" "/www.w3.org/ns/activitystreams#Public"; +/* susie.png */ +const char *susie = + "iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAQAAAAC" + "CEkxzAAAAUUlEQVQoz43R0QkAMQwCUDdw/y3dwE" + "vsvzlL4X1IoQkAisKmwfAFT3RgJHbQezpSRoXEq" + "eqCL9BJBf7h3QbOCCxV5EVWMEMwG7K1/WODtlvx" + "AYTtEsDU9F34AAAAAElFTkSuQmCC"; + + +const char *default_avatar_base64(void) +/* returns the default avatar in base64 */ +{ + return susie; +} + + int activitypub_request(snac *snac, char *url, d_char **data) /* request an object */ { diff --git a/html.c b/html.c index 2abb68e..dde2cf7 100644 --- a/html.c +++ b/html.c @@ -82,7 +82,7 @@ d_char *html_actor_icon(snac *snac, d_char *os, char *actor, } if (avatar == NULL) - avatar = xs_fmt("data:image/png;base64, %s", susie); + avatar = xs_fmt("data:image/png;base64, %s", default_avatar_base64()); { xs *s1 = xs_fmt("

\"\" #include -/* susie.png */ -const char *susie = - "iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAQAAAAC" - "CEkxzAAAAUUlEQVQoz43R0QkAMQwCUDdw/y3dwE" - "vsvzlL4X1IoQkAisKmwfAFT3RgJHbQezpSRoXEq" - "eqCL9BJBf7h3QbOCCxV5EVWMEMwG7K1/WODtlvx" - "AYTtEsDU9F34AAAAAElFTkSuQmCC"; - /* nodeinfo 2.0 template */ const char *nodeinfo_2_0_template = "" @@ -99,7 +91,7 @@ int server_get_handler(d_char *req, char *q_path, else if (strcmp(q_path, "/susie.png") == 0 || strcmp(q_path, "/favicon.ico") == 0 ) { status = 200; - *body = xs_base64_dec(susie, b_size); + *body = xs_base64_dec(default_avatar_base64(), b_size); *ctype = "image/png"; } else diff --git a/snac.h b/snac.h index b03fd4a..a6f8661 100644 --- a/snac.h +++ b/snac.h @@ -13,8 +13,6 @@ extern int srv_running; extern int dbglevel; -extern const char *susie; - #define L(s) (s) int valid_status(int status); @@ -148,6 +146,8 @@ int webfinger_request(char *qs, char **actor, char **user); int webfinger_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype); +const char *default_avatar_base64(void); + d_char *msg_admiration(snac *snac, char *object, char *type); d_char *msg_create(snac *snac, char *object); d_char *msg_follow(snac *snac, char *actor);