Warmcat homepage andy@warmcat.com
libwebsockets
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1745906578, "reponame":"cgit", "desc":"CGI gitweb", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/cgit", "f":3, "items": [ {"schema":"libjg2-1", "cid":"523cf255f99e8b679df3671f25116191", "commit": {"type":"commit", "time": 1530589970, "time_ofs": 480, "oid_tree": { "oid": "c934597fde28cb502f090b4383ac211d356bbe2c", "alias": []}, "oid":{ "oid": "05fcd405c16c428d30b1a29e8e81c9ab04de4327", "alias": []}, "msg": "config: add js", "sig_commit": { "git_time": { "time": 1530589970, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1529749553, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }}, "body": "config: add js\n\nJust like the config allows setting css URL path,\nadd a config for setting the js URL path\n\nSetting the js path to an empty string disables\nemitting the reference to it in the head section.\n\nSigned-off-by: Andy Green \u003candy@warmcat.com\u003e\nReviewed-by: John Keeping \u003cjohn@keeping.me.uk\u003e" , "diff": "diff --git a/Makefile b/Makefile\nindex 137150c..de7e13e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -87,6 +87,7 @@ install: all\n \t$(INSTALL) -m 0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)\n \t$(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_DATA_PATH)\n \t$(INSTALL) -m 0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css\n+\t$(INSTALL) -m 0644 cgit.js $(DESTDIR)$(CGIT_DATA_PATH)/cgit.js\n \t$(INSTALL) -m 0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png\n \t$(INSTALL) -m 0644 favicon.ico $(DESTDIR)$(CGIT_DATA_PATH)/favicon.ico\n \t$(INSTALL) -m 0644 robots.txt $(DESTDIR)$(CGIT_DATA_PATH)/robots.txt\ndiff --git a/cgit.c b/cgit.c\nindex d7e11a8..98196aa 100644\n--- a/cgit.c\n+++ b/cgit.c\n@@ -138,6 +138,8 @@ static void config_cb(const char *name, const char *value)\n \t\tctx.cfg.root_readme \u003d xstrdup(value);\n \telse if (!strcmp(name, \u0022css\u0022))\n \t\tstring_list_append(\u0026ctx.cfg.css, xstrdup(value));\n+\telse if (!strcmp(name, \u0022js\u0022))\n+\t\tstring_list_append(\u0026ctx.cfg.js, xstrdup(value));\n \telse if (!strcmp(name, \u0022favicon\u0022))\n \t\tctx.cfg.favicon \u003d xstrdup(value);\n \telse if (!strcmp(name, \u0022footer\u0022))\ndiff --git a/cgit.h b/cgit.h\nindex 60b7554..390df3b 100644\n--- a/cgit.h\n+++ b/cgit.h\n@@ -266,6 +266,7 @@ struct cgit_config {\n \tint commit_sort;\n \tstruct string_list mimetypes;\n \tstruct string_list inline_readme;\n+\tstruct string_list js;\n \tstruct cgit_filter *about_filter;\n \tstruct cgit_filter *commit_filter;\n \tstruct cgit_filter *source_filter;\ndiff --git a/cgit.js b/cgit.js\nnew file mode 100644\nindex 0000000..e69de29\n--- /dev/null\n+++ b/cgit.js\ndiff --git a/cgitrc.5.txt b/cgitrc.5.txt\nindex 1d62775..3422dcc 100644\n--- a/cgitrc.5.txt\n+++ b/cgitrc.5.txt\n@@ -254,6 +254,11 @@ inline-readme::\n \tthey can individually also choose to ignore this global list, and create a\n \trepo-specific list by using 'repo.inline-readme'.\n \n+js::\n+\tUrl which specifies the javascript script document to include in all cgit\n+\tpages. Default value: \u0022/cgit.js\u0022. Setting this to an empty string will\n+\tdisable generation of the link to this file in the head section.\n+\n local-time::\n \tFlag which, if set to \u00221\u0022, makes cgit print commit and tag times in the\n \tservers timezone. Default value: \u00220\u0022.\ndiff --git a/ui-shared.c b/ui-shared.c\nindex 5a10b54..33a5d01 100644\n--- a/ui-shared.c\n+++ b/ui-shared.c\n@@ -777,6 +777,15 @@ static int emit_css_link(struct string_list_item *s, void *arg)\n \n \treturn 0;\n }\n+\t\n+static int emit_js_link(struct string_list_item *s, void *arg)\n+{\n+\thtml(\u0022\u003cscript type\u003d'text/javascript' src\u003d'\u0022);\n+\thtml_attr(s-\u003estring);\n+\thtml(\u0022'\u003e\u003c/script\u003e\u005cn\u0022);\n+\n+\treturn 0;\n+}\n \n void cgit_print_docstart(void)\n {\n@@ -803,6 +812,8 @@ void cgit_print_docstart(void)\n \telse\n \t\temit_css_link(NULL, \u0022/cgit.css\u0022);\n \n+\tfor_each_string_list(\u0026ctx.cfg.js, emit_js_link, NULL);\n+\n \tif (ctx.cfg.favicon) {\n \t\thtml(\u0022\u003clink rel\u003d'shortcut icon' href\u003d'\u0022);\n \t\thtml_attr(ctx.cfg.favicon);\n","s":{"c":1745906578,"u": 6596}} ],"g": 7598,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}