Set author image to cat avatar; introduce gcrypt to compute hash

Julien LepillerMon Sep 28 18:18:02+0200 2020

86cf7b5

Set author image to cat avatar; introduce gcrypt to compute hash

configure.ac

1717
  AC_MSG_ERROR([The Guile bindings of libgit2 are missing; please install them.])
1818
fi
1919
20+
GUILE_MODULE_AVAILABLE([have_gcrypt], [(gcrypt hash)])
21+
if test "x$have_gcrypt" != "xyes"; then
22+
  AC_MSG_ERROR([The Guile bindings of Gcrypt are missing; please install them.])
23+
fi
24+
2025
GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)])
2126
if test "x$have_gnutls" != "xyes"; then
2227
  AC_MSG_ERROR([The Guile bindings of GnuTLS are missing; please install them.])

gitile/pages.scm

1616
;;;; 
1717
1818
(define-module (gitile pages)
19+
  #:use-module (gcrypt base16)
20+
  #:use-module (gcrypt hash)
1921
  #:use-module (gitile repo)
2022
  #:use-module (git)
2123
  #:use-module (git types)

110112
    ,(project-files repository-name repo)))
111113
112114
(define (author-image author)
113-
  "/images/unknown.png")
115+
  (string-append "https://avatar.lepiller.eu/cat-avatar-generator.php?seed="
116+
                 (bytevector->base16-string
117+
                   (bytevector-hash
118+
                     (string->utf8 (signature-email author))
119+
                     (hash-algorithm sha1)))))
114120
115121
(define (commit->date-string commit)
116122
  (date->string

139145
             ,(string-take (oid->string (commit-id commit)) 7))
140146
          (button (@ (data-clipboard-copy ,(oid->string (commit-id commit)))
141147
                     (class "copy"))
142-
              (img (@ (src "/images/copy.png"))))
148+
              (img (@ (src "/images/copy.svg"))))
143149
          ,(if open?
144150
               `(a (@ (href "/" ,repository-name "/tree/"
145151
                            ,(oid->string (commit-id commit))))
146-
                    (img (@ (src "/images/go.png"))))
152+
                    (img (@ (src "/images/go.svg"))))
147153
	       '()))))
148154
149155
(define (project-commits repository-name repo ref)

guix.scm

1919
             (guix licenses)
2020
             (guix build-system gnu)
2121
             (gnu packages autotools)
22+
             (gnu packages gnupg)
2223
             (gnu packages guile)
2324
             (gnu packages guile-xyz)
2425
             (gnu packages pkg-config)

3132
  (build-system gnu-build-system)
3233
  (inputs
3334
   `(("guile-git" ,guile-git)
35+
     ("guile-gcrypt" ,guile-gcrypt)
3436
     ("gnutls" ,gnutls)
3537
     ("guile-fibers" ,guile-fibers)))
3638
  (native-inputs