From b993e26346f885586ff0533a3b309ed7d1e910cf Mon Sep 17 00:00:00 2001 From: default Date: Thu, 16 Jan 2025 14:20:07 +0100 Subject: Implemented Mastodon-like /authorize_interaction. --- httpd.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'httpd.c') diff --git a/httpd.c b/httpd.c index dda40b9..74628e3 100644 --- a/httpd.c +++ b/httpd.c @@ -182,6 +182,29 @@ const char *share_page = "" ""; +const char *authorize_interaction_page = "" +"\n" +"\n" +"\n" +"%s - snac\n" +"\n" +"\n" +"\n" +"\n" +"

%s authorize interaction

\n" +"
\n" +" %s\n" +"\n" +"

Login:

\n" +"\n" +"

%s

\n" +""; + + int server_get_handler(xs_dict *req, const char *q_path, char **body, int *b_size, char **ctype) /* basic server services */ @@ -318,6 +341,25 @@ int server_get_handler(xs_dict *req, const char *q_path, USER_AGENT ); } + else + if (strcmp(q_path, "/authorize_interaction") == 0) { + const xs_dict *q_vars = xs_dict_get(req, "q_vars"); + const char *uri = xs_dict_get(q_vars, "uri"); + + if (xs_is_string(uri)) { + status = HTTP_STATUS_OK; + *ctype = "text/html; charset=utf-8"; + *body = xs_fmt(authorize_interaction_page, + xs_dict_get(srv_config, "host"), + srv_baseurl, + xs_dict_get(srv_config, "host"), + srv_baseurl, + uri, + uri, + USER_AGENT + ); + } + } if (status != 0) srv_debug(1, xs_fmt("server_get_handler serving '%s' %d", q_path, status)); -- cgit v1.2.3