diff options
| author | 2024-06-08 21:25:02 +0200 | |
|---|---|---|
| committer | 2024-06-08 21:25:02 +0200 | |
| commit | 6e8adc86d00dccb9d6569336e6f208226c6bed22 (patch) | |
| tree | 1b60f285f2bba247e83918b738ae80ba59b80ee1 | |
| parent | Many Mastodon apps don't send Content-Type in DELETE, so ignore it. (diff) | |
| download | penes-snac2-6e8adc86d00dccb9d6569336e6f208226c6bed22.tar.gz penes-snac2-6e8adc86d00dccb9d6569336e6f208226c6bed22.tar.xz penes-snac2-6e8adc86d00dccb9d6569336e6f208226c6bed22.zip | |
mastoapi: Added missing field in list creation.
| -rw-r--r-- | data.c | 9 | ||||
| -rw-r--r-- | mastoapi.c | 4 |
2 files changed, 6 insertions, 7 deletions
| @@ -1831,21 +1831,18 @@ xs_val *list_maint(snac *user, const char *list, int op) | |||
| 1831 | if (add) { | 1831 | if (add) { |
| 1832 | FILE *f; | 1832 | FILE *f; |
| 1833 | xs *dir = xs_fmt("%s/list/", user->basedir); | 1833 | xs *dir = xs_fmt("%s/list/", user->basedir); |
| 1834 | xs *id = xs_fmt("%010x", time(NULL)); | 1834 | |
| 1835 | l = xs_fmt("%010x", time(NULL)); | ||
| 1835 | 1836 | ||
| 1836 | mkdirx(dir); | 1837 | mkdirx(dir); |
| 1837 | 1838 | ||
| 1838 | xs *fn = xs_fmt("%s%s.id", dir, id); | 1839 | xs *fn = xs_fmt("%s%s.id", dir, l); |
| 1839 | 1840 | ||
| 1840 | if ((f = fopen(fn, "w")) != NULL) { | 1841 | if ((f = fopen(fn, "w")) != NULL) { |
| 1841 | fprintf(f, "%s\n", list); | 1842 | fprintf(f, "%s\n", list); |
| 1842 | fclose(f); | 1843 | fclose(f); |
| 1843 | } | 1844 | } |
| 1844 | |||
| 1845 | l = xs_stock(XSTYPE_TRUE); | ||
| 1846 | } | 1845 | } |
| 1847 | else | ||
| 1848 | l = xs_stock(XSTYPE_FALSE); | ||
| 1849 | } | 1846 | } |
| 1850 | 1847 | ||
| 1851 | break; | 1848 | break; |
| @@ -2931,8 +2931,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 2931 | if (xs_type(title) == XSTYPE_STRING) { | 2931 | if (xs_type(title) == XSTYPE_STRING) { |
| 2932 | /* add the list */ | 2932 | /* add the list */ |
| 2933 | xs *out = xs_dict_new(); | 2933 | xs *out = xs_dict_new(); |
| 2934 | xs *lid = list_maint(&snac, title, 1); | ||
| 2934 | 2935 | ||
| 2935 | if (xs_type(list_maint(&snac, title, 1)) == XSTYPE_TRUE) { | 2936 | if (!xs_is_null(lid)) { |
| 2937 | out = xs_dict_append(out, "id", lid); | ||
| 2936 | out = xs_dict_append(out, "title", title); | 2938 | out = xs_dict_append(out, "title", title); |
| 2937 | out = xs_dict_append(out, "replies_policy", xs_dict_get_def(args, "replies_policy", "list")); | 2939 | out = xs_dict_append(out, "replies_policy", xs_dict_get_def(args, "replies_policy", "list")); |
| 2938 | out = xs_dict_append(out, "exclusive", xs_stock(XSTYPE_FALSE)); | 2940 | out = xs_dict_append(out, "exclusive", xs_stock(XSTYPE_FALSE)); |