Also add the rel=me to metadata links in msg_actor().

This commit is contained in:
default 2024-02-14 23:49:45 +01:00
parent ec35ad451f
commit 09d680e7dc

View file

@ -1221,6 +1221,10 @@ xs_dict *msg_actor(snac *snac)
xs_str *k; xs_str *k;
xs_str *v; xs_str *v;
xs_dict *val_metadata = xs_dict_get(snac->config, "validated_metadata");
if (xs_is_null(val_metadata))
val_metadata = xs_stock_dict;
while (xs_dict_iter(&metadata, &k, &v)) { while (xs_dict_iter(&metadata, &k, &v)) {
xs *d = xs_dict_new(); xs *d = xs_dict_new();
@ -1228,8 +1232,13 @@ xs_dict *msg_actor(snac *snac)
xs *v2 = NULL; xs *v2 = NULL;
if (xs_startswith(v, "https:")) { if (xs_startswith(v, "https:")) {
char *val_date = xs_dict_get(val_metadata, v);
xs *t = encode_html(v); xs *t = encode_html(v);
v2 = xs_fmt("<a href=\"%s\">%s</a>", t, t);
if (xs_type(val_date) == XSTYPE_STRING && *val_date)
v2 = xs_fmt("<a href=\"%s\" rel=\"me\">%s</a>", t, t);
else
v2 = xs_fmt("<a href=\"%s\">%s</a>", t, t);
} }
else else
v2 = encode_html(v); v2 = encode_html(v);