summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-05-08 10:13:43 +0200
committerdefault <nobody@localhost>2023-05-08 10:13:43 +0200
commitde12b8d0a2a4cf374f1c9e4e5b68c781a9ad8f88 (patch)
tree199feb28fa92e3209135eb5ecc7c3c84186564a5
parent920ff76297006968603898e8c60dafd9346dad4b (diff)
Fill the mastoapi instance contact_account field, if possible.
-rw-r--r--mastoapi.c15
-rw-r--r--utils.c4
2 files changed, 18 insertions, 1 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 1b9ab09..fe46b23 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1335,6 +1335,21 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
ins = xs_dict_append(ins, "configuration", cfg);
+ const char *admin_account = xs_dict_get(srv_config, "admin_account");
+
+ if (!xs_is_null(admin_account) && *admin_account) {
+ snac admin;
+
+ if (user_open(&admin, admin_account)) {
+ xs *actor = msg_actor(&admin);
+ xs *acct = mastoapi_account(actor);
+
+ ins = xs_dict_append(ins, "contact_account", acct);
+
+ user_free(&admin);
+ }
+ }
+
*body = xs_json_dumps_pp(ins, 4);
*ctype = "application/json";
status = 200;
diff --git a/utils.c b/utils.c
index 14e9f5d..189bd18 100644
--- a/utils.c
+++ b/utils.c
@@ -25,7 +25,9 @@ const char *default_srv_config = "{"
"\"cssurls\": [\"\"],"
"\"max_timeline_entries\": 128,"
"\"timeline_purge_days\": 120,"
- "\"local_purge_days\": 0"
+ "\"local_purge_days\": 0,"
+ "\"admin_email\": \"\","
+ "\"admin_account\": \"\""
"}";
const char *default_css =