aboutsummaryrefslogtreecommitdiff
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--README.md2
-rw-r--r--cgit.c6
-rw-r--r--cgit.h2
-rw-r--r--cgit.svg5
-rw-r--r--cgitrc.5.txt16
-rw-r--r--favicon.svg5
-rw-r--r--ui-shared.c79
8 files changed, 14 insertions, 105 deletions
diff --git a/Makefile b/Makefile
index c75f67b..4e851af 100644
--- a/Makefile
+++ b/Makefile
@@ -89,9 +89,7 @@ install: all
$(INSTALL) -m 0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css
$(INSTALL) -m 0644 cgit.js $(DESTDIR)$(CGIT_DATA_PATH)/cgit.js
$(INSTALL) -m 0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png
- $(INSTALL) -m 0644 cgit.svg $(DESTDIR)$(CGIT_DATA_PATH)/cgit.svg
$(INSTALL) -m 0644 favicon.ico $(DESTDIR)$(CGIT_DATA_PATH)/favicon.ico
- $(INSTALL) -m 0644 favicon.svg $(DESTDIR)$(CGIT_DATA_PATH)/favicon.svg
$(INSTALL) -m 0644 robots.txt $(DESTDIR)$(CGIT_DATA_PATH)/robots.txt
$(INSTALL) -m 0755 -d $(DESTDIR)$(filterdir)
$(COPYTREE) filters/* $(DESTDIR)$(filterdir)
@@ -120,9 +118,7 @@ uninstall:
rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css
rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.js
rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png
- rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.svg
rm -f $(DESTDIR)$(CGIT_DATA_PATH)/favicon.ico
- rm -f $(DESTDIR)$(CGIT_DATA_PATH)/favicon.svg
rm -f $(DESTDIR)$(CGIT_DATA_PATH)/robots.txt
$(foreach file,$(patsubst filters/%,%,$(shell find filters/ ! -type d)), \
$(call rm_f,$(DESTDIR)$(filterdir)/$(file)))
diff --git a/README.md b/README.md
index 2f7727e..f3b8724 100644
--- a/README.md
+++ b/README.md
@@ -6,8 +6,6 @@ This is a custom expansion to cgit. Its most prominent changes by now are:
* Theming now relies on CSS variables set in cgit.css, to allow easier custom additions and implicit filter theming.
-* Allow to use multiple favicons and of MIME type different from x-icon (f.ex. svg/png/webp).
-
The original cgit project is hosted at [git.zx2c4.com](https://git.zx2c4.com/cgit/about/)
## cgit - CGI for Git
diff --git a/cgit.c b/cgit.c
index bb32dc7..30c1d23 100644
--- a/cgit.c
+++ b/cgit.c
@@ -5,7 +5,6 @@
*
* Modified 2026 by Saya Andy:
* Always check there is git repo on repo.path
- * Allow to include multiple favicons
*
* Licensed under GNU General Public License v2
* (see COPYING for full license text)
@@ -171,7 +170,7 @@ static void config_cb(const char *name, const char *value)
else if (!strcmp(name, "js"))
string_list_append(&ctx.cfg.js, strdup_first_line(value));
else if (!strcmp(name, "favicon"))
- string_list_append(&ctx.cfg.favicon, strdup_first_line(value));
+ ctx.cfg.favicon = strdup_first_line(value);
else if (!strcmp(name, "footer"))
ctx.cfg.footer = strdup_first_line(value);
else if (!strcmp(name, "head-include"))
@@ -413,7 +412,8 @@ static void prepare_context(void)
ctx.cfg.case_sensitive_sort = 1;
ctx.cfg.branch_sort = 0;
ctx.cfg.commit_sort = 0;
- ctx.cfg.logo = "/cgit.svg";
+ ctx.cfg.logo = "/cgit.png";
+ ctx.cfg.favicon = "/favicon.ico";
ctx.cfg.local_time = 0;
ctx.cfg.enable_http_clone = 1;
ctx.cfg.enable_index_owner = 1;
diff --git a/cgit.h b/cgit.h
index e2b8cbc..847ab4e 100644
--- a/cgit.h
+++ b/cgit.h
@@ -205,7 +205,7 @@ struct cgit_config {
char *ci_tag_url;
char *clone_prefix;
char *clone_url;
- struct string_list favicon;
+ char *favicon;
char *footer;
char *head_include;
char *header;
diff --git a/cgit.svg b/cgit.svg
deleted file mode 100644
index 43fee2c..0000000
--- a/cgit.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="96" height="64" viewBox="0 0 96 64" fill="none" stroke="#a00" stroke-width="5">
- <title>cgit</title>
- <path d="M31.5 27.5A9 9 0 0 0 22.5 18.5h-5A9 9 0 0 0 8.5 27.5V38a9 9 0 0 0 9 9h5a9 9 0 0 0 9-9M31.5 38v12.5a8 8 0 0 1-8 8H17a8 8 0 0 1-8-8M46.5 3v5m0 8v33M62.5 9v29.75a7.75 7.75 0 0 0 15.5 0V37"/>
- <path stroke-width="4" d="M56 18h25"/>
-</svg>
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 6ddb977..76b2085 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -240,14 +240,9 @@ enable-tree-linenumbers::
for plaintext blobs printed in the tree view. Default value: "1".
favicon::
- Url used as link to a shortcut icon for cgit. It is suggested to
- always include the value "/favicon.ico" since certain browsers will
- ignore other values. May be given multiple times, each favicon URL
- path is added in the head section of the document in turn, letting
- the browser pick the icon it prefers. The mimetype of each icon is
- deduced from the extension of its url ("ico", "png", "svg", "gif",
- "jpg", "jpeg", "webp" and "avif" are recognized) and emitted as a
- "type" attribute. Default value: "/favicon.svg", "/favicon.ico".
+ Url used as link to a shortcut icon for cgit. It is suggested to use
+ the value "/favicon.ico" since certain browsers will ignore other
+ values. Default value: "/favicon.ico".
footer::
The content of the file specified with this option will be included
@@ -277,7 +272,7 @@ local-time::
logo::
Url which specifies the source of an image which will be used as a logo
- on all cgit pages. Default value: "/cgit.svg".
+ on all cgit pages. Default value: "/cgit.png".
logo-link::
Url loaded when clicking on the cgit logo image. If unspecified the
@@ -962,8 +957,7 @@ enable-log-linecount=1
branch-sort=age
-# Add cgit favicons
-favicon=/favicon.svg
+# Add a cgit favicon
favicon=/favicon.ico
diff --git a/favicon.svg b/favicon.svg
deleted file mode 100644
index 6be3df4..0000000
--- a/favicon.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 52 52" fill="none" stroke-width="6">
- <title>cgit</title>
- <g stroke="#f33"><path id="g" d="M37.5 15A9 9 0 0 0 28.5 6h-5A9 9 0 0 0 14.5 15v10.5a9 9 0 0 0 9 9h5a9 9 0 0 0 9-9M37.5 25.5V38a8 8 0 0 1-8 8H23a8 8 0 0 1-8-8"/></g>
- <use href="#g" stroke="#a00" stroke-width="4"/>
-</svg>
diff --git a/ui-shared.c b/ui-shared.c
index 686fde0..97d1839 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -7,8 +7,6 @@
* Implement ci link tab
* Check repo existence
* Replace memrchr() for macOS compatibility
- * Allow multiple favicons of different mime types to be used
- * Include favicon.svg as default
*
* Licensed under GNU General Public License v2
* (see COPYING for full license text)
@@ -776,51 +774,6 @@ void cgit_redirect(const char *url, bool permanent)
html("\n\n");
}
-static const struct {
- const char *ext;
- const char *mimetype;
-} favicon_mimetypes[] = {
- { "ico", "image/x-icon" },
- { "png", "image/png" },
- { "svg", "image/svg+xml" },
- { "gif", "image/gif" },
- { "jpg", "image/jpeg" },
- { "jpeg", "image/jpeg" },
- { "webp", "image/webp" },
- { "avif", "image/avif" },
-};
-
-/* Deduce the mimetype of a favicon from the extension of its url, ignoring
- * any query string or fragment. Returns NULL for unknown extensions.
- */
-static const char *favicon_mimetype(const char *url)
-{
- const char *p, *end, *ext = NULL;
- size_t len;
- int i;
-
- end = strpbrk(url, "?#");
- if (!end)
- end = url + strlen(url);
-
- for (p = url; p < end; p++) {
- if (*p == '/')
- ext = NULL;
- else if (*p == '.')
- ext = p + 1;
- }
- if (!ext)
- return NULL;
- len = end - ext;
-
- for (i = 0; i < ARRAY_SIZE(favicon_mimetypes); i++) {
- if (strlen(favicon_mimetypes[i].ext) == len &&
- !strncasecmp(favicon_mimetypes[i].ext, ext, len))
- return favicon_mimetypes[i].mimetype;
- }
- return NULL;
-}
-
static void print_rel_vcs_link(const char *url)
{
html("<link rel='vcs-git' href='");
@@ -862,27 +815,6 @@ static int emit_js_link(struct string_list_item *s, void *arg)
return 0;
}
-static int emit_favicon_link(struct string_list_item *s, void *arg)
-{
- const char *url = s ? s->string : (const char *)arg;
- const char *mimetype;
-
- /* Do not emit anything if favicon= is specified. */
- if (!*url)
- return 0;
-
- html("<link rel='shortcut icon' href='");
- html_attr(url);
- mimetype = favicon_mimetype(url);
- if (mimetype) {
- html("' type='");
- html_attr(mimetype);
- }
- html("'/>\n");
-
- return 0;
-}
-
void cgit_print_docstart(void)
{
char *host = cgit_hosturl();
@@ -913,12 +845,11 @@ void cgit_print_docstart(void)
else
emit_js_link(NULL, "/cgit.js");
- if (ctx.cfg.favicon.items)
- for_each_string_list(&ctx.cfg.favicon, emit_favicon_link, NULL);
- else
- emit_favicon_link(NULL, "/favicon.svg");
- emit_favicon_link(NULL, "/favicon.ico");
-
+ if (ctx.cfg.favicon && *ctx.cfg.favicon) {
+ html("<link rel='shortcut icon' href='");
+ html_attr(ctx.cfg.favicon);
+ html("'/>\n");
+ }
if (host && ctx.repo && ctx.qry.head) {
char *fileurl;
struct strbuf sb = STRBUF_INIT;