add avail-languages header

This commit is contained in:
Swrup 2025-09-28 18:36:25 +02:00
parent 0a0eac7cd9
commit 0447857d1e
2 changed files with 19 additions and 16 deletions

View file

@ -13,6 +13,15 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. *)
(* /terms + /privacy
- try to find a response with an acceptable mime-type
- pick the version in the most preferred language of the user
- apply compression if that is allowed by the client
- set ETAG header
- If it did not change, a "304 Not Modified" response will be returned
- A "Taler-Terms-Version" header is generated to indicate the legal version of the terms
- When returning a full response (not a "304 Not Modified"),
include a "Avail-Languages" header: a comma-separated list of the languages available *)
module Static = struct
let select_file headers kind =
let open Syntax in
@ -24,23 +33,8 @@ module Static = struct
Option.to_result ~none:"no acceptable language"
(Headers.select_language headers)
in
let content = Assets.get_content ~lang ~ext kind in
content
Assets.get_content ~lang ~ext kind
(* /terms + /privacy
- try to find a response with an acceptable mime-type,
- then pick the version in the most preferred language of the user,
- and finally apply compression if that is allowed by the client
- set ETAG header
- If it did not change, a "304 Not Modified" response will be returned
- A "Taler-Terms-Version" header is generated to indicate the legal version of the terms
TODO:
- When returning a full response (not a "304 Not Modified"), the server
should also include a "Avail-Languages" header which includes a
comma-separated list of the languages in which the terms of service are available in
*)
let static kind req _server _env =
let get_ok = function
| Error e -> Fmt.failwith "TODO handle me, %s" e
@ -75,6 +69,10 @@ module Static = struct
Vif.Response.add ~field:"taler-terms-version"
Config.terms_legal_version
in
let* () =
Vif.Response.add ~field:"avail-languages"
Headers.avail_languages_header_value
in
(* TODO content-type *)
let* () =
Vif.Response.add ~field:"content-type" "html; charset=utf-8"