From b2a3d31e8839b53a623b4c99124c2c637d0e3cbb Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Wed, 21 May 2008 08:17:54 +0200 Subject: Add atom-support This enables a page which generates atom feeds for the current branch and path, heavily inspired by the atom-support in gitweb. Signed-off-by: Lars Hjemli --- ui-shared.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index 197ee37..37c60b2 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -34,6 +34,21 @@ void cgit_print_error(char *msg) html("\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) @@ -428,6 +443,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("\n"); html("\n"); @@ -445,6 +461,13 @@ void cgit_print_docstart(struct cgit_context *ctx) html_attr(ctx->cfg.favicon); html("'/>\n"); } + if (host && ctx->repo) { + html(""); + } html("\n"); html("\n"); } -- cgit v1.2.3-59-g8ed1b