New function default_avatar_base64().

This commit is contained in:
default 2023-01-27 18:17:11 +01:00
parent 0607ebc201
commit a3ed2408fc
4 changed files with 20 additions and 13 deletions

View file

@ -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 */
{

3
html.c
View file

@ -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("<p><img class=\"snac-avatar\" src=\"%s\" alt=\"\" "
@ -558,7 +558,6 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, cons
char *actor;
int sensitive = 0;
char *v;
xs *likes = NULL;
xs *boosts = NULL;
/* do not show non-public messages in the public timeline */

10
httpd.c
View file

@ -14,14 +14,6 @@
#include <setjmp.h>
#include <pthread.h>
/* 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

4
snac.h
View file

@ -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);