]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
ui-patch.c: Fix signature delimiter
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index 950b87834e81fdc5bb2210a6964499811b642096..861352a5e9e8da1558cde08b3cc076375d138ede 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -211,6 +211,8 @@ static void config_cb(const char *name, const char *value)
                ctx.cfg.cache_static_ttl = atoi(value);
        else if (!strcmp(name, "cache-dynamic-ttl"))
                ctx.cfg.cache_dynamic_ttl = atoi(value);
                ctx.cfg.cache_static_ttl = atoi(value);
        else if (!strcmp(name, "cache-dynamic-ttl"))
                ctx.cfg.cache_dynamic_ttl = atoi(value);
+       else if (!strcmp(name, "cache-about-ttl"))
+               ctx.cfg.cache_about_ttl = atoi(value);
        else if (!strcmp(name, "case-sensitive-sort"))
                ctx.cfg.case_sensitive_sort = atoi(value);
        else if (!strcmp(name, "about-filter"))
        else if (!strcmp(name, "case-sensitive-sort"))
                ctx.cfg.case_sensitive_sort = atoi(value);
        else if (!strcmp(name, "about-filter"))
@@ -351,12 +353,13 @@ static void prepare_context(struct cgit_context *ctx)
        ctx->cfg.agefile = "info/web/last-modified";
        ctx->cfg.nocache = 0;
        ctx->cfg.cache_size = 0;
        ctx->cfg.agefile = "info/web/last-modified";
        ctx->cfg.nocache = 0;
        ctx->cfg.cache_size = 0;
-       ctx->cfg.cache_dynamic_ttl = 5;
        ctx->cfg.cache_max_create_time = 5;
        ctx->cfg.cache_max_create_time = 5;
-       ctx->cfg.cache_repo_ttl = 5;
        ctx->cfg.cache_root = CGIT_CACHE_ROOT;
        ctx->cfg.cache_root = CGIT_CACHE_ROOT;
+       ctx->cfg.cache_about_ttl = 15;
+       ctx->cfg.cache_repo_ttl = 5;
        ctx->cfg.cache_root_ttl = 5;
        ctx->cfg.cache_scanrc_ttl = 15;
        ctx->cfg.cache_root_ttl = 5;
        ctx->cfg.cache_scanrc_ttl = 15;
+       ctx->cfg.cache_dynamic_ttl = 5;
        ctx->cfg.cache_static_ttl = -1;
        ctx->cfg.case_sensitive_sort = 1;
        ctx->cfg.branch_sort = 0;
        ctx->cfg.cache_static_ttl = -1;
        ctx->cfg.case_sensitive_sort = 1;
        ctx->cfg.branch_sort = 0;
@@ -922,12 +925,15 @@ static int calc_ttl()
        if (!ctx.qry.page)
                return ctx.cfg.cache_repo_ttl;
 
        if (!ctx.qry.page)
                return ctx.cfg.cache_repo_ttl;
 
-       if (ctx.qry.has_symref)
-               return ctx.cfg.cache_dynamic_ttl;
+       if (!strcmp(ctx.qry.page, "about"))
+               return ctx.cfg.cache_about_ttl;
 
        if (ctx.qry.has_sha1)
                return ctx.cfg.cache_static_ttl;
 
 
        if (ctx.qry.has_sha1)
                return ctx.cfg.cache_static_ttl;
 
+       if (ctx.qry.has_symref)
+               return ctx.cfg.cache_dynamic_ttl;
+
        return ctx.cfg.cache_repo_ttl;
 }
 
        return ctx.cfg.cache_repo_ttl;
 }
 
@@ -973,7 +979,10 @@ int main(int argc, const char **argv)
        }
 
        ttl = calc_ttl();
        }
 
        ttl = calc_ttl();
-       ctx.page.expires += ttl * 60;
+       if (ttl < 0)
+               ctx.page.expires += 10 * 365 * 24 * 60 * 60; /* 10 years */
+       else
+               ctx.page.expires += ttl * 60;
        if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))
                ctx.cfg.nocache = 1;
        if (ctx.cfg.nocache)
        if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))
                ctx.cfg.nocache = 1;
        if (ctx.cfg.nocache)