diff options
| author | 2023-04-20 17:59:09 +0200 | |
|---|---|---|
| committer | 2023-04-20 17:59:09 +0200 | |
| commit | 76445d157afa4431f217fb9a9f21ab69fe7f122d (patch) | |
| tree | 5b57269e4dd5075443f5525698755ca27c2bcbac | |
| parent | Backport from xs. (diff) | |
| download | snac2-76445d157afa4431f217fb9a9f21ab69fe7f122d.tar.gz snac2-76445d157afa4431f217fb9a9f21ab69fe7f122d.tar.xz snac2-76445d157afa4431f217fb9a9f21ab69fe7f122d.zip | |
Use server.json "admin_email" in mastoapi instance object.
| -rw-r--r-- | mastoapi.c | 8 |
1 files changed, 7 insertions, 1 deletions
| @@ -1018,7 +1018,11 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1018 | xs *susie = xs_fmt("%s/susie.png", srv_baseurl); | 1018 | xs *susie = xs_fmt("%s/susie.png", srv_baseurl); |
| 1019 | ins = xs_dict_append(ins, "thumbnail", susie); | 1019 | ins = xs_dict_append(ins, "thumbnail", susie); |
| 1020 | 1020 | ||
| 1021 | ins = xs_dict_append(ins, "email", "admin@localhost"); | 1021 | const char *v = xs_dict_get(srv_config, "admin_email"); |
| 1022 | if (xs_is_null(v) || *v == '\0') | ||
| 1023 | v = "admin@localhost"; | ||
| 1024 | |||
| 1025 | ins = xs_dict_append(ins, "email", v); | ||
| 1022 | 1026 | ||
| 1023 | xs *l1 = xs_list_new(); | 1027 | xs *l1 = xs_list_new(); |
| 1024 | ins = xs_dict_append(ins, "rules", l1); | 1028 | ins = xs_dict_append(ins, "rules", l1); |
| @@ -1034,6 +1038,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1034 | *body = xs_json_dumps_pp(ins, 4); | 1038 | *body = xs_json_dumps_pp(ins, 4); |
| 1035 | *ctype = "application/json"; | 1039 | *ctype = "application/json"; |
| 1036 | status = 200; | 1040 | status = 200; |
| 1041 | |||
| 1042 | printf("%s\n", *body); | ||
| 1037 | } | 1043 | } |
| 1038 | else | 1044 | else |
| 1039 | if (xs_startswith(cmd, "/v1/statuses/")) { | 1045 | if (xs_startswith(cmd, "/v1/statuses/")) { |