From ddd43503dd289a14cd82fb4e2087eb0bd62ac3a6 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 26 Jun 2023 18:31:31 +0200 Subject: [PATCH] Expose maximum expiry to frontend Signed-off-by: Knut Ahlers --- frontend/index.html | 1 + main.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/frontend/index.html b/frontend/index.html index f229d41..f6cea32 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -48,6 +48,7 @@ document.addEventListener('DOMContentLoaded', () => window.refreshTheme()) // Template variable from Golang process + const maxSecretExpire = {{ .MaxSecretExpiry }} const version = "{{ .Version }}" window.OTSCustomize = JSON.parse('{{ .Customize.ToJSON }}') diff --git a/main.go b/main.go index e4e9dbc..7e2b931 100644 --- a/main.go +++ b/main.go @@ -182,10 +182,12 @@ func handleIndex(w http.ResponseWriter, r *http.Request) { if err := indexTpl.Execute(w, struct { Customize customize InlineContentNonce string + MaxSecretExpiry int64 Version string }{ Customize: cust, InlineContentNonce: inlineContentNonceStr, + MaxSecretExpiry: cfg.SecretExpiry, Version: version, }); err != nil { http.Error(w, errors.Wrap(err, "executing template").Error(), http.StatusInternalServerError)