about summary refs log tree commit diff
path: root/ui-shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index a2e0dd2..4818e70 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -34,6 +34,21 @@ void cgit_print_error(char *msg)
 	html("</div>\n");
 }
 
+char *cgit_hosturl()
+{
+	char *host, *port;
+
+	host = getenv("SERVER_NAME");
+	if (!host)
+		return NULL;
+	port = getenv("SERVER_PORT");
+	if (port && atoi(port) != 80)
+		host = xstrdup(fmt("%s:%d", host, atoi(port)));
+	else
+		host = xstrdup(host);
+	return host;
+}
+
 char *cgit_rooturl()
 {
 	if (ctx.cfg.virtual_root)
@@ -436,6 +451,7 @@ void cgit_print_http_headers(struct cgit_context *ctx)
 
 void cgit_print_docstart(struct cgit_context *ctx)
 {
+	char *host = cgit_hosturl();
 	html(cgit_doctype);
 	html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n");
 	html("<head>\n");
@@ -453,6 +469,13 @@ void cgit_print_docstart(struct cgit_context *ctx)
 		html_attr(ctx->cfg.favicon);
 		html("'/>\n");
 	}
+	if (host && ctx->repo) {
+		html("<link rel='alternate' title='Atom feed' href='http://");
+		html_attr(cgit_hosturl());
+		html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path,
+				       fmt("h=%s", ctx->qry.head)));
+		html("' type='application/atom+xml'/>");
+	}
 	html("</head>\n");
 	html("<body>\n");
 }
irl&id=252428f97aa6a8f4e5b612757ce96d2d0d37e2f3&follow=1'>Add chroot targetJune McEnroe 2020-02-11Exit focus and paste modes on err exitJune McEnroe 2020-02-11Add startup GPLv3 note and URLJune McEnroe 2020-02-11Make sure -D_GNU_SOURCE ends up in CFLAGS on LinuxJune McEnroe 2020-02-11Add note about setting PKG_CONFIG_PATHJune McEnroe 2020-02-11Rename query ID on nick changeJune McEnroe 2020-02-11Call completeClear when closing a windowJune McEnroe 2020-02-11Don't insert color codes for non-mentionsJune McEnroe 2020-02-11Take first two words in colorMentionsJune McEnroe 2020-02-11Use time_t for save signatureJune McEnroe 2020-02-11Set self.nick to * initiallyJune McEnroe 2020-02-11Define ColorCap instead of hardcoding 100June McEnroe 2020-02-11Move hash to top of chat.hJune McEnroe 2020-02-11Move base64 out of chat.hJune McEnroe 2020-02-11Move XDG_SUBDIR out of chat.hJune McEnroe 2020-02-11Fix whois idle unit calculationJune McEnroe 2020-02-11Cast towupper to wchar_tJune McEnroe 2020-02-11Cast set but unused variables to voidJune McEnroe 2020-02-11Declare strlcatJune McEnroe 2020-02-11Check if VDSUSP existsJune McEnroe 2020-02-11Fix completeReplace iterationJune McEnroe 2020-02-11Use pkg(8) to configure on FreeBSDJune McEnroe 2020-02-11Remove legacy codeJune McEnroe 2020-02-11Add INSTALLING section to READMEJune McEnroe