diff options
| -rw-r--r-- | html.c | 19 |
1 files changed, 19 insertions, 0 deletions
| @@ -1615,6 +1615,25 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, | |||
| 1615 | snac.config = xs_dict_set(snac.config, "purge_days", days); | 1615 | snac.config = xs_dict_set(snac.config, "purge_days", days); |
| 1616 | } | 1616 | } |
| 1617 | 1617 | ||
| 1618 | /* avatar upload */ | ||
| 1619 | char *avatar_file = xs_dict_get(p_vars, "avatar_file"); | ||
| 1620 | if (!xs_is_null(avatar_file) && xs_type(avatar_file) == XSTYPE_LIST) { | ||
| 1621 | char *fn = xs_list_get(avatar_file, 0); | ||
| 1622 | |||
| 1623 | if (*fn != '\0') { | ||
| 1624 | char *ext = strrchr(fn, '.'); | ||
| 1625 | xs *id = xs_fmt("avatar%s", ext); | ||
| 1626 | xs *url = xs_fmt("%s/s/%s", snac.actor, id); | ||
| 1627 | int fo = xs_number_get(xs_list_get(avatar_file, 1)); | ||
| 1628 | int fs = xs_number_get(xs_list_get(avatar_file, 2)); | ||
| 1629 | |||
| 1630 | /* store */ | ||
| 1631 | static_put(&snac, id, payload + fo, fs); | ||
| 1632 | |||
| 1633 | snac.config = xs_dict_set(snac.config, "avatar", url); | ||
| 1634 | } | ||
| 1635 | } | ||
| 1636 | |||
| 1618 | /* password change? */ | 1637 | /* password change? */ |
| 1619 | if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL && | 1638 | if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL && |
| 1620 | (p2 = xs_dict_get(p_vars, "passwd2")) != NULL && | 1639 | (p2 = xs_dict_get(p_vars, "passwd2")) != NULL && |