-rw-r--r-- | ui-shared.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c index d909f55..f858ab6 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -451,99 +451,99 @@ void cgit_print_http_headers(struct cgit_context *ctx) | |||
451 | htmlf("Content-Type: %s\n", ctx->page.mimetype); | 451 | htmlf("Content-Type: %s\n", ctx->page.mimetype); |
452 | if (ctx->page.size) | 452 | if (ctx->page.size) |
453 | htmlf("Content-Length: %ld\n", ctx->page.size); | 453 | htmlf("Content-Length: %ld\n", ctx->page.size); |
454 | if (ctx->page.filename) | 454 | if (ctx->page.filename) |
455 | htmlf("Content-Disposition: inline; filename=\"%s\"\n", | 455 | htmlf("Content-Disposition: inline; filename=\"%s\"\n", |
456 | ctx->page.filename); | 456 | ctx->page.filename); |
457 | htmlf("Last-Modified: %s\n", http_date(ctx->page.modified)); | 457 | htmlf("Last-Modified: %s\n", http_date(ctx->page.modified)); |
458 | htmlf("Expires: %s\n", http_date(ctx->page.expires)); | 458 | htmlf("Expires: %s\n", http_date(ctx->page.expires)); |
459 | html("\n"); | 459 | html("\n"); |
460 | } | 460 | } |
461 | 461 | ||
462 | void cgit_print_docstart(struct cgit_context *ctx) | 462 | void cgit_print_docstart(struct cgit_context *ctx) |
463 | { | 463 | { |
464 | char *host = cgit_hosturl(); | 464 | char *host = cgit_hosturl(); |
465 | html(cgit_doctype); | 465 | html(cgit_doctype); |
466 | html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n"); | 466 | html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n"); |
467 | html("<head>\n"); | 467 | html("<head>\n"); |
468 | html("<title>"); | 468 | html("<title>"); |
469 | html_txt(ctx->page.title); | 469 | html_txt(ctx->page.title); |
470 | html("</title>\n"); | 470 | html("</title>\n"); |
471 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); | 471 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); |
472 | if (ctx->cfg.robots && *ctx->cfg.robots) | 472 | if (ctx->cfg.robots && *ctx->cfg.robots) |
473 | htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots); | 473 | htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots); |
474 | html("<link rel='stylesheet' type='text/css' href='"); | 474 | html("<link rel='stylesheet' type='text/css' href='"); |
475 | html_attr(ctx->cfg.css); | 475 | html_attr(ctx->cfg.css); |
476 | html("'/>\n"); | 476 | html("'/>\n"); |
477 | if (ctx->cfg.favicon) { | 477 | if (ctx->cfg.favicon) { |
478 | html("<link rel='shortcut icon' href='"); | 478 | html("<link rel='shortcut icon' href='"); |
479 | html_attr(ctx->cfg.favicon); | 479 | html_attr(ctx->cfg.favicon); |
480 | html("'/>\n"); | 480 | html("'/>\n"); |
481 | } | 481 | } |
482 | if (host && ctx->repo) { | 482 | if (host && ctx->repo) { |
483 | html("<link rel='alternate' title='Atom feed' href='http://"); | 483 | html("<link rel='alternate' title='Atom feed' href='http://"); |
484 | html_attr(cgit_hosturl()); | 484 | html_attr(cgit_hosturl()); |
485 | html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path, | 485 | html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path, |
486 | fmt("h=%s", ctx->qry.head))); | 486 | fmt("h=%s", ctx->qry.head))); |
487 | html("' type='application/atom+xml'/>"); | 487 | html("' type='application/atom+xml'/>"); |
488 | } | 488 | } |
489 | html("</head>\n"); | 489 | html("</head>\n"); |
490 | html("<body>\n"); | 490 | html("<body>\n"); |
491 | } | 491 | } |
492 | 492 | ||
493 | void cgit_print_docend() | 493 | void cgit_print_docend() |
494 | { | 494 | { |
495 | html("</div>"); | 495 | html("</div>"); |
496 | if (ctx.cfg.footer) | 496 | if (ctx.cfg.footer) |
497 | html_include(ctx.cfg.footer); | 497 | html_include(ctx.cfg.footer); |
498 | else { | 498 | else { |
499 | html("<div class='footer'>generated "); | 499 | htmlf("<div class='footer'>generated by cgit %s at ", |
500 | cgit_version); | ||
500 | cgit_print_date(time(NULL), FMT_LONGDATE, ctx.cfg.local_time); | 501 | cgit_print_date(time(NULL), FMT_LONGDATE, ctx.cfg.local_time); |
501 | htmlf(" by cgit %s", cgit_version); | ||
502 | html("</div>\n"); | 502 | html("</div>\n"); |
503 | } | 503 | } |
504 | html("</body>\n</html>\n"); | 504 | html("</body>\n</html>\n"); |
505 | } | 505 | } |
506 | 506 | ||
507 | int print_branch_option(const char *refname, const unsigned char *sha1, | 507 | int print_branch_option(const char *refname, const unsigned char *sha1, |
508 | int flags, void *cb_data) | 508 | int flags, void *cb_data) |
509 | { | 509 | { |
510 | char *name = (char *)refname; | 510 | char *name = (char *)refname; |
511 | html_option(name, name, ctx.qry.head); | 511 | html_option(name, name, ctx.qry.head); |
512 | return 0; | 512 | return 0; |
513 | } | 513 | } |
514 | 514 | ||
515 | int print_archive_ref(const char *refname, const unsigned char *sha1, | 515 | int print_archive_ref(const char *refname, const unsigned char *sha1, |
516 | int flags, void *cb_data) | 516 | int flags, void *cb_data) |
517 | { | 517 | { |
518 | struct tag *tag; | 518 | struct tag *tag; |
519 | struct taginfo *info; | 519 | struct taginfo *info; |
520 | struct object *obj; | 520 | struct object *obj; |
521 | char buf[256], *url; | 521 | char buf[256], *url; |
522 | unsigned char fileid[20]; | 522 | unsigned char fileid[20]; |
523 | int *header = (int *)cb_data; | 523 | int *header = (int *)cb_data; |
524 | 524 | ||
525 | if (prefixcmp(refname, "refs/archives")) | 525 | if (prefixcmp(refname, "refs/archives")) |
526 | return 0; | 526 | return 0; |
527 | strncpy(buf, refname+14, sizeof(buf)); | 527 | strncpy(buf, refname+14, sizeof(buf)); |
528 | obj = parse_object(sha1); | 528 | obj = parse_object(sha1); |
529 | if (!obj) | 529 | if (!obj) |
530 | return 1; | 530 | return 1; |
531 | if (obj->type == OBJ_TAG) { | 531 | if (obj->type == OBJ_TAG) { |
532 | tag = lookup_tag(sha1); | 532 | tag = lookup_tag(sha1); |
533 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) | 533 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) |
534 | return 0; | 534 | return 0; |
535 | hashcpy(fileid, tag->tagged->sha1); | 535 | hashcpy(fileid, tag->tagged->sha1); |
536 | } else if (obj->type != OBJ_BLOB) { | 536 | } else if (obj->type != OBJ_BLOB) { |
537 | return 0; | 537 | return 0; |
538 | } else { | 538 | } else { |
539 | hashcpy(fileid, sha1); | 539 | hashcpy(fileid, sha1); |
540 | } | 540 | } |
541 | if (!*header) { | 541 | if (!*header) { |
542 | html("<h1>download</h1>\n"); | 542 | html("<h1>download</h1>\n"); |
543 | *header = 1; | 543 | *header = 1; |
544 | } | 544 | } |
545 | url = cgit_pageurl(ctx.qry.repo, "blob", | 545 | url = cgit_pageurl(ctx.qry.repo, "blob", |
546 | fmt("id=%s&path=%s", sha1_to_hex(fileid), | 546 | fmt("id=%s&path=%s", sha1_to_hex(fileid), |
547 | buf)); | 547 | buf)); |
548 | html_link_open(url, NULL, "menu"); | 548 | html_link_open(url, NULL, "menu"); |
549 | html_txt(strlpart(buf, 20)); | 549 | html_txt(strlpart(buf, 20)); |