This commit is contained in:
parent
36c04a0179
commit
2a5b29d1c3
4 changed files with 13 additions and 13 deletions
|
|
@ -13,16 +13,16 @@ type t =
|
||||||
| Privacy
|
| Privacy
|
||||||
|
|
||||||
let etag = function
|
let etag = function
|
||||||
| Terms -> Config_mte.terms_etag
|
| Terms -> Config.terms_etag
|
||||||
| Privacy -> Config_mte.privacy_etag
|
| Privacy -> Config.privacy_etag
|
||||||
|
|
||||||
let legal_version = function
|
let legal_version = function
|
||||||
| Terms -> Config_mte.terms_legal_version
|
| Terms -> Config.terms_legal_version
|
||||||
| Privacy -> Config_mte.privacy_legal_version
|
| Privacy -> Config.privacy_legal_version
|
||||||
|
|
||||||
let base_dir = function
|
let base_dir = function
|
||||||
| Terms -> Config_mte.terms_dir
|
| Terms -> Config.terms_dir
|
||||||
| Privacy -> Config_mte.privacy_dir
|
| Privacy -> Config.privacy_dir
|
||||||
|
|
||||||
(* TODO
|
(* TODO
|
||||||
better use of Fmt to have error prefix or smthing
|
better use of Fmt to have error prefix or smthing
|
||||||
|
|
@ -55,9 +55,9 @@ let supported_lang_arr, supported_ext_arr =
|
||||||
let () =
|
let () =
|
||||||
if List.is_empty lang_l then Fmt.failwith "no language supported";
|
if List.is_empty lang_l then Fmt.failwith "no language supported";
|
||||||
if List.is_empty ext_l then Fmt.failwith "no mimetype supported";
|
if List.is_empty ext_l then Fmt.failwith "no mimetype supported";
|
||||||
if not @@ List.mem Config_mte.default_lang lang_l then
|
if not @@ List.mem Config.default_lang lang_l then
|
||||||
Fmt.failwith "default language `%s` files not found"
|
Fmt.failwith "default language `%s` files not found"
|
||||||
Config_mte.default_lang;
|
Config.default_lang;
|
||||||
if not @@ List.mem ".txt" ext_l then
|
if not @@ List.mem ".txt" ext_l then
|
||||||
Fmt.failwith "plain text file not found";
|
Fmt.failwith "plain text file not found";
|
||||||
if not @@ List.mem ".md" ext_l then Fmt.failwith "markdown file not found";
|
if not @@ List.mem ".md" ext_l then Fmt.failwith "markdown file not found";
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,14 @@ let select_language headers =
|
||||||
|> Cohttp.Accept.qsort
|
|> Cohttp.Accept.qsort
|
||||||
|> List.map (fun (_q, lang) -> lang)
|
|> List.map (fun (_q, lang) -> lang)
|
||||||
|> List.map (function
|
|> List.map (function
|
||||||
| Cohttp.Accept.AnyLanguage -> Config_mte.default_lang
|
| Cohttp.Accept.AnyLanguage -> Config.default_lang
|
||||||
| Language language_range -> (
|
| Language language_range -> (
|
||||||
(* ignore language subtags (e.g. "en-US" -> "en") *)
|
(* ignore language subtags (e.g. "en-US" -> "en") *)
|
||||||
match language_range with
|
match language_range with
|
||||||
| [] -> assert false
|
| [] -> assert false
|
||||||
| primary_tag :: _ -> primary_tag))
|
| primary_tag :: _ -> primary_tag))
|
||||||
|> List.find_opt Assets.is_supported_lang
|
|> List.find_opt Assets.is_supported_lang
|
||||||
|> Option.value ~default:Config_mte.default_lang
|
|> Option.value ~default:Config.default_lang
|
||||||
|
|
||||||
let select_encoding headers =
|
let select_encoding headers =
|
||||||
Vif.Headers.get headers "accept-encoding"
|
Vif.Headers.get headers "accept-encoding"
|
||||||
|
|
@ -37,7 +37,7 @@ let select_encoding headers =
|
||||||
| Cohttp.Accept.Identity -> Some `Identity
|
| Cohttp.Accept.Identity -> Some `Identity
|
||||||
| Deflate -> Some `DEFLATE
|
| Deflate -> Some `DEFLATE
|
||||||
| Gzip -> Some `Gzip
|
| Gzip -> Some `Gzip
|
||||||
| AnyEncoding -> Some Config_mte.default_encoding
|
| AnyEncoding -> Some Config.default_encoding
|
||||||
| Encoding _ | Compress -> (* unsupported *) None)
|
| Encoding _ | Compress -> (* unsupported *) None)
|
||||||
|> function
|
|> function
|
||||||
| [] -> assert false
|
| [] -> assert false
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ module Static = struct
|
||||||
in
|
in
|
||||||
let* () =
|
let* () =
|
||||||
(* todo: is it "taler-privacy-version" for /policy ? *)
|
(* todo: is it "taler-privacy-version" for /policy ? *)
|
||||||
add ~field:"taler-terms-version" Config_mte.terms_legal_version
|
add ~field:"taler-terms-version" Config.terms_legal_version
|
||||||
in
|
in
|
||||||
let* () =
|
let* () =
|
||||||
add ~field:"avail-languages" Headers.avail_languages_header_value
|
add ~field:"avail-languages" Headers.avail_languages_header_value
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ module Mimetype = struct
|
||||||
List.find_opt (( = ) (m, m_sub)) mimetype_l
|
List.find_opt (( = ) (m, m_sub)) mimetype_l
|
||||||
| AnyMediaSubtype m ->
|
| AnyMediaSubtype m ->
|
||||||
List.find_opt (fun (m', _) -> String.equal m m') mimetype_l
|
List.find_opt (fun (m', _) -> String.equal m m') mimetype_l
|
||||||
| AnyMedia -> Some Config_mte.default_mimetype
|
| AnyMedia -> Some Config.default_mimetype
|
||||||
|
|
||||||
let to_extension (m, m_sub) =
|
let to_extension (m, m_sub) =
|
||||||
assert (m <> "*");
|
assert (m <> "*");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue