Skip to content

Commit

Permalink
Add «style='color-scheme:dark light'» to some HTML output
Browse files Browse the repository at this point in the history
This permits rendering of the webpages and iMIP messages nicely in dark mode.
  • Loading branch information
dilyanpalauzov committed Aug 26, 2023
1 parent 6c852ba commit e2a06ff
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions imap/http_admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static int action_murder(struct transaction_t *txn)
/* Add HTML header */
buf_reset(&resp);
buf_printf_markup(&resp, level, HTML_DOCTYPE);
buf_printf_markup(&resp, level++, "<html>");
buf_printf_markup(&resp, level++, "<html style='color-scheme:dark light'>");
buf_printf_markup(&resp, level++, "<head>");
buf_printf_markup(&resp, level, "<title>%s</title>",
"Available Backend Servers");
Expand Down Expand Up @@ -296,7 +296,7 @@ static int action_murder(struct transaction_t *txn)

buf_reset(&resp);
buf_printf_markup(&resp, level, HTML_DOCTYPE);
buf_printf_markup(&resp, level++, "<html>");
buf_printf_markup(&resp, level++, "<html style='color-scheme:dark light'>");
buf_printf_markup(&resp, level++, "<head>");
buf_printf_markup(&resp, level, "<title>%s</title>",
"Available Backend Servers");
Expand Down Expand Up @@ -377,7 +377,7 @@ static int action_menu(struct transaction_t *txn)

buf_reset(&resp);
buf_printf_markup(&resp, level, HTML_DOCTYPE);
buf_printf_markup(&resp, level++, "<html>");
buf_printf_markup(&resp, level++, "<html style='color-scheme:dark light'>");
buf_printf_markup(&resp, level++, "<head>");
buf_printf_markup(&resp, level, "<title>%s</title>", actions[0].desc);
buf_printf_markup(&resp, --level, "</head>");
Expand Down Expand Up @@ -474,7 +474,7 @@ static int action_proc(struct transaction_t *txn)
/* Send HTML header */
buf_reset(body);
buf_printf_markup(body, level, HTML_DOCTYPE);
buf_printf_markup(body, level++, "<html>");
buf_printf_markup(body, level++, "<html style='color-scheme:dark light'>");
buf_printf_markup(body, level++, "<head>");
buf_printf_markup(body, level, "<meta http-equiv=\"%s\" content=\"%s\">",
"Refresh", "1");
Expand Down Expand Up @@ -670,7 +670,7 @@ static int action_df(struct transaction_t *txn)

buf_reset(&resp);
buf_printf_markup(&resp, level, HTML_DOCTYPE);
buf_printf_markup(&resp, level++, "<html>");
buf_printf_markup(&resp, level++, "<html style='color-scheme:dark light'>");
buf_printf_markup(&resp, level++, "<head>");
buf_printf_markup(&resp, level, "<title>%s</title>", actions[2].desc);
buf_printf_markup(&resp, --level, "</head>");
Expand Down Expand Up @@ -1007,7 +1007,7 @@ static int action_conf(struct transaction_t *txn)

buf_reset(&resp);
buf_printf_markup(&resp, level, HTML_DOCTYPE);
buf_printf_markup(&resp, level++, "<html>");
buf_printf_markup(&resp, level++, "<html style='color-scheme:dark light'>");
buf_printf_markup(&resp, level++, "<head>");
buf_printf_markup(&resp, level, "<title>%s</title>", actions[3].desc);
buf_printf_markup(&resp, --level, "</head>");
Expand Down
2 changes: 1 addition & 1 deletion imap/http_caldav.c
Original file line number Diff line number Diff line change
Expand Up @@ -2178,7 +2178,7 @@ static int list_calendars(struct transaction_t *txn)
/* Send HTML header */
buf_reset(body);
buf_printf_markup(body, level, HTML_DOCTYPE);
buf_printf_markup(body, level++, "<html>");
buf_printf_markup(body, level++, "<html style='color-scheme:dark light'>");
buf_printf_markup(body, level++, "<head>");
buf_printf_markup(body, level, "<title>%s</title>", "Available Calendars");
buf_printf_markup(body, level++, "<script type=\"text/javascript\">");
Expand Down
2 changes: 1 addition & 1 deletion imap/http_caldav_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ static int imip_send_sendmail(const char *userid, icalcomponent *ical, const cha
buf_appendcstr(&msgbuf, "Content-Disposition: inline\r\n");
buf_appendcstr(&msgbuf, "\r\n");

buf_appendcstr(&msgbuf, HTML_DOCTYPE "\r\n<html><head><title></title></head><body>\r\n");
buf_appendcstr(&msgbuf, HTML_DOCTYPE "\r\n<html style='color-scheme:dark light'><head><title></title></head><body>\r\n");

if (originator->name) {
HTMLencode(&tmpbuf, originator->name);
Expand Down
2 changes: 1 addition & 1 deletion imap/http_carddav.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ static int list_addressbooks(struct transaction_t *txn)
/* Send HTML header */
buf_reset(body);
buf_printf_markup(body, level, HTML_DOCTYPE);
buf_printf_markup(body, level++, "<html>");
buf_printf_markup(body, level++, "<html style='color-scheme:dark light'>");
buf_printf_markup(body, level++, "<head>");
buf_printf_markup(body, level, "<title>%s</title>", "Available Addressbooks");
buf_printf_markup(body, level++, "<script type=\"text/javascript\">");
Expand Down
2 changes: 1 addition & 1 deletion imap/http_webdav.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ static int webdav_get(struct transaction_t *txn,
/* Send HTML with davmount link */
buf_reset(body);
buf_printf_markup(body, level, HTML_DOCTYPE);
buf_printf_markup(body, level++, "<html>");
buf_printf_markup(body, level++, "<html style='color-scheme:dark light'>");
buf_printf_markup(body, level++, "<head>");
buf_printf_markup(body, level, "<title>%s</title>", txn->req_tgt.path);
buf_printf_markup(body, --level, "</head>");
Expand Down
6 changes: 3 additions & 3 deletions imap/httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ static int zstd_compress(struct transaction_t *txn __attribute__((unused)),

static const char tls_message[] =
HTML_DOCTYPE
"<html>\n<head>\n<title>TLS Required</title>\n</head>\n" \
"<html style='color-scheme:dark light'>\n<head>\n<title>TLS Required</title>\n</head>\n" \
"<body>\n<h2>TLS is required prior to authentication</h2>\n" \
"Use <a href=\"%s\">%s</a> instead.\n" \
"</body>\n</html>\n";
Expand Down Expand Up @@ -3906,7 +3906,7 @@ EXPORTED void error_response(long code, struct transaction_t *txn)
}

buf_printf_markup(html, level, HTML_DOCTYPE);
buf_printf_markup(html, level++, "<html>");
buf_printf_markup(html, level++, "<html style='color-scheme:dark light'>");
buf_printf_markup(html, level++, "<head>");
buf_printf_markup(html, level, "<title>%s</title>",
error_message(code));
Expand Down Expand Up @@ -4709,7 +4709,7 @@ static int list_well_known(struct transaction_t *txn)
/* Start HTML */
buf_reset(&body);
buf_printf_markup(&body, level, HTML_DOCTYPE);
buf_printf_markup(&body, level++, "<html>");
buf_printf_markup(&body, level++, "<html style='color-scheme:dark light'>");
buf_printf_markup(&body, level++, "<head>");
buf_printf_markup(&body, level,
"<title>%s</title>", "Well-Known Locations");
Expand Down

0 comments on commit e2a06ff

Please sign in to comment.