1
0
Fork 0
forked from jriou/coller

feat: add expiration time in the note web view

Fixes #35.

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2025-09-22 17:11:54 +02:00
commit 634326190c
Signed by: jriou
GPG key ID: 9A099EDA51316854
3 changed files with 17 additions and 1 deletions

View file

@ -106,6 +106,7 @@ func (s *Server) Start() error {
// Web pages
funcs := template.FuncMap{
"HumanDuration": internal.HumanDuration,
"TimeDiff": internal.TimeDiff,
"lower": strings.ToLower,
"string": func(b []byte) string { return string(b) },
}

View file

@ -19,13 +19,18 @@
<div class="d-flex flex-wrap py-2">
<span class="fs-4 d-flex mb-3 mb-md-0 me-md-auto text-decoration-none">Note {{.Note.ID}}</span>
<ul class="nav nav-pills align-items-center">
<li class="nav-item">
<li class="nav-item px-2">
<a href="" id="rawURL">raw</a>
<script>document.getElementById("rawURL").href = window.location.href.replace(".html", "");</script>
</li>
<li class="nav-item px-2">
{{.Note.Language}}
</li>
{{if eq .Note.DeleteAfterRead false}}
<li class="nav-item px-2">
expires in {{HumanDuration (TimeDiff .Note.ExpiresAt)}}
</li>
{{end}}
</ul>
</div>
<div class="row">