Display SHA256 digest only, and in hex
This commit is contained in:
parent
dd55491138
commit
37a916517d
6 changed files with 11 additions and 15 deletions
|
@ -14,6 +14,8 @@ build: [
|
|||
depends: [
|
||||
"builder"
|
||||
"opium"
|
||||
"bos"
|
||||
"hex"
|
||||
]
|
||||
|
||||
synopsis: "Web interface for builder"
|
||||
|
|
|
@ -92,7 +92,7 @@ let routes (t : Model.t) =
|
|||
let body = Body.of_string data in
|
||||
Response.make ~body ()
|
||||
|> Response.add_header ("Content-type", Magic_mime.lookup file)
|
||||
|> Response.set_etag (Base64.encode_string digest.sha256)
|
||||
|> Response.set_etag (Base64.encode_string (Cstruct.to_string digest.sha256))
|
||||
in
|
||||
|
||||
[
|
||||
|
|
2
lib/dune
2
lib/dune
|
@ -1,3 +1,3 @@
|
|||
(library
|
||||
(name builder_web)
|
||||
(libraries builder opium tyxml bos rresult duration))
|
||||
(libraries builder opium tyxml bos rresult duration hex))
|
||||
|
|
|
@ -25,8 +25,7 @@ type job_run_info = {
|
|||
}
|
||||
|
||||
type digest = {
|
||||
sha256 : string;
|
||||
sha512 : string;
|
||||
sha256 : Cstruct.t;
|
||||
}
|
||||
|
||||
type t = {
|
||||
|
@ -59,8 +58,7 @@ let digest (path, data) =
|
|||
let module H = Mirage_crypto.Hash in
|
||||
let data = Cstruct.of_string data in
|
||||
(path, {
|
||||
sha256 = H.SHA256.digest data |> Cstruct.to_string;
|
||||
sha512 = H.SHA512.digest data |> Cstruct.to_string;
|
||||
sha256 = H.SHA256.digest data;
|
||||
})
|
||||
|
||||
let read_full_with_digests t path run =
|
||||
|
|
|
@ -9,8 +9,7 @@ type job_run_meta = {
|
|||
}
|
||||
|
||||
type digest = {
|
||||
sha256 : string;
|
||||
sha512 : string;
|
||||
sha256 : Cstruct.t;
|
||||
}
|
||||
|
||||
type job_run_info = {
|
||||
|
|
11
lib/views.ml
11
lib/views.ml
|
@ -129,17 +129,14 @@ let job_run
|
|||
p [txtf "Execution result: %a." Builder.pp_execution_result result];
|
||||
h3 [txt "Digests of build artifacts"];
|
||||
dl (List.concat_map
|
||||
(fun (path, { Model.sha256; sha512 }) -> [
|
||||
(fun (path, { Model.sha256 }) ->
|
||||
let (`Hex sha256_hex) = Hex.of_cstruct sha256 in
|
||||
[
|
||||
dt [a
|
||||
~a:[Fmt.kstr a_href "f/%a" Fpath.pp path]
|
||||
[code [txtf "%a" Fpath.pp path]];
|
||||
txt "(SHA256)"];
|
||||
dd [code [txtf "%s" (Base64.encode_string sha256)]];
|
||||
dt [a
|
||||
~a:[Fmt.kstr a_href "f/%a" Fpath.pp path]
|
||||
[code [txtf "%a" Fpath.pp path]];
|
||||
txt "(SHA512)"];
|
||||
dd [code [txtf "%s" (Base64.encode_string sha512)]];
|
||||
dd [code [txt sha256_hex]];
|
||||
])
|
||||
digests);
|
||||
h3 [txt "Job script"];
|
||||
|
|
Loading…
Reference in a new issue