Expose maximum expiry to frontend

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-06-26 18:31:31 +02:00
parent 62ca7b3900
commit ddd43503dd
No known key found for this signature in database
GPG Key ID: D91C3E91E4CAD6F5
2 changed files with 3 additions and 0 deletions

View File

@ -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 }}')
</script>

View File

@ -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)