wip accepted lang
This commit is contained in:
parent
b96c671e01
commit
119d31a160
2 changed files with 32 additions and 1 deletions
|
|
@ -4,3 +4,15 @@ let terms_dir = Fpath.(v "terms")
|
||||||
let terms_etag = "0"
|
let terms_etag = "0"
|
||||||
let privacy_dir = Fpath.(v "privacy")
|
let privacy_dir = Fpath.(v "privacy")
|
||||||
let privacy_etag = "0"
|
let privacy_etag = "0"
|
||||||
|
|
||||||
|
(* todo: should be infered from folder structure? *)
|
||||||
|
let supported_languages = [| "en"; "fr" |]
|
||||||
|
|
||||||
|
(*
|
||||||
|
let supported_extensions =
|
||||||
|
[| "html"; "htm"; "txt"; "pdf"; "jpg"; "jpeg"; "png"; "gif" |]
|
||||||
|
*)
|
||||||
|
|
||||||
|
(* todo
|
||||||
|
terms_matrix:
|
||||||
|
ext X lang *)
|
||||||
|
|
|
||||||
21
src/mte.ml
21
src/mte.ml
|
|
@ -12,8 +12,27 @@ module Assets = struct
|
||||||
get Fpath.((Config.privacy_dir / "en" / Config.privacy_etag) + ".html")
|
get Fpath.((Config.privacy_dir / "en" / Config.privacy_etag) + ".html")
|
||||||
end
|
end
|
||||||
|
|
||||||
let static data req _server _env =
|
let static kind req _server _env =
|
||||||
let open Vif.Response.Syntax in
|
let open Vif.Response.Syntax in
|
||||||
|
let extension = .. in
|
||||||
|
if not @@ extension is supported then
|
||||||
|
error mimetype not supported
|
||||||
|
else
|
||||||
|
|
||||||
|
let base_dir, etag =
|
||||||
|
let open Config in
|
||||||
|
match kind with
|
||||||
|
| `Terms -> terms_dir, terms_etag
|
||||||
|
| `Privacy -> privacy_dir, privacy_etag
|
||||||
|
in
|
||||||
|
|
||||||
|
let accepted_lang_l = .. in
|
||||||
|
|
||||||
|
|
||||||
|
(* add headers ... *)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let* () = Vif.Response.with_string ~compression:`Gzip req data in
|
let* () = Vif.Response.with_string ~compression:`Gzip req data in
|
||||||
let field = "content-type" in
|
let field = "content-type" in
|
||||||
let* () = Vif.Response.add ~field "html; charset=utf-8" in
|
let* () = Vif.Response.add ~field "html; charset=utf-8" in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue