]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
Prepare for 'about site' page / add 'root-readme' option to cgitrc
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index 6ec763fc670d04af532eaa4570b474533d02081a..a402758fab53bc2c099e7b803fa8deee68226250 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -19,6 +19,10 @@ void config_cb(const char *name, const char *value)
 {
        if (!strcmp(name, "root-title"))
                ctx.cfg.root_title = xstrdup(value);
 {
        if (!strcmp(name, "root-title"))
                ctx.cfg.root_title = xstrdup(value);
+       else if (!strcmp(name, "root-desc"))
+               ctx.cfg.root_desc = xstrdup(value);
+       else if (!strcmp(name, "root-readme"))
+               ctx.cfg.root_readme = xstrdup(value);
        else if (!strcmp(name, "css"))
                ctx.cfg.css = xstrdup(value);
        else if (!strcmp(name, "logo"))
        else if (!strcmp(name, "css"))
                ctx.cfg.css = xstrdup(value);
        else if (!strcmp(name, "logo"))
@@ -159,6 +163,7 @@ static void prepare_context(struct cgit_context *ctx)
        ctx->cfg.renamelimit = -1;
        ctx->cfg.robots = "index, nofollow";
        ctx->cfg.root_title = "Git repository browser";
        ctx->cfg.renamelimit = -1;
        ctx->cfg.robots = "index, nofollow";
        ctx->cfg.root_title = "Git repository browser";
+       ctx->cfg.root_desc = "a fast webinterface for the git dscm";
        ctx->cfg.script_name = CGIT_SCRIPT_NAME;
        ctx->page.mimetype = "text/html";
        ctx->page.charset = PAGE_ENCODING;
        ctx->cfg.script_name = CGIT_SCRIPT_NAME;
        ctx->page.mimetype = "text/html";
        ctx->page.charset = PAGE_ENCODING;
@@ -179,7 +184,9 @@ static int cgit_prepare_cache(struct cacheitem *item)
        }
 
        if (!ctx.repo) {
        }
 
        if (!ctx.repo) {
-               item->name = xstrdup(fmt("%s/index.html", ctx.cfg.cache_root));
+               item->name = xstrdup(fmt("%s/index.%s.html",
+                                        ctx.cfg.cache_root,
+                                        cache_safe_filename(ctx.qry.raw)));
                item->ttl = ctx.cfg.cache_root_ttl;
                return 1;
        }
                item->ttl = ctx.cfg.cache_root_ttl;
                return 1;
        }
@@ -302,7 +309,16 @@ static void process_request(struct cgit_context *ctx)
                return;
        }
 
                return;
        }
 
-       if (cmd->want_repo && prepare_repo_cmd(ctx))
+       if (cmd->want_repo && !ctx->repo) {
+               cgit_print_http_headers(ctx);
+               cgit_print_docstart(ctx);
+               cgit_print_pageheader(ctx);
+               cgit_print_error(fmt("No repository selected"));
+               cgit_print_docend();
+               return;
+       }
+
+       if (ctx->repo && prepare_repo_cmd(ctx))
                return;
 
        if (cmd->want_layout) {
                return;
 
        if (cmd->want_layout) {