SPDX-FileCopyrightText: V SPDX-License-Identifier: OSL-3.0 diff --git a/cgit.c b/cgit.c index dd28a79..1426a72 100644 --- a/cgit.c +++ b/cgit.c @@ -603,7 +603,7 @@ static int prepare_repo_cmd(int nongit) cgit_print_docend(); return 1; } - ctx.page.title = fmtalloc("%s - %s", ctx.repo->name, ctx.repo->desc); + ctx.page.title = ctx.cfg.root_title; if (!ctx.repo->defbranch) ctx.repo->defbranch = guess_defbranch(); diff --git a/ui-shared.c b/ui-shared.c index 72a1505..d798d99 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -129,29 +129,17 @@ const char *cgit_loginurl(void) char *cgit_repourl(const char *reponame) { - if (ctx.cfg.virtual_root) - return fmtalloc("%s%s/", ctx.cfg.virtual_root, reponame); - else - return fmtalloc("?r=%s", reponame); + return fmtalloc("%s/", ctx.cfg.virtual_root); } char *cgit_fileurl(const char *reponame, const char *pagename, const char *filename, const char *query) { struct strbuf sb = STRBUF_INIT; - char *delim; - - if (ctx.cfg.virtual_root) { - strbuf_addf(&sb, "%s%s/%s/%s", ctx.cfg.virtual_root, reponame, - pagename, (filename ? filename:"")); - delim = "?"; - } else { - strbuf_addf(&sb, "?url=%s/%s/%s", reponame, pagename, - (filename ? filename : "")); - delim = "&"; - } + strbuf_addf(&sb, "%s/%s/%s", ctx.cfg.virtual_root, + pagename, (filename ? filename:"")); if (query) - strbuf_addf(&sb, "%s%s", delim, query); + strbuf_addf(&sb, "?%s", query); return strbuf_detach(&sb, NULL); } @@ -277,30 +265,12 @@ static char *repolink(const char *title, const char *class, const char *page, html("'"); } html(" href='"); - if (ctx.cfg.virtual_root) { - html_url_path(ctx.cfg.virtual_root); - html_url_path(ctx.repo->url); - if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/') - html("/"); - if (page) { - html_url_path(page); - html("/"); - if (path) - html_url_path(path); - } - } else { - html_url_path(ctx.cfg.script_name); - html("?url="); - html_url_arg(ctx.repo->url); - if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/') - html("/"); - if (page) { - html_url_arg(page); - html("/"); - if (path) - html_url_arg(path); - } - delim = "&"; + html_url_path(ctx.cfg.virtual_root); + if (page) { + html_url_path(page); + html("/"); + if (path) + html_url_path(path); } if (head && ctx.repo->defbranch && strcmp(head, ctx.repo->defbranch)) { html(delim); @@ -1001,44 +971,27 @@ static void print_header(void) } html(""); - if (ctx.repo) { - cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1); - html(" : "); - cgit_summary_link(ctx.repo->name, NULL, NULL, NULL); - if (ctx.env.authenticated) { - html(""); - html("
\n"); - cgit_add_hidden_formfields(0, 1, ctx.qry.page); - html(" "); - html(""); - html("
"); - } - } else - html_txt(ctx.cfg.root_title); + cgit_index_link(ctx.cfg.root_title, NULL, NULL, NULL, NULL, 0, 1); + if (ctx.env.authenticated) { + html(""); + html("
\n"); + cgit_add_hidden_formfields(0, 1, ctx.qry.page); + html(" "); + html(""); + html("
"); + } html("\n"); html(""); - if (ctx.repo) { - html_txt(ctx.repo->desc); - html(""); - 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); - } + if (ctx.cfg.root_desc) + html_txt(ctx.cfg.root_desc); html("\n"); }