mobley

C Git HTTP server
Log | Files | Refs | Submodules | README | git clone https://git.ne02ptzero.me/git/mobley

commit b61f8b185ae978a617c721de426dc0171a31de05
parent 7b9bd1f7b3a1cdf53e72b7c65d07acbed282a170
Author: Louis Solofrizzo <lsolofrizzo@online.net>
Date:   Fri,  5 Apr 2019 18:57:35 +0200

Templating: Fix some static link and HTTPS cloning

Signed-off-by: Louis Solofrizzo <lsolofrizzo@online.net>

Diffstat:
Mfile.c | 2+-
Mhtml.c | 8++++----
Mhtml.h | 6+++---
Mtemplate.c | 2+-
4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/file.c b/file.c @@ -185,7 +185,7 @@ static bool file_show_header(mobley_t *ctx, server_req_t *r, git_blob *blob, con html_open("td") { html_nd("i", .class = __format("fa fa-%s fa-fw", file_icon(path))); html("b", path); - html_raw("%zu Bytes", git_blob_rawsize(blob)); + html_raw("%llu Bytes", git_blob_rawsize(blob)); } html_close("td"); html_open("td", .align = "right") { diff --git a/html.c b/html.c @@ -26,12 +26,12 @@ void _html(server_req_t *r, const mobley_t *ctx, const char *b, const char *d, if (a->is_static) { evbuffer_add_printf(r->req->buffer_out, - " href=\"http://%s:%d/static/%s\"", ctx->ip, ctx->port, a->href); + " href=\"/static/%s\"", a->href); } else if (a->href[0] == '/') { evbuffer_add_printf(r->req->buffer_out, - " href=\"http://%s:%d%s", ctx->ip, ctx->port, a->href); + " href=\"%s", a->href); add_param = true; } else if (strncmp(a->href, "http", sizeof("http") - 1) == 0 || a->href[0] == '#') @@ -41,8 +41,8 @@ void _html(server_req_t *r, const mobley_t *ctx, const char *b, const char *d, else { evbuffer_add_printf(r->req->buffer_out, - " href=\"http://%s:%d/%s/%s", ctx->ip, ctx->port, - (r->route == NULL ? "" : r->route), a->href); + " href=\"%s%s/%s", + (r->route == NULL ? "" : "/"), (r->route == NULL ? "" : r->route), a->href); add_param = true; } diff --git a/html.h b/html.h @@ -51,15 +51,15 @@ void _html(server_req_t *r, const mobley_t *ctx, # define html_git_date(s) do { \ struct tm *__timeinfo; \ \ - __timeinfo = localtime(s); \ + __timeinfo = localtime((const time_t *)s); \ html_raw("%s", asctime(__timeinfo)); \ } while (0) -# define html_git_date_ftime(s, f) do { \ +# define html_git_date_ftime(s, f) do { \ struct tm *__timeinfo; \ char __buffer[150]; \ \ - __timeinfo = localtime(s); \ + __timeinfo = localtime((const time_t *)s); \ strftime(__buffer, sizeof(__buffer), f, __timeinfo); \ html_raw("%s", __buffer); \ } while (0) diff --git a/template.c b/template.c @@ -132,7 +132,7 @@ static void template_menu(const mobley_t *ctx, server_req_t *r) html_open("li") { html_open("div", .class = "url") { - html_raw("%s:%s", ctx->conf.clone_ssh_url, r->repo->name); + html_raw("%s/%s", ctx->conf.clone_ssh_url, r->repo->name); } html_close("div"); } html_close("li");