use logs + add static.ml + fmt
This commit is contained in:
parent
ad648178ab
commit
cf4da6b382
15 changed files with 246 additions and 196 deletions
|
|
@ -1,8 +1,4 @@
|
|||
(* module to handle assets. for now, assets are defined to all be in
|
||||
`src/assets/` folder. crunched into the [Assets_crunch] module.
|
||||
|
||||
to keep it simple, we require that /terms and /privacy support the same set
|
||||
of languages X mimetypes *)
|
||||
(* TODO clean up *)
|
||||
|
||||
(* docs: https://docs.taler.net/manpages/taler-exchange.conf.5.html
|
||||
https://docs.taler.net/design-documents/003-tos-rendering.html *)
|
||||
|
|
@ -11,7 +7,7 @@
|
|||
let default_lang = "en"
|
||||
let default_encoding : [< `Identity | `DEFLATE | `Gzip ] = `Identity
|
||||
|
||||
(* TODO Taler documentation markdown mimetype should be the prefered one, and be
|
||||
(* todo: Taler documentation markdown mimetype should be the prefered one, and be
|
||||
supported, according to DD we take text/plain as default instead for now *)
|
||||
let default_mimetype = ("text", "plain")
|
||||
let default_extension = ".txt"
|
||||
|
|
@ -21,10 +17,14 @@ let privacy_legal_version = "1"
|
|||
module Mimetype = struct
|
||||
let mimetype_extension_assoc =
|
||||
[
|
||||
(("text", "plain"), ".txt"); (("text", "markdown"), ".md");
|
||||
(("text", "html"), ".html"); (("text", "html"), ".htm");
|
||||
(("application", "pdf"), ".pdf"); (("image", "jpeg"), ".jpg");
|
||||
(("image", "jpeg"), ".jpeg"); (("image", "png"), ".png");
|
||||
(("text", "plain"), ".txt");
|
||||
(("text", "markdown"), ".md");
|
||||
(("text", "html"), ".html");
|
||||
(("text", "html"), ".htm");
|
||||
(("application", "pdf"), ".pdf");
|
||||
(("image", "jpeg"), ".jpg");
|
||||
(("image", "jpeg"), ".jpeg");
|
||||
(("image", "png"), ".png");
|
||||
(("image", "gif"), ".gif");
|
||||
]
|
||||
|
||||
|
|
@ -69,9 +69,6 @@ let base_dir = function
|
|||
| Terms -> Fpath.v "terms"
|
||||
| Privacy -> Fpath.v "privacy"
|
||||
|
||||
(* TODO
|
||||
better use of Fmt to have error prefix or smthing
|
||||
use Logs *)
|
||||
(* does some checks on assets/ folder content and infer the set of supported languages and mimetype *)
|
||||
let supported_lang_arr, supported_ext_arr =
|
||||
let open Syntax in
|
||||
|
|
@ -139,9 +136,6 @@ let is_supported_lang lang = Array.mem lang supported_lang_arr
|
|||
let is_supported_ext ext = Array.mem ext supported_ext_arr
|
||||
let is_supported_mimetype mime = Array.mem mime supported_mimetype_arr
|
||||
|
||||
(* todo
|
||||
- put content in a matrix instead?
|
||||
- better types to force valid params? *)
|
||||
(* ! lang and mime must be supported *)
|
||||
let get_content ~lang ~mime t =
|
||||
let etag = Headers_lib.Etag.to_raw_string (etag t) in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue