diff options
| author | 2024-08-29 08:30:09 +0200 | |
|---|---|---|
| committer | 2024-08-29 08:30:09 +0200 | |
| commit | 08de4913955c6a4a31c13f72fbce2601bed215ba (patch) | |
| tree | 27192a33496fcccefe86cd49b620169c00bf9926 /mastoapi.c | |
| parent | mastoapi: added support for [un]bookmarking. (diff) | |
| download | penes-snac2-08de4913955c6a4a31c13f72fbce2601bed215ba.tar.gz penes-snac2-08de4913955c6a4a31c13f72fbce2601bed215ba.tar.xz penes-snac2-08de4913955c6a4a31c13f72fbce2601bed215ba.zip | |
mastoapi: added bookmark list.
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 18 |
1 files changed, 14 insertions, 4 deletions
| @@ -1822,10 +1822,16 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1822 | } | 1822 | } |
| 1823 | else | 1823 | else |
| 1824 | if (strcmp(cmd, "/v1/bookmarks") == 0) { /** **/ | 1824 | if (strcmp(cmd, "/v1/bookmarks") == 0) { /** **/ |
| 1825 | /* snac does not support bookmarks */ | 1825 | if (logged_in) { |
| 1826 | *body = xs_dup("[]"); | 1826 | xs *ifn = bookmark_index_fn(&snac1); |
| 1827 | *ctype = "application/json"; | 1827 | xs *out = mastoapi_timeline(&snac1, args, ifn); |
| 1828 | status = HTTP_STATUS_OK; | 1828 | |
| 1829 | *body = xs_json_dumps(out, 4); | ||
| 1830 | *ctype = "application/json"; | ||
| 1831 | status = HTTP_STATUS_OK; | ||
| 1832 | } | ||
| 1833 | else | ||
| 1834 | status = HTTP_STATUS_UNAUTHORIZED; | ||
| 1829 | } | 1835 | } |
| 1830 | else | 1836 | else |
| 1831 | if (strcmp(cmd, "/v1/lists") == 0) { /** list of lists **/ | 1837 | if (strcmp(cmd, "/v1/lists") == 0) { /** list of lists **/ |
| @@ -1850,6 +1856,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1850 | *ctype = "application/json"; | 1856 | *ctype = "application/json"; |
| 1851 | status = HTTP_STATUS_OK; | 1857 | status = HTTP_STATUS_OK; |
| 1852 | } | 1858 | } |
| 1859 | else | ||
| 1860 | status = HTTP_STATUS_UNAUTHORIZED; | ||
| 1853 | } | 1861 | } |
| 1854 | else | 1862 | else |
| 1855 | if (xs_startswith(cmd, "/v1/lists/")) { /** list information **/ | 1863 | if (xs_startswith(cmd, "/v1/lists/")) { /** list information **/ |
| @@ -1910,6 +1918,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1910 | } | 1918 | } |
| 1911 | } | 1919 | } |
| 1912 | } | 1920 | } |
| 1921 | else | ||
| 1922 | status = HTTP_STATUS_UNAUTHORIZED; | ||
| 1913 | } | 1923 | } |
| 1914 | else | 1924 | else |
| 1915 | if (strcmp(cmd, "/v1/scheduled_statuses") == 0) { /** **/ | 1925 | if (strcmp(cmd, "/v1/scheduled_statuses") == 0) { /** **/ |