diff --git a/html.c b/html.c
index 13c8e8b..4541571 100644
--- a/html.c
+++ b/html.c
@@ -105,7 +105,7 @@ xs_str *html_actor_icon(xs_str *os, char *actor,
{
xs *s1 = xs_fmt("%s",
- xs_dict_get(actor, "id"), name);
+ xs_dict_get(actor, "id"), xs_encode_html(name));
s = xs_str_cat(s, s1);
}
@@ -139,7 +139,7 @@ xs_str *html_actor_icon(xs_str *os, char *actor,
xs *s1 = xs_fmt(
"\n\n",
- date_title, date_label);
+ xs_encode_html(date_title), xs_encode_html(date_label));
s = xs_str_cat(s, s1);
}
@@ -164,7 +164,7 @@ xs_str *html_actor_icon(xs_str *os, char *actor,
s1 = xs_fmt(
"
%s",
- xs_dict_get(actor, "id"), user);
+ xs_dict_get(actor, "id"), xs_encode_html(user));
s = xs_str_cat(s, s1);
}
@@ -245,9 +245,9 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
{
xs *s1 = xs_fmt("
@%s@%s
\n"; xs *s1 = xs_fmt(_tmpl, - xs_dict_get(snac->config, "name"), - xs_dict_get(snac->config, "uid"), xs_dict_get(srv_config, "host") + xs_encode_html(xs_dict_get(snac->config, "name")), + xs_encode_html(xs_dict_get(snac->config, "uid")), xs_encode_html(xs_dict_get(srv_config, "host")) ); s = xs_str_cat(s, s1); if (local) { - xs *bio1 = not_really_markdown(xs_dict_get(snac->config, "bio"), NULL); + xs *bio1 = not_really_markdown(xs_encode_html(xs_dict_get(snac->config, "bio")), NULL); xs *tags = xs_list_new(); - xs *bio2 = process_tags(snac, bio1, &tags); + xs *bio2 = xs_encode_html(process_tags(snac, bio1, &tags)); xs *s1 = xs_fmt("%s %s
", L("Closes in"), p); + xs *s1 = xs_fmt("%s %s
", L("Closes in"), xs_encode_html(p)); c = xs_str_cat(c, s1); } } @@ -1136,7 +1136,7 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, if (xs_startswith(t, "image/")) { char *url = xs_dict_get(v, "url"); - char *name = xs_dict_get(v, "name"); + char *name = xs_encode_html(xs_dict_get(v, "name")); if (url != NULL) { if (xs_is_null(name)) @@ -1151,9 +1151,31 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, else if (xs_startswith(t, "video/")) { char *url = xs_dict_get(v, "url"); + char *name = xs_encode_html(xs_dict_get(v, "name")); if (url != NULL) { - xs *s1 = xs_fmt("\n", url); + xs *s1 = xs_fmt("\n", url, url, name ? name : "No description."); + + s = xs_str_cat(s, s1); + } + } + else + if (xs_startswith(t, "audio/")) { + char *url = xs_dict_get(v, "url"); + char *name = xs_encode_html(xs_dict_get(v, "name")); + + if (url != NULL) { + xs *s1 = xs_fmt("\n", url, url, name ? name : "No description."); + + s = xs_str_cat(s, s1); + } + } + else { + char *url = xs_dict_get(v, "url"); + char *name = xs_encode_html(xs_dict_get(v, "name")); + + if (url != NULL) { + xs *s1 = xs_fmt("Attachment: %s", url, name ? name : "No description"); s = xs_str_cat(s, s1); } @@ -1327,7 +1349,7 @@ xs_str *html_timeline(snac *snac, const xs_list *list, int local, int skip, int d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *header, const char *t) { xs *s = xs_str_new(NULL); - xs *h = xs_fmt("")) s = xs_str_cat(s, sc); else { - xs *s1 = xs_fmt("
%s
", sc); + xs *s1 = xs_fmt("%s
", xs_encode_html(sc)); s = xs_str_cat(s, s1); } @@ -1529,7 +1551,7 @@ xs_str *html_notifications(snac *snac) xs *s1 = xs_fmt("%s by %s:
\n", - label, actor_id, a_name); + xs_encode_html(label), actor_id, xs_encode_html(a_name)); s = xs_str_cat(s, s1); if (strcmp(type, "Follow") == 0 || strcmp(utype, "Follow") == 0) { @@ -1754,9 +1776,6 @@ int html_get_handler(const xs_dict *req, const char *q_path, xs *bio = not_really_markdown(xs_dict_get(snac.config, "bio"), NULL); char *p, *v; - /* escape tags */ - bio = xs_replace_i(bio, "<", "<"); - bio = xs_replace_i(bio, ">", ">"); rss = xs_fmt( "\n" @@ -1766,11 +1785,11 @@ int html_get_handler(const xs_dict *req, const char *q_path, "