X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/afffc3e772a7b0c9d729f330ef2c9900c4343b63..63d35e556f294f60891c0611d9944202dc10e662:/ui-shared.c
diff --git a/ui-shared.c b/ui-shared.c
index f880c4e..eef2aa8 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -673,7 +673,7 @@ const struct date_mode *cgit_date_mode(enum date_mode_type type)
static void print_rel_date(time_t t, int tz, double value,
const char *class, const char *suffix)
{
- htmlf("%.0f %s", value, suffix);
}
@@ -768,6 +768,38 @@ static void print_rel_vcs_link(const char *url)
html(" Git repository'/>\n");
}
+static int emit_css_link(struct string_list_item *s, void *arg)
+{
+ /* Do not emit anything if css= is specified. */
+ if (s && *s->string == '\0')
+ return 0;
+
+ html("\n");
+
+ return 0;
+}
+
+static int emit_js_link(struct string_list_item *s, void *arg)
+{
+ /* Do not emit anything if js= is specified. */
+ if (s && *s->string == '\0')
+ return 0;
+
+ html("\n");
+
+ return 0;
+}
+
void cgit_print_docstart(void)
{
char *host = cgit_hosturl();
@@ -787,9 +819,17 @@ void cgit_print_docstart(void)
htmlf("\n", cgit_version);
if (ctx.cfg.robots && *ctx.cfg.robots)
htmlf("\n", ctx.cfg.robots);
- html("\n");
+
+ if (ctx.cfg.css.items)
+ for_each_string_list(&ctx.cfg.css, emit_css_link, NULL);
+ else
+ emit_css_link(NULL, "/cgit.css");
+
+ if (ctx.cfg.js.items)
+ for_each_string_list(&ctx.cfg.js, emit_js_link, NULL);
+ else
+ emit_js_link(NULL, "/cgit.js");
+
if (ctx.cfg.favicon) {
html("");
- html_txt(ctx.repo->owner);
+ if (ctx.repo->owner_filter) {
+ cgit_open_filter(ctx.repo->owner_filter);
+ html_txt(ctx.repo->owner);
+ cgit_close_filter(ctx.repo->owner_filter);
+ } else {
+ html_txt(ctx.repo->owner);
+ }
} else {
if (ctx.cfg.root_desc)
html_txt(ctx.cfg.root_desc);
@@ -1142,11 +1188,11 @@ void cgit_compose_snapshot_prefix(struct strbuf *filename, const char *base,
* name starts with {v,V}[0-9] and the prettify mapping is injective,
* i.e. each stripped tag can be inverted without ambiguities.
*/
- if (get_oid(fmt("refs/tags/%s", ref), &oid) == 0 &&
+ if (repo_get_oid(the_repository, fmt("refs/tags/%s", ref), &oid) == 0 &&
(ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1]) &&
- ((get_oid(fmt("refs/tags/%s", ref + 1), &oid) == 0) +
- (get_oid(fmt("refs/tags/v%s", ref + 1), &oid) == 0) +
- (get_oid(fmt("refs/tags/V%s", ref + 1), &oid) == 0) == 1))
+ ((repo_get_oid(the_repository, fmt("refs/tags/%s", ref + 1), &oid) == 0) +
+ (repo_get_oid(the_repository, fmt("refs/tags/v%s", ref + 1), &oid) == 0) +
+ (repo_get_oid(the_repository, fmt("refs/tags/V%s", ref + 1), &oid) == 0) == 1))
ref++;
strbuf_addf(filename, "%s-%s", base, ref);