diff options
Diffstat (limited to 'cgit/patch/0001-UI-Add-support-for-project-sponsor-page.patch')
-rw-r--r-- | cgit/patch/0001-UI-Add-support-for-project-sponsor-page.patch | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/cgit/patch/0001-UI-Add-support-for-project-sponsor-page.patch b/cgit/patch/0001-UI-Add-support-for-project-sponsor-page.patch new file mode 100644 index 0000000..21a3622 --- /dev/null +++ b/cgit/patch/0001-UI-Add-support-for-project-sponsor-page.patch @@ -0,0 +1,108 @@ +From a6cb50a01bcd2b45c44336cc85f2a3d5d602a856 Mon Sep 17 00:00:00 2001 +From: Slack Coder <slackcoder@server.ky> +Date: Tue, 29 Oct 2024 11:43:48 -0500 +Subject: [PATCH] UI: Add support for project sponsor page + +Add an extra configuration parameter repo.sponsor-page to link to a project's +sponsorship page. +--- + cgit.c | 4 ++++ + cgit.h | 1 + + cgitrc.5.txt | 3 +++ + scan-tree.c | 2 ++ + shared.c | 1 + + ui-shared.c | 5 +++++ + 6 files changed, 16 insertions(+) + +diff --git a/cgit.c b/cgit.c +index c4320f0..e19b9c1 100644 +--- a/cgit.c ++++ b/cgit.c +@@ -54,6 +54,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va + repo->owner = xstrdup(value); + else if (!strcmp(name, "homepage")) + repo->homepage = xstrdup(value); ++ else if (!strcmp(name, "sponsor-page")) ++ repo->sponsor_page = xstrdup(value); + else if (!strcmp(name, "defbranch")) + repo->defbranch = xstrdup(value); + else if (!strcmp(name, "extra-head-content")) +@@ -814,6 +816,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo) + fprintf(f, "repo.section=%s\n", repo->section); + if (repo->homepage) + fprintf(f, "repo.homepage=%s\n", repo->homepage); ++ if (repo->sponsor_page) ++ fprintf(f, "repo.sponsor-page=%s\n", repo->sponsor_page); + if (repo->clone_url) + fprintf(f, "repo.clone-url=%s\n", repo->clone_url); + fprintf(f, "repo.enable-blame=%d\n", +diff --git a/cgit.h b/cgit.h +index 7ec46b4..0136ea6 100644 +--- a/cgit.h ++++ b/cgit.h +@@ -85,6 +85,7 @@ struct cgit_repo { + char *extra_head_content; + char *owner; + char *homepage; ++ char *sponsor_page; + char *defbranch; + char *module_link; + struct string_list readme; +diff --git a/cgitrc.5.txt b/cgitrc.5.txt +index 33a6a8c..d1429c5 100644 +--- a/cgitrc.5.txt ++++ b/cgitrc.5.txt +@@ -528,6 +528,9 @@ repo.hide:: + repo.homepage:: + The value to show as repository homepage. Default value: none. + ++repo.sponsor-page:: ++ The value to show as repository sponsor page. Default value: none. ++ + repo.ignore:: + Flag which, when set to "1", ignores the repository. The repository + is not shown in the index and cannot be accessed by providing a direct +diff --git a/scan-tree.c b/scan-tree.c +index 6a2f65a..bdd3e70 100644 +--- a/scan-tree.c ++++ b/scan-tree.c +@@ -66,6 +66,8 @@ static int gitconfig_config(const char *key, const char *value, void *cb) + config_fn(repo, "section", value); + else if (!strcmp(key, "gitweb.homepage")) + config_fn(repo, "homepage", value); ++ else if (!strcmp(key, "gitweb.sponsor-page")) ++ config_fn(repo, "sponsor-page", value); + else if (skip_prefix(key, "cgit.", &name)) + config_fn(repo, name, value); + +diff --git a/shared.c b/shared.c +index 8115469..099a3b9 100644 +--- a/shared.c ++++ b/shared.c +@@ -56,6 +56,7 @@ struct cgit_repo *cgit_add_repo(const char *url) + ret->extra_head_content = NULL; + ret->owner = NULL; + ret->homepage = NULL; ++ ret->sponsor_page = NULL; + ret->section = ctx.cfg.section; + ret->snapshots = ctx.cfg.snapshots; + ret->enable_blame = ctx.cfg.enable_blame; +diff --git a/ui-shared.c b/ui-shared.c +index d2358f2..4d2d94e 100644 +--- a/ui-shared.c ++++ b/ui-shared.c +@@ -1060,6 +1060,11 @@ void cgit_print_pageheader(void) + html_attr(ctx.repo->homepage); + html("'>homepage</a>"); + } ++ if (ctx.repo->sponsor_page) { ++ html("<a href='"); ++ html_attr(ctx.repo->sponsor_page); ++ html("'>sponsor</a>"); ++ } + html("</td><td class='form'>"); + html("<form class='right' method='get' action='"); + if (ctx.cfg.virtual_root) { +-- +2.46.2 + |