summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/mastoapi.c b/mastoapi.c
index b223ce4..cd94528 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -732,6 +732,35 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
732 if (strcmp(cmd, "/timelines/public") == 0) { 732 if (strcmp(cmd, "/timelines/public") == 0) {
733 /* the public timeline */ 733 /* the public timeline */
734 } 734 }
735 else
736 if (strcmp(cmd, "/instance") == 0) {
737 /* returns an instance object */
738 xs *ins = xs_dict_new();
739 const char *host = xs_dict_get(srv_config, "host");
740
741 ins = xs_dict_append(ins, "domain", host);
742 ins = xs_dict_append(ins, "title", host);
743 ins = xs_dict_append(ins, "version", "4.0.0 (not true; really " USER_AGENT ")");
744 ins = xs_dict_append(ins, "source_url", "https:/" "/comam.es/snac-source");
745 ins = xs_dict_append(ins, "description", host);
746
747 xs *susie = xs_fmt("%s/susie.png", srv_baseurl);
748 xs *d1 = xs_dict_new();
749 d1 = xs_dict_append(d1, "url", susie);
750 ins = xs_dict_append(ins, "thumbnail", d1);
751
752 xs *d2 = xs_dict_new();
753 d2 = xs_dict_append(d2, "email", "admin@localhost");
754 ins = xs_dict_append(ins, "contact", d2);
755
756 xs *l1 = xs_list_new();
757 ins = xs_dict_append(ins, "rules", l1);
758 ins = xs_dict_append(ins, "languages", l1);
759
760 *body = xs_json_dumps_pp(ins, 4);
761 *ctype = "application/json";
762 status = 200;
763 }
735 764
736 /* user cleanup */ 765 /* user cleanup */
737 if (logged_in) 766 if (logged_in)